184 Commits

Author SHA1 Message Date
David CARLIER
2fcff51dbc gdbclient reduces risk of use after free down the road ##gdbclient (#15529) 2019-11-29 11:28:52 +01:00
yossizap
8f34771320 Added parsing of gdbr arm/arm64 register features and added a default to >64bit registers
Since r2 doesn't support set/get to large/vector registers (it will still work
when printing gdb's registers with dr/drt or restoring the registers
with reverse stepping), there's a possible issue that the user will get
lots of prints of "r_reg_[get/set]_value: Bit size 128 not supported"
when running various debug commands that use those functions. This fix
simply moves those registers away from gpr to avoid those prints while
still being able to view/restore the registers.
2019-11-20 12:57:33 +01:00
yossizap
68babb75f3 Added parsing support to all gdb registers ##debug
The previous implementation was limited to 64bit registers and didn't
parse the 'feature' field.
2019-11-18 22:56:56 -06:00
yossizap
3c0267fc0a Fix gdbr's reg_write and reg_next_diff for reverse stepping ##debug
Writing registers with gdbr worked with single registers because
reg_next_diff started at delta 0 and only had to run the diff once for
the single register that was changed. When running reverse
stepping/continue, multiple registers are changed at once so
r_reg_next_diff would fail every time due to incorrect offset calculation.
The new r_reg_next_diff also support different register sizes to restore
all registers correctly.
The endianity swapping part from reg_write isn't needed since the arena
is the return value of 'g' which is already in the correct target byte
order (see: https://sourceware.org/gdb/onlinedocs/gdb/Packets.html#read-registers-packet)
2019-11-18 22:56:56 -06:00
yossizap
b5902beb36 Reduced gdbr's tcp connect timeout and added a break ##debug 2019-11-18 01:38:08 +01:00
yossizap
bbb837930a Fix gdbr not closing sockets after connect failed ##debug
The socket object was free'd without closing the fd. In the following
gdbr_connect attempts, tcp's connect would freeze on a valid socket since
connection based protocol sockets may successfully connect only once,
any connections beyond that are undefined behavior.
2019-11-18 01:38:08 +01:00
yossizap
279f53122f Add break to gdbr's read_packet and move isbreaked to libgdbr ##debug
Since read_packet has a large number of retries you would wait for it
for a couple of seconds after breaking in functions like connect and
vcont
2019-11-14 12:31:56 +01:00
yossizap
0b68cab009 Fix gdbr_write_registers and refactor gdbr_write_reg ##debug
Previously, write_registers sent a partial string instead of the
correct register format which specifies that each byte should be
represented by two hex digits.
2019-11-14 12:31:56 +01:00
yossizap
b86c251a35 Replaced lock_check with tryenter in gdbr_read_registers ##debug
This change allows reading registers when calling read_registers in
a thread that holds the recursive mutex.
2019-11-14 12:31:56 +01:00
David CARLIER
cb7e8e7310 Fix few warnings for the gdb client 2019-11-11 21:54:06 +01:00
yossizap
739078d7a4 Add breaking to gdbr connect to avoid waiting on invalid connections (#15442) ##debug
R2 will hang while waiting for any resolvable port to respond, this takes
a long while since connect is attempted twice in r_core_file_open.
2019-11-11 00:09:24 +01:00
yossizap
e35f447a2a Added break to gdbserver vCont and refactored the code to use locks (#15433)
The previous gdbr implementation didn't allow interrupting background
tasks with &b since send_vcon wasn't properly configured with the cons
api. In addition to that, gdbserver doesn't support processing multiple
commands at the same time, resulting in undefined behavior once cons
were set up for vcont.
This commit adds the relevant cons api and solves the concurrency issues
by adding locks on all socket related logic.
2019-11-10 19:03:56 +01:00
Khairul Kasmiran
84ce2a7d04 r_list_new() -> r_list_new () 2019-11-10 14:06:02 +08:00
yossizap
82b02e8b89 Fixed opcodes not being associated with the current thread in gdbr (#15358) ##debug 2019-10-25 19:41:34 +02:00
Lev Aronsky
5137ef6daf Fix gdb reg write byte order (#15009) ##debug
* Added ba2 so that the gdbserver backend connects correctly

* Fixes to remote gdb register writes:

1. Byte order is target-defined. Use cfg.bigendian for now. Possibly get it from target later?
2. Register number should be hexadecimal.
2019-09-11 11:05:17 +02:00
Srimanta Barua
e7ef4e6d62 Fix crash in gdb client (#14897) ##debug
* Remove recursive handle_stop_reason call
2019-08-26 21:05:30 +02:00
Srimanta Barua
e951ba787f Wait ~10s for response to qSupported packet. Send another qSupported (#14104)
packet on timeout. Do this 5 times, and then bail out.
2019-05-19 16:39:57 +02:00
David CARLIER
a51233bb3f Few more memory leaks fixes (#14072) 2019-05-14 22:09:08 +02:00
Khairul Azhar Kasmiran
8d2b16d74f r_str_prefix() -> r_str_prepend() (#14048) 2019-05-13 16:16:13 +02:00
Anton Kochkov
bb67b54f74
Remove CYGWIN & MINGW remnants (#13377) 2019-03-15 12:55:08 +08:00
Lowly Worm
b08199cf6d rm stupid debug printf 2019-01-20 17:53:11 -08:00
Lowly Worm
fc3ec317ec add support for apple debugserver on amd64 2019-01-20 17:52:35 -08:00
dav1901
21861d185a Remove unnecessary break (#12538) 2018-12-21 23:41:18 +01:00
dav1901
303a57bb85 Minor code cleanups/fixes (#12519) 2018-12-20 11:50:29 +01:00
dav1901
5b644dcb74 Minor cleanups/fixes (#12478) 2018-12-14 00:17:50 +01:00
dav1901
558a79cae7 Fix few minor leaks and remove dead code (#12201) 2018-11-17 18:19:04 +01:00
pancake
3738a97623 Fix several asserts and crashes when loading invalid reg profiles 2018-11-05 16:55:34 +01:00
radare
945e9566fb
Fix #11455 - Implement internal less pager with scr.pager=.. (#11548)
* Use full screen in r_cons_less (last line was not used before)
2018-09-17 12:15:12 +02:00
AsFaBw
84852de244 Fix 10811 - Improvements in gdbclient breakpoints (#10940) 2018-08-07 12:15:11 +02:00
d4em0n
3524f8b8ca Fix #10813 breakpoint kind when send to gdbserver and fix continue/stepping in gdbclient (arm) (#10818) 2018-07-31 09:37:20 +01:00
Alyssa Milburn
2c8901752f Add gdb support for v850 (#10809) 2018-07-24 14:59:07 +02:00
pancake
2c85194e7a Fix some warnings 2018-07-14 10:45:55 +02:00
Giovanni
397d6b1211 Fixed shlr java warnings and thread regression warning (#9447) 2018-02-21 05:03:03 +01:00
pancake
f1be2a2af3 Fix more crashes related to reopen gdb:// 2018-02-18 03:18:30 +01:00
pancake
eef94066a0 Fix some crashes for 9410 2018-02-18 03:08:17 +01:00
whitequark
c816dc7e66 Don't try to build shared libraries if configured as --without-pic.
Specifically, avoid building all plugins as non-static objects,
as well as some supplementary libraries. In fact, a large amount
of plugins was already gated to build as shared objects only with
WITHPIC=1, but this was not done consistently.
This gating has been moved to */p/Makefile.

Building these shared objects is a waste of time and breaks
the --without-pic build unless CFLAGS is forced in the make
invocation.
2018-01-11 23:09:22 +01:00
Srimanta Barua
2d2c38bb2c add sp to mips profile (#8958) 2017-12-05 11:39:13 +01:00
Srimanta Barua
a7af340174 Fixed double free in the gdbclient 2017-11-28 17:59:26 +01:00
pancake
9f12bb05cc Fix last covs 2017-11-23 14:38:28 +01:00
Srimanta Barua
21abaf4b51 Changed to a more correct system for parsing xml (#8863) 2017-11-22 12:03:09 +01:00
Srimanta Barua
7c6a992df6 fix appveyor 2017-10-05 11:01:44 +02:00
Srimanta Barua
95b3a74052 don't make signal handler do much work 2017-10-05 11:01:44 +02:00
Srimanta Barua
5eebf1efba sort of remove infinite loop 2017-10-05 11:01:44 +02:00
Srimanta Barua
852584ffac simulavr (plus some general) gdb fixes 2017-10-05 11:01:44 +02:00
pancake
71a6177b8a Fixes for the gdb-avr backend, lower min pkgtsz and fix tid<1 issue 2017-09-25 10:47:27 +02:00
pancake
b787a49d54 Fix stepping with Apple's debugerver 2017-09-23 00:06:04 +02:00
pancake
8520138afe Fix buffer overflow issues in gdb-read operations 2017-09-22 23:56:49 +02:00
Srimanta Barua
3640a7cb8b paged reading for gdb (otherwise it doesn't work on qemu) (#8572) 2017-09-20 13:33:45 +02:00
Srimanta Barua
915589b51d cleaned up and corrected memory reading (#8568) 2017-09-19 15:02:49 +02:00
pancake
08f64793ea Implement r_io_map_reset and new command omm 2017-09-13 00:23:26 +02:00