Commit graph

455 commits

Author SHA1 Message Date
Florian Märkl
0eb98d24be
Fix all Warnings for GCC 9 (#16223) 2020-03-17 13:31:28 +01:00
radare
6ae8806411
Do not use the elvis operator for bool expressions (#16073) 2020-02-28 15:19:37 +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
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
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
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
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
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
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
Khairul Kasmiran
84ce2a7d04 r_list_new() -> r_list_new () 2019-11-10 14:06:02 +08: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
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
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
797803473b Fixed dpk ##debug 2019-10-26 11:02:23 +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
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
Paul I
4eabb42f88 Fix potential bugs 2019-09-16 09:37:43 +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
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
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
Alexander Yukhanov
0eeb2bfd7f Fix breakpoints handling for FreeBSD ##debug 2019-07-18 10:24:45 +02:00
Anton Kochkov
20e19d6023 More spelling fixes in the code 2019-06-20 13:36:02 +08:00
radare
571a080ca7
s/CORELIB/R2_PLUGIN_INCORE/g (#14295) 2019-06-13 19:12:51 +02:00
GustavoLCR
7a10af4057 Initial implementation of heap parsing for Windows (#14218) ##debug 2019-06-05 15:20:38 -04: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
Riccardo Schirone
820e3dbe73
Improve r_buf_buffer and remove r_buf_get_at (#13676)
* Make r_buf_buffer return a ut8 and the associated size of the buffer
* Remove r_buf_get_at uses and make it static
2019-04-15 13:24:15 +02:00
Riccardo Schirone
3f4580b031
Make buf field private in RBuffer (#13473)
* Fix pemixed build (and include it in meson build)
* Do not use base_priv in yank, it was wrongly used.
2019-03-26 20:32:53 +01:00
Riccardo Schirone
0948f9536b
Use r_buf_size to get the size of a buffer, not the private field (#13380)
* Use r_buf_size to get the size of a buffer, not the private field
* Use r_buf_seek instead of adjusting the private cur RBuffer field
* use r_buf_read instead of r_buf_read_at(.., cur, ..)
* Fix RBuffer usage in REgg
* Introduce r_buf_tell API instead of using seek
* write_at(cur) == write
2019-03-15 20:28:52 +01:00
Anton Kochkov
bb67b54f74
Remove CYGWIN & MINGW remnants (#13377) 2019-03-15 12:55:08 +08:00
pancake
9930fd82d1 Fix Linux debugger crash regression 2019-01-14 00:18:09 +01:00
radare
2a00ff2ce1
Fix #12855 - Crash in "r2 -c'dL bf' -d ls" (#13145) 2019-02-18 18:45:42 +01:00
radare
18931ff3fb
Fix debugger regression in Android ##debugger 2019-01-24 05:22:56 +08:00
pancake
709ffb60b6 Fixes for the android build and related warnings 2019-01-21 12:10:33 +01:00
David CARLIER
06e2747659 Debug process state info support on OpenBSD ##debugger 2019-01-12 23:35:30 +01:00
David CARLIER
e325b3c6de FreeBSD debug slight improvements. (#12609)
Getting couple of process info, to get the full path name
it would require a bit more calls while not sure it worths it
but we get at least the exe name and figuring out its status.
2019-01-03 00:38:13 +01:00
David CARLIER
cae13a0e14 Improving slighty debug support on FreeBSD. (#12572)
When a process is interrupted by a signal, we try to
figure out the reason if the information is still available.
2018-12-27 23:18:55 +01:00