1477 Commits

Author SHA1 Message Date
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
GustavoLCR
78c232b5c5 Impl. list modules for WinDbg ##debug 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
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
a19f212586 Update hardcoded gdbr registers for 16/32bit x86 (#15488) ##debug
There are still platforms that don't support the target xml format.
2019-11-21 10:28:35 +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
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
Khairul Azhar Kasmiran
9167a5e740 r_list_newf(..) -> r_list_newf (..) 2019-11-09 18:52:29 +08:00
Armin Weihbold
82047cc580 Add experimental ymm regs support for linux-x64 and extend drm command ##debug 2019-11-07 17:23:18 +01:00
GustavoLCR
88c848cc37 Fixes for Windows debugging (#15418)
* Fix error when continuing after attaching to process
* Get threads correct EIP
* Fix some memory corruptions and small refactor
2019-11-06 00:01:36 -06:00
GustavoLCR
36114b35f3 Fix attaching to a pid on Windows (#15406) ##debug 2019-11-04 11:05:55 +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
yossizap
12391ae483 Modified r_debug_native_wait to avoid switching between threads for each event
The debugger should return to the requested thread after handling events
in other threads except for breakpoints.
2019-11-02 00:30:25 +01:00
Johannes
5d76b9ff99 fix linux x86 build (#15395) 2019-11-01 02:54:48 +01:00
yossizap
45782c7705 Fixed w32dbg breaking issues (#15386) ##debug
* Fixed w32dbg breaking issues and moved break_push to w32_dbg_wait to support stepping as well

Previously, breaking would only work during 'dc' because it was pushed
in debug.c specifically for continue. This change moves the
responsibility of pushing/popping w32_break_process_wrapper to
windows_debug.c instead to support calls to w32_dbg_wait from anywhere.
2019-10-30 18:58:34 +01:00
radare
f639c3b6a1
Fix build for 32bit Linux systems ##build (#15384) 2019-10-30 13:04:25 +01:00
GustavoLCR
293b244caa Fix hang when running dc in a task ##windows (#15380) 2019-10-29 11:31:03 +01:00
yossizap
29e2ffe476 Fix issues in windows thread switching (#15366)
* Fixed issues in windows thread switching by implementing thread attach for w32dbg =!pid

Previously the function attempted to OpenProcess even though the main
pid is already opened by __open and the fact that re-opening the main
pid wouldn't do anything. This way it attaches to new threads when
called by r_debug_select.

* Modified w32_continue to update rio->pi.dwThreadId after switching to the requested thread

Manually changing iop->pi.dwThreadId in io_w32dbg's =!pid created a
problematic scenario when w32_continue is called with the last event's
tid from dbg_wait. This solution makes sure iop->pi.dwThreadId keeps
being updated after events on other threads arrive and that w32_continue
actually uses the given tid.

* Modified w32_continue return values
2019-10-28 11:06:57 +01:00
GustavoLCR
47a440cae5 Implement w32dbg_wrap 2019-10-28 05:56:10 +01:00
GustavoLCR
317c0ee811 Fix reading registers after thread exited 2019-10-28 05:56:10 +01:00
Armin Weihbold
b9874fb102 Add support for setting xmm registers on linux (#15365) ##debug 2019-10-27 17:38:36 +01:00
yossizap
b133761f3b Fixed continue not being associated with the current thread in unix ##debug 2019-10-26 11:02:23 +02:00
yossizap
74c54e24bb Added a way to break while in dbg_wait (continue, step etc) ##debug 2019-10-26 11:02:23 +02:00
yossizap
797803473b Fixed dpk ##debug 2019-10-26 11:02:23 +02:00
yossizap
82b02e8b89 Fixed opcodes not being associated with the current thread in gdbr (#15358) ##debug 2019-10-25 19:41:34 +02:00
Armin Weihbold
5742c3498c Fix xmm register offsets (#15360) 2019-10-25 19:41:18 +02:00