Commit graph

1504 commits

Author SHA1 Message Date
Khairulmizam Samsudin
17026c8c62
Fix show register value in column (#16010) ##debug
* Fix for ar= and dr= and add tests
* increase width to accomodate register name larger than 4 chr
* fix flag type register value not printed
* update r_debug_reg_list() to accept '=' arg
2020-02-20 16:26:29 +01:00
Florian Märkl
14215350af Refactor RAnal Basic Blocks and Functions (#15169) ##anal
Basic Blocks are now global instead of owned by a single function.
2020-01-15 15:23:34 +01:00
Anton Kochkov
f3a0a3d01c Some coverity fixes 2020-01-10 12:30:23 +01:00
pancake
0e34303648 Third fix attepmt for musl builds 2020-01-10 03:50:30 +01:00
pancake
5a48a40178 Second fix attempt for Alpine/musl builds 2020-01-10 03:32:13 +01:00
pancake
52d9baf988 Aim to fix the alpine build 2020-01-10 03:06:46 +01:00
yossizap
2e5f4b41b4 Fix multithreaded breakpoint behavior in linux ##debug
The plugin wouldn't properly trace breakpoint hits on different threads
since they weren't switched to and the events weren't always handled.
Also, since the breakpoints are removed after they are found in one of the
threads, it's best to stop all threads for now even if dbg.threads is false.
2020-01-10 00:30:18 +01:00
yossizap
ed1f42085c Attach to new linux threads on creation ##debug
New threads were only added after being attached to manually or if
dbg->trace_clone was true. dbg->trace_clone stops debug and switches the
new thread now.
2020-01-10 00:30:18 +01:00
radare
c3651a43ec
Fix debugger build on linux-s390x ##debug
* Add s390x reg profile
* Add missing pc register
* Use gregset instead of regset
2020-01-09 15:21:41 +01:00
yossizap
0de7c21bcc Always unset bps after continue and step hard ##debug (#15772)
Breakpoints were left in disassembly after a signal/break and there
are probably other cases that may lead to it.
2020-01-09 12:00:24 +01:00
Anton Kochkov
0c46c3e1e3 Some coverity fixes 2020-01-08 14:16:11 +01:00
yossizap
3b804c5bc5 Add detailed location info to dpt using pc instead of path ##debug 2020-01-07 21:50:17 +01:00
pancake
836ea638b7 Revert "Validate bp addr on rebase and restore instead of preventing creation ##debug (#15750)"
This reverts commit e503bdd9c2.
2020-01-03 01:35:05 +01:00
yossizap
e503bdd9c2 Validate bp addr on rebase and restore instead of preventing creation ##debug (#15750)
This way it is possible to set breakpoints before starting debug through
'db' and the user will be notified when a breakpoint points to an
invalid map.
2020-01-03 00:57:18 +01:00
yossizap
3f7dd9a47f Fix hardware bp restoring and fix hwbp repeating errors ##debug (#15749)
Instead of unsetting breakpoints they were set again without  removing
the previous drx values, which also caused the "Invalid DRX length (0)
must be 1, 2, 4, 8 bytes" error because of the wrong len values.
Also, when resetting twice, del failed since there weren't any hw
registers to delete, which caused the "hw breakpoints not yet
2020-01-03 00:56:54 +01:00
yossizap
230d2364f4 Add location in file to linux dpt output ##debug (#15744)
Shows the module, offset and function name instead of showing the executable's
path for all threads
2020-01-03 00:56:15 +01:00
yossizap
9a6bcce392 Fix windows dp showing the parent's path for all processes (#15741) 2020-01-01 20:39:45 -06:00
GustavoLCR
21781aa0d1 Fix #15734 - Automatically download PDB file if pdb.autoload=1 (#15738)
* Automatically download PDB file if pdb.autoload=1
* Don't re-download pdb if it already exists on the symstore
* Only download if file doesn't exist
2020-01-01 20:37:28 -06:00
David CARLIER
bac525d8e9 Refactoring ptrace register write for BSD ##debug (#15725) 2019-12-29 14:27:34 +01:00
David CARLIER
86768ccfdd Implement bsd_thread_list for FreeBSD ##debug (#15695) 2019-12-29 08:02:25 +01:00
David Carlier
7ee39fb157 Few warning build fixes proposal. 2019-12-27 06:13:53 -06:00
yossizap
59ce43d52c Fix reopening of windows debug after detaching not working ##debug
attach_new_process was called instead of regular attach because the
saved pid and tid in core->dbg weren't reset before calling r_debug_select
in a new session. Made sure this won't be a problem when using dp= after
dp- either.
2019-12-27 02:46:59 -06:00
yossizap
f0027aa263 Fix windows breakpoint rebasing ##debug
Calculate the diff ourselves since bp->delta is calculated with the
dbg->bp->baddr at the time of breakpoint creation, which may not
reflect the correct baddr and break the rebase.
2019-12-27 02:46:59 -06:00
David Carlier
28ec4ca297 Debug, BSD systems refactoring ##r_debug
Separate pure BSD calls into its separate compilation unit.
2019-12-20 21:11:30 -06:00
yossizap
bfa40cd5db Fix gdbr reg sync and concurrency ##debug 2019-12-20 10:17:58 +09:00
GustavoLCR
0e19329de7 Fix rebasing for remote GDB on windows 2019-12-19 17:42:22 -06:00
yossizap
6cfdafdf51 Refactor debug native's wait function ##debug
Separate windows, linux and *bsd/apple since they have vastly different
logic and the ifdef jungle implementation was too confusing
2019-12-17 11:04:19 -06:00
David CARLIER
8caa059c9b Refactor signal handling for FreeBSD ##r_debug (#15659)
Solving r_debug_handle_signals build warning issue.
2019-12-17 15:08:50 +01:00
Anton Kochkov
4e8e330475 Fix some MSVC warnings 2019-12-16 12:26:05 -06:00
yossizap
f1de1becfa Add ppid to dp and fix dp= for windows (#15649)
* Add ppid to win32 debug and 'dp''s display/json ##debug
* Add process selection to w32 debug ##debug

Previously, `dp=` wouldn't fully switch to the given process since it
was treated like `dpt` thread switching, leaving the debugger in
an undefined state.
2019-12-16 09:24:17 -06:00
yossizap
89a5320e5f Fixed a crash caused by reopening gdb ##debug
The plugin would try to work with an old version of desc that was already
freed by r_io_close_all after closing the session. I set debug_gdb's
global 'desc' to NULL in detach as a temporary solution. We should convert
to **desc to keep an updated copy of the pointer.
2019-12-16 01:23:27 +01:00
GustavoLCR
7e4157bc2b Fix format string in windows_message.c 2019-12-15 23:37:54 +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
yossizap
28cac248a6 Added an event to signal the end of the debug session ##debug 2019-12-15 10:46:48 +01:00
Anton Kochkov
e11b2a9145
Some Coverity defect fixes (#15626) 2019-12-13 11:25:19 -06:00
yossizap
9fca7b1f58 Fixed an issue with detached child breakpoint inheretence ##debug (#15561)
Previously, forked children would instantly die if the fork was stepped
over using a breakpoint which is accessible to the child process.
2019-12-09 09:52:53 +01:00
GustavoLCR
e43c9e7caf Fix some warnings (#15549) 2019-12-08 12:49:58 +01:00
fcasal
c2f01218f2 Rebase Breakpoints for PIEs ##debug (#12801) 2019-12-06 10:52:26 +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
yossizap
21ec674969 Allow debug plugins to modify pid/tid on select ##debug
Previously, when using `dp=`, the debug plugin would set a new tid based
on the requested pid, but r_debug_select would set the old tid as dbg->tid,
resulting in issues interacting with the current thread. This could also
be an issue when the requested pid/tid is invalid and the plugin selects
something else.
2019-12-04 10:55:29 +01:00
yossizap
129158101f Fix linux_set_options error ##debug
Previously, setting options would fail sometimes since PT_ATTACH's attach
SIGSTOP wasn't hit before reaching linux_set_options.
2019-12-04 10:55:29 +01:00
yossizap
7823430724 Add process selection to linux native debug ##debug
Previously, `dp=` wouldn't fully switch to the given process since it was
treated like `dpt` thread switching, leaving the debugger in an undefined state.
2019-12-04 10:55:29 +01:00
David CARLIER
3ac93f1e16 Setting parent pid on pid list on BSD ##debug 2019-12-01 13:08:32 +01:00
yossizap
164e2cca23 Show all processes for pid 0 using dp ##debug 2019-12-01 11:44:15 +01:00
yossizap
8c02f7ccd3 Add current process field to dpj ##json 2019-11-30 00:50:18 +01:00
yossizap
a99c8026bd Improve linux native debug dp output ##debug
Previously, the command didn't show the pid's path, replaced the path
field with current/ppid, and showed the ppid instead of only showing the
requested process and the children of the requested process.
2019-11-30 00:50:18 +01:00
GustavoLCR
e1648b8196 Fix getting DRX breakpoint size ##debug (#15531) 2019-11-30 00:49:30 +01:00
GustavoLCR
ebaf8b603e Fix some warnings on Windows (#15532) 2019-11-30 00:49:16 +01:00
GustavoLCR
4378645f31 Add command to identify window under cursor ##windows (#15518) 2019-11-28 18:40:17 +01:00