Commit Graph

218 Commits

Author SHA1 Message Date
pancake
c8ae21f68f
Only build library archives when -Dblob is provided ##build
* Lowers the amount of objects from 2400 to 1500
2022-03-22 11:59:13 +01:00
pancake
f8a35da205
Dont use != NULL as its implicit in C, even for bool casts ##refactor
$ find binr libr -name "*.c" -exec sed -i -e 's/ != NULL//g' {} \;
2022-03-15 19:54:04 +01:00
pancake
4648f448e1 Fix some static meson blob dependency leftovers ##build 2022-03-15 19:29:16 +01:00
Lazula
d507bda91c Remove R_EMPTY and R_EMPTY2 2022-03-13 11:26:10 +01:00
pancake
f2995c2949
Introduce r_strf and stop using sdb_fmt ##util 2022-01-18 18:35:31 +01:00
M. George Dan
c25595a767
Fix gdb reg parsing and gdb 'G' reg writing issues ##debug 2021-08-27 02:56:00 +02:00
pancake
f8b00a57df Remove mandatory assert from gdbclient 2021-07-13 00:37:42 +02:00
pancake
7c14bac05b
Add initial support for building r2 on WASI ##build 2021-06-20 17:14:43 +02:00
pancake
23ad9b50ee
Fix #12335 - ignore system-installed r2 includes ##build 2021-05-28 00:45:48 +02:00
pancake
530c737d5d
Fix incorrect use of non-const strings and fiz zousans of warnings (#18544)
Co-authored-by: pancake <pancake@nopcode.org>
2021-04-06 12:45:19 +02:00
pancake
bd0b0be77b
Two coverity findings less 2021-03-30 00:56:04 +02:00
pancake
a7c08c15ce Don't scream out WARNINGs, capitalizing it is enough 2021-03-19 11:02:54 +01:00
pancake
7ff2673dd9
Random uninitialized variable uses fixups (#18453) 2021-03-15 02:23:39 +01:00
Kamil Rytarowski
9d761f6a88
Avoid array subscript type issues (#18295)
Cast char to unsigned char for standard reasons and security purposes.

Fixes build issues on NetBSD.
2021-01-26 13:08:58 +01:00
pancake
51145a117a Fix some of the last coverities related to UAF and OOBREAD 2021-01-25 03:08:33 +01:00
pancake
171b994831 Fix #18212 - Detect RISCV gdb servers ##debug 2021-01-13 13:30:07 +01:00
yossizap
ac229c3216
Attach to target pid/tid on remote lldb connect ##debug (#17847) 2020-11-01 01:42:31 +01:00
Riccardo Schirone
2d160f2509
Avoid sdb double headers (#17249) ##build
* Avoid duplication of SDB headers in libr/include

SDB is an external project and as such it should live in shlr. However,
for simplicity in dealing with the include flags, the SDB headers were
copied in libr/include as well. This patch just keeps the SDB files
confined in shlr/sdb and make sure various r_* libs use the headers from
there.

* Fix pkgconfig file generation
2020-07-21 10:28:43 +02:00
Zi Fan
e968c9442a
Fix out-of-bounds write in arch_parse_reg_profile (#16956) 2020-05-27 14:39:17 +02:00
Zi Fan
3bea2cf5ed
Fix incorrect offset and type when parsing target description via remote gdb (#16948)
* Change regsize and regoff to mean bitsize instead of byte size
* Account for both "group" and "type" fields when extracting regs
2020-05-26 22:53:36 +08:00
David CARLIER
2019d9a78e
gdb arch reg profile memory leak fix ##debug (#16641) 2020-04-20 01:03:59 +02:00
Zi Fan
fec0aea039
Decouple shlr/gdb registers profile from code (#16312) ##debug
* Sync r2 debugger registers profile with shlr/gdb
* Add new set_reg_profile function to r_debug plugin
* Add set_reg_profile to r_debug_plugin_gdb
* Change "drp" to sync r_debug plugin register profile
* Fix incorrect pointer arithmetic and code style
2020-03-27 02:00:27 +01:00
Hye Sung Jung
757c23d5db Fix spelling errors (#15904) 2020-01-27 07:43:47 +01:00
yossizap
f64f2211fb Added reverse step and continue support to gdbr ##debug
This feature only works with server implementations that have ReverseStep
and ReverseContinue enabled, such as rr. The official gdbserver doesn't support it.
2020-01-15 09:49:03 +01:00
Anton Kochkov
f3a0a3d01c Some coverity fixes 2020-01-10 12:30:23 +01:00
yossizap
df8c96d260 Add packed sizes to gdb vector registers and improve mapping of target description to r2 regs ##debug
Some xmm registers were printed as fpu and bnd registers were shown in
all drt categories.
2020-01-04 11:36:48 +01:00
yossizap
bdd597376d Fix gdbr race conditions ##debug
gdbr lock depth wasn't handled in a mutex and there were two point where
a function would exit in a way that breaks the lock count
2019-12-20 13:17:36 +01:00
yossizap
bfa40cd5db Fix gdbr reg sync and concurrency ##debug 2019-12-20 10:17:58 +09:00
Florian Märkl
e408789e34 Fix some Race Conditions with the thready task scheduler (#15667) ##core
* Fix lock ordering of RCoreTaskScheduler.lock vs. RCoreTask.dispatch_lock
* Remove RThreadLock.refs
* Fix a race in tasks
2019-12-18 16:54:37 +01:00
Paul I
9a4578a915 Replace some strstr() calls with strchr() 2019-12-15 23:37:27 +01:00
yossizap
6f546149cf Fixed gdbr warnings and a dpt crash after debug was over ##debug (#15636)
RDebugPid not being initialized with NULL resulted in a free on an invalid
pointer after gdbr_threads_list failed.
2019-12-15 04:45:11 -06:00
Anton Kochkov
e11b2a9145
Some Coverity defect fixes (#15626) 2019-12-13 11:25:19 -06:00
GustavoLCR
e43c9e7caf Fix some warnings (#15549) 2019-12-08 12:49:58 +01:00
yossizap
f12783f4ca Added dp processes info support to gdbr ##debug (#15544)
Most servers/clients should have xml support by now so it should behave
like `dp` in any other debugger. vFile is the only way to get detailed pid info unfortunately.
2019-12-05 13:30:05 +01:00
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