Commit Graph

1854 Commits

Author SHA1 Message Date
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
Itay Cohen
29c1344ff3 Improve realname support for symbols (#15702) ##bin
* Initial implementation of libname for flags in imports
* Initial support for PE and real flag
* Read libname for PE exports
* implement pj for imports
* Remove imp. prefix from symbol names
* Fix r_core_bin_impaddr()
* Fix some mdmp import stuff
* Print libname in ii
* Fix some imp. checks and reloc meta
* Fix r_bin_filter_sym() for imports
* Use realname for noreturn check
* Fix asm.flags.real for direct calls
* Fix realname for direct calls with fcn
* Fix resolving names from ordinal

Co-authored-by: Florian Märkl <info@florianmaerkl.de>
2020-01-12 03:09:12 +01:00
Anton Kochkov
f3a0a3d01c Some coverity fixes 2020-01-10 12:30:23 +01:00
Riccardo Schirone
46e0a8d169
Do not compile radare2-shell-parser by default (#15769)
Last release (4.1.0) did compile it by default, but the build requires
internet access to download the repositories. For now, since the feature
is anyway very experimental, we disable it at compile time so that
distributions can just compile their packages without internet access.
In the future we may want to use submodules or augment the release
tarball to include the tree-sitter and radare2-shell-parser archives.
2020-01-07 13:37:04 +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
radare
38b5791b63
More improvements for the cmd tests using r2r.v (#15728) 2019-12-30 15:33:09 +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
Riccardo Schirone
595cb21ad4 Compile tree-sitter with std=c99 flag (#15654) 2019-12-16 23:21:43 +01:00
Anton Kochkov
d5d5cd3bfa
Some coverity fixes (#15643) 2019-12-16 04:36:46 -06: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
Khairul Azhar Kasmiran
39b40cdedd
ONE_STREAM_HACK & scr.onestream: Force expected ONE_STREAM order if necessary (#15535) 2019-12-02 23:09:38 +08:00
dav1901
a18640529d Fix spp warning (#15530) 2019-12-01 13:08:48 +01:00
GustavoLCR
ebaf8b603e Fix some warnings on Windows (#15532) 2019-11-30 00:49:16 +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
David CARLIER
5e25fc9233 windbg module build warning fix (#15514) 2019-11-28 17:56:45 +01:00
GustavoLCR
78c232b5c5 Impl. list modules for WinDbg ##debug 2019-11-26 12:37:39 +01:00
GustavoLCR
635f27068b Fix WinDbg IO in page boundaries ##debug
Before we didn't check if a virtual address read/write would go through a page boundary. This fixes it.

Also do some formatting and re-enable some useful error messages
2019-11-26 12:37:39 +01:00
GustavoLCR
2ec3bcf044 Fix XP build 2019-11-26 12:37:39 +01:00
yossizap
21cc6e7788 Fixed windbg concurrency and added missing locks ##debug
Previously, windbg_break would freeze waiting on a lock instead of breaking,
taks other than wait weren't breakable and read regs would freeze the
process while waiting for a mutex.
2019-11-25 18:04:16 +01:00
yossizap
a63b7269ce Fixed windbg pipe timeout behavior on linux ##debug
Previously, linux would timeout when trying to connect and would timeout
too frequently since milliseconds were treated as microseconds.
2019-11-25 18:04:16 +01:00
yossizap
9d1421a188 Added rebuild rules for windbg ##debug 2019-11-25 18:04:16 +01:00
yossizap
00f9e84ed1 Fixed windbg continue on windows 7 64bit ##debug
ContinueApi2 only worked on XP 32bit while ContinueApi works on both.
Previously, continue would do a single step.
2019-11-25 18:04:16 +01:00
GustavoLCR
a484d2c6e9 Allow breaking for WinDbg ##debug
* Fix OOB read in windbg_reg_read
* Add locks to prevent collision
* Enable timeouts on the pipe backend
2019-11-25 18:04:16 +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
pancake
f0998c01b7 Update capstone v4/next from Git 2019-11-10 19:05:08 +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
GustavoLCR
af6ba870e8 Add Windows 8 and 8.1 WinDbg profiles ##debug (#15425) 2019-11-06 11:18:14 -06:00
Riccardo Schirone
4ebd400fa7
Very simple tree sitter integration (#15414) ##command
* tree-sitter-integration: support tmp-seek, arged, and interpret commands
* Make meson automatically download tree-sitter and radare2-shell-parser grammar
* Add tree-sitter/radare2-shell-parser directories in gitignore
* Add Support for tree-sitter in acr/makefile
* Just use one script to download 3rd party repositories in shlr
* Use cfg.newshell
2019-11-06 10:33:23 +01:00
pancake
bf6185ea96 FIx 32bit windows ##build 2019-11-05 15:32:52 +01:00
yossizap
05b000bb13 Modified debug_native to handle break's thread switching behavior
The user was interrupted during continue and switched to a different
thread since DebugBreakProcess creates a thread that triggers a breakpoint.
With these changes the DebugBreak thread is recorded to skip the breakpoint
event afterwards.
2019-11-02 00:30:25 +01:00
GustavoLCR
47a440cae5 Implement w32dbg_wrap 2019-10-28 05:56:10 +01:00
yossizap
82b02e8b89 Fixed opcodes not being associated with the current thread in gdbr (#15358) ##debug 2019-10-25 19:41:34 +02:00
Florian Märkl
281dd5b794
Update SDB URLs (#15357) 2019-10-25 15:58:29 +02:00
Florian Märkl
03ef6b4e06 Update SDB for sdb_copy() (#15356) 2019-10-25 15:30:43 +02:00
Florian Märkl
aad2a2c79e Link sdb fully into r_util in meson (#15338) ##build 2019-10-23 15:52:19 +02:00
Florian Märkl
a30c1f62a0 Update SDB after diff update (#15334) 2019-10-23 12:05:34 +02:00
Paweł Łukasik
d62ae602a4 Fix #15152 - Support old Java attribute format (#15317) ##bin 2019-10-20 23:44:15 +02:00
Florian Märkl
80c74d7aa7 Replace r_str_const* with RStrConstPool (#15300)
* Add RStrConstPool

* Replace RAnal.consts with RStrConstPool

* Remove useless r_str_const() calls

* Kill more r_str_const()

* Remove r_str_const() from Java

* Remove r_str_const() from Canvas

* Remove r_str_const() from mach0

* Remove r_str_const() from PE

* Kill r_str_const* completely
2019-10-20 12:31:45 +02:00
dav1901
a88d3303e1 Minor code fixes (#15276) 2019-10-15 02:54:35 +02:00
pancake
37abed265d Update capstone from git 2019-10-08 19:39:26 +02:00
Remco Verhoef
80511aac77 Fix macOS build with latest XCode ##build (#15202) 2019-10-08 10:55:31 +02:00
Maijin
9227815fdb Change radare->radareorg links 2019-10-07 10:48:31 +02:00
pancake
011ebf7e03 Update sdb 2019-09-30 11:51:50 +02:00
Paul I
5094ab44cf Meson: export sdb symbols from r_util on Windows (#15098) 2019-09-23 00:00:21 +02:00
Paul I
374eb3b95c Update shlr/sdb (#15095) 2019-09-22 10:43:23 +02:00
pancake
bb810cfc4c Implement anal.norevisit using SetU instead of Sdb ##anal
* Fixes the infinite loop in aac, but it's just a leaky workaround
2019-09-17 00:46:07 +02:00
pancake
f3618747dd Add m680x arch support for the meson builds 2019-09-16 19:34:06 +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
pancake
631db86543 Fix minor warnings and update sdb from git 2019-09-11 00:18:07 +02:00
karliss
5379c70e89 Fix memory leaks and other problems found by ASAN. (#14980) 2019-09-08 01:24:14 +08:00
GustavoLCR
1eef31a814 Fixes for dmh in Windows
* Get offset of important globals from ntdll's PDB
* Workaround some RtlQueryProcessDebugInformation hangs for Win10
2019-09-05 09:49:41 +02:00
radare
0c386b4121
Introduce anal.in=code (2x faster aar in some big binaries) ##anal (#14923) 2019-08-28 19:39:04 +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
radare
87308db077
Update capstone again (#14862) 2019-08-21 12:40:20 +02:00
Paul I
2556919857 Add clang-cl support (#14814) 2019-08-16 12:10:00 +08:00
GustavoLCR
04121a2ad8 Fix stack-use-after-scope (#14811) 2019-08-15 13:41:41 +08:00
GustavoLCR
87079ea21c Fix #14804 - Make sure anon structs have unique names (#14806)
* Also skip "union" to get type
2019-08-15 12:00:20 +08:00
Maijin
b22ca85d4e Remove sleep 10 (#14791) 2019-08-14 17:26:27 +08:00
radare
8915a0a515
Update capstone (#14780) 2019-08-10 00:07:36 +02:00
Slava
38a10d64fb Fix build with system capstone (--with-syscapstone) (#14753) 2019-08-03 18:00:12 -07:00
pancake
6fdbf5b1c2 Fix static-build without GPL code 2019-08-02 09:51:09 -07:00
radare
c93c094c40
Fix android-static ##build 2019-08-01 04:39:40 +02:00
Anton Kochkov
5b9215bff5
Fix #13633 - support nested unions (#14712) 2019-07-31 18:40:40 +08:00
GustavoLCR
6664b2ba39 More fixes to WinDbg (#14675) ##debug ##windbg
* Fix seeking (stepping now works)
* Fix more crashes
* Fix compiler warnings
2019-07-28 11:48:46 +08:00
Ayman Khamouma
848c94d577 Fix capstone symbols visibility 2019-07-28 01:32:52 +02:00
GustavoLCR
8a6a7ba852 Some fixes to windbg (#14666) #debug #windbg
* Fix #10505
 * Fix wrong register profile being picked
 * Fix use-after free(s) and null derefs
2019-07-27 14:29:02 +08:00
Florian Märkl
24d3a9cb5d Add r_parse_ctype ##parse (#14596)
* Add r_parse_ctype

* Add mpc to acr

* Readability

* Fix r_parse for acr
2019-07-20 12:50:27 +02:00
pancake
b32a09db05 Update capstone v4 and next 2019-07-18 04:06:01 +02:00
GustavoLCR
ec67532e5d Fix Windows Build (#14512) 2019-07-08 12:40:48 +08:00
radare
dc0892a1a0
Towards emscripten build fix (update sdb) ##build 2019-07-07 16:52:41 +02:00
lzutao
7b7f069c9e mesonbuild: Backport to python 3.5 ##build
Python 3.5 (the lowest version that meson supports) has no f-String
but only old %-formatting and str.format().
2019-06-26 12:11:06 +02:00
pancake
d2c3065b9a Upgrade spp from git 2019-06-21 20:47:05 +02:00
pancake
6b634e2889 Upgrade capstone-next 2019-06-21 10:49:37 +02:00
pancake
30cee7811e Rename r_bin_file_set_cur_binfile_obj to r_bin_file_set_obj 2019-06-16 23:35:12 +02:00
Paul I
0fa82921b7 Split types-windows.sdb.txt and add cc info 2019-06-09 16:00:04 +02:00
pancake
0b7ad22f8c Upgrade capstone from git 2019-06-07 14:34:17 +02:00
GustavoLCR
7a10af4057 Initial implementation of heap parsing for Windows (#14218) ##debug 2019-06-05 15:20:38 -04:00
radare
581609fad2
Update capstone from Git (#14175) 2019-05-28 15:53:30 +02:00
pancake
5d3706bc3c Update capstone5 from git 2019-05-20 18:34:11 +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
Sergi Àlvarez i Capilla
6b5905d4f4 Upgrade cs5 to fix the arm64 disasm crash 2019-05-15 15:56:00 +02:00
Riccardo Schirone
66f7403245 Rewrite the RBuffer API to make it safer and adjust the codebase ##refactor (#13656)
* Reimplement r_buf_fread/fwrite
* Add slice buffer and introduce readonly field
* Do nothing if size is 0
* Prevents an overflow when 8 is subtracted from size.
* Fix ragg2 when patching outside currently existing buffer
* Implement r_mem_mmap_resize for systems where mremap is not defined
* r_buf_buffer can be called with no size arg as well
* Use size_t instead of ut64
2019-05-15 15:34:06 +02:00
Óscar Carrasco
31e7cf517a Fix includes from to ignoring dir.types ##types 2019-05-15 08:46:43 +02:00
radare
8ea835076a
Upgrade capstone-next and v4 (#14074) 2019-05-15 08:45:21 +02:00