Commit Graph

1442 Commits

Author SHA1 Message Date
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
Armin Weihbold
fbd68eb1ce Fix drm[bwdq] command, add xmm0h/l and xmm8-15 registers (#15354) ##debug 2019-10-25 17:12:34 +02:00
Riccardo Schirone
7cd93eef9b Fix the way linux debugging options are set (#15323) ##debug
In linux_attach_single_pid there is a check to avoid calling PT_ATTACH
multiple times on an already traced pid, which is an operation that
should be done only one time. The old code supposedly tried to set the
options only the first time you attach to a process, however when
debugging a process through the io_ptrace plugin, the process uses
TRACEME and the code never set the options of ptrace to intercept the
process before dying, amongst other things.

This patch addresses this issue by just always setting ptrace options.
Those options could be changed by the user during the life of the debug
session, so it's not an operation that should be done only one time.
2019-10-24 01:47:37 +02:00
Florian Märkl
aad2a2c79e Link sdb fully into r_util in meson (#15338) ##build 2019-10-23 15:52:19 +02:00
David CARLIER
406e34d7f4 Checking pid if attached on FreeBSD implementation #io_ptrace (#15311) 2019-10-20 12:21:06 +02:00
Fritz Reese
852164211f Fix #15304 - Fix radare2 build for kernels without THP support (#15305) 2019-10-19 01:49:01 +02:00
yossizap
d9fa409563 Added support to thread switching in linux and fix r_debug_select ##debug 2019-10-17 19:21:58 +02:00
yossizap
f6bda32cb9 Fixed ptrace 'Operation not permitted' errors (#15287) ##debug 2019-10-16 13:08:38 +02:00
pancake
3be447f2c5 Fix debugger build for native GNU/Linux on RISC-V ##debug 2019-10-16 09:29:37 +00:00
dav1901
9de5481098 Fix few memory leaks and null dereferences (#15271) 2019-10-14 12:47:40 +02:00
yossizap
3b8b754cdf Add current thread field to dptj (#15268) ##json 2019-10-13 22:48:36 +02:00
yossizap
a9478c0bb0 Added "dptj" and "dptj " (#15259) ##debug 2019-10-12 23:14:24 +02:00
Armin Weihbold
9b9103e00a Enhance drm command, add drm xmm0 functionality (#15214) ##debug
* Add shorthand versions of `drm` - `drm[bwdq]`
* Add mmx register to linux-x64
2019-10-10 04:40:08 +02:00
Armin Weihbold
db1b79b125 Fix #13118 - drf st0 - fpu regs (#15241) 2019-10-10 04:37:37 +02:00
Armin Weihbold
a4954a221e Fix drf output formatting ##debug 2019-10-09 10:18:30 +02:00
David CARLIER
d4b9746c28 Implementing debug info per pid on NetBSD ##debug (#15149)
While at it fixing little code mistake about freeing const address.
2019-09-30 11:21:09 +02:00
David CARLIER
bc8b9d73e6 Using unused map debug field on macOS ##debug (#15148)
Storing max protection data for this purpose.
2019-09-30 11:19:01 +02:00
dodococo
9d7a72f9c6 Integrate table API for p-h (#15083) ##table
* Added UTF8 and Curvy Support For Table API
* Added show footer with sum support
* Integrate star= command with table API
2019-09-24 10:46:06 +02:00
Paul I
78f2b12d0b Fix potential memleaks (#15057) 2019-09-17 02:14:32 +02:00
Paul I
4eabb42f88 Fix potential bugs 2019-09-16 09:37:43 +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
Lev Aronsky
07be18193e Added ba2 so that the gdbserver backend connects correctly (#15003) 2019-09-10 11:42:10 +02:00
David CARLIER
fb0d361da2 Improving slighty the process status check on Darwin ##debug (#14997) 2019-09-09 21:43:19 +02:00
GustavoLCR
5bb2417119 Fixes for Windows (#14985)
* Fix dbW help message

* Fix memleak on r_w32_print_windows

* Imitate unix gotoxy behavior on Windows
2019-09-08 02:53:25 +08:00
David CARLIER
1e3a4445b4 On Darwin, expose process path ##debug (#14975)
For platforms supporting the libproc api.
2019-09-07 22:25:59 +08:00
GustavoLCR
c2287003f9 Implement Windows message breakpoints 2019-09-07 11:25:01 +02:00
GustavoLCR
88989b95a8 Fix PDB autoload
* Let PDBs be found on the symstore
* Fix flags being set on the wrong offsets
* Fix memory leaks
2019-09-05 09:49:41 +02:00
GustavoLCR
a565a5ccce Fix #12438 - Fixes for PDB (#14874)
* Fix use after free when autoloading pdb
* Use heap on td command
* Fix #12438 - Fix wrong 2 byte read for char value
2019-08-23 12:52:25 +08:00
00rsiere
fe9a03416f Notify user on hardware breakpoint hit ##debug 2019-08-19 19:29:43 +02:00
radare
e1cf65332a
Use r_sandbox_fopen instead of fopen (#14832) 2019-08-18 17:19:53 +02:00
GustavoLCR
50392fd525 Fix register writing on Windows (#14805)
* Fix register writing on Windows
* Drop unecessary use of heap
2019-08-15 13:42:32 +08:00
David CARLIER
0626013ac7 Linux debug plugin, page promotion feature ##debug
* Linux debug plugin, page promotion feature proposal.

Providing new 'dmL' debugger sub command.
This is the only system having THP feature, others are more into
 direct huge tlb equivalent ...
The system ought to be set in madvise mode and disabled on Android,
would not do any good in this environment if this is ever supported.
Once the syscall succeed, the address range ought to get the
 little 'hg' VmFlags.

* interface changes
2019-08-03 06:09:07 -07:00
David CARLIER
4ea918ec92 XNU debug, tag the processes map from dm's command. ##debug
This is just to highlight them via command like vmmap.
2019-08-02 17:11:28 +02:00
sanguinawer
4cbf27a11a Fix win32 compilation (#14722) 2019-07-31 21:57:50 +02:00
GustavoLCR
d5e3926b5d Only suspend threads if dbg.threads=true on Windows (#14689) 2019-07-30 01:49:47 +02:00
Anton Kochkov
9677804b8e
Windows native debugger refactoring ##debug ##windows
* Windows native debugger refactoring

Massive win32 native debugging code refactoring
and corresponding fixes.

* Fix hang after killing process
2019-07-29 11:19:26 +08:00