Commit graph

102 commits

Author SHA1 Message Date
davidpolverari
1fb422b532 Fix #6162 - Renames r_str_concat to r_str_append 2017-03-16 22:29:49 +01:00
pancake
f82930fd75 Fix latest covs 2017-03-15 12:12:55 +01:00
pancake
6eff81c201 Those ones too 2017-03-13 03:53:27 +01:00
pancake
91016693cb Avoid 100% cpu usage in Linux debugger 2017-03-08 12:31:43 +01:00
Giovanni
43532031c4 Fixes for windows and some are also global (#6936) 2017-03-08 08:49:31 +01:00
SchumBlubBlub
223dbb6538 Make reg order consistent across x86-* (#6685) 2017-02-06 00:05:47 +01:00
SchumBlubBlub
c8a403ad7c Move o[er]ax to last pos of gpr regs (#6674) 2017-02-03 23:34:10 +01:00
leberus
c5149f97b7 Fix: Fixed regression pointed by #6650 (#6672) 2017-02-03 18:20:07 +01:00
leberus
4fd1e990d9 Add: coredump refactoring + RDebugMap offset field (#6633) 2017-02-01 22:17:59 +01:00
leberus
30743e9b20 Fix: #6616 crash in crash core generation 2017-01-31 22:14:21 +01:00
leberus
82f282c629 Add: dbg.libs/unlibs for linux (#6567) 2017-01-24 20:22:36 +01:00
pancake
41602c4212 Fix android build 2017-01-18 13:46:39 +01:00
leberus
286ca4d0ed Add: support for dbg.follow.child option (#6525) 2017-01-18 00:40:30 +01:00
leberus
f4b8fbbc77 Fix: remove linux specific and add braces 2017-01-16 12:22:24 +01:00
pancake
2a83f21a3e Make gcc6 warnings happy 2017-01-15 22:02:57 +01:00
leberus
dc5be7a767 Improving debug on linux (#6435) 2017-01-11 17:39:09 +01:00
leberus
8b0afcbc39 Fix: #4856 #4857 (#6365) 2016-12-28 16:02:05 +01:00
pancake
50d73d1547 Fix a lot of memleaks, null derefs and undef behaviour thanks to clang-analyzer 2016-12-19 16:44:51 +01:00
Eugene
4530585132 Refactoring fixes in debug/linux (#6339) 2016-12-18 12:20:31 +01:00
pancake
6296f4b794 Add option to stop syscall tracing -before- the syscall is executed 2016-12-09 22:19:47 +01:00
leberus
e82a638006 Fix: #6278 (#6280) 2016-12-03 19:00:29 +01:00
user.name
2e5e67ee08 Fix: regression in commit f0f54ad1c6 2016-12-02 18:20:19 +01:00
pancake
7a68fd2d82 Attempt to fix the register profile reloading issue 2016-11-14 15:59:50 +01:00
SkUaTeR
4c2a01d4a7 Fix in profile to get correct reg.size (#6238) 2016-11-21 23:13:59 +01:00
Rakholiya Jenish
276f3ce1d2 Fix compilation error on arm64 (#6224) 2016-11-20 11:33:07 +01:00
pancake
19295f880e Add missing SN in linux-arm64 debugger reg profile 2016-11-10 02:57:34 +01:00
pancake
ab28917568 Honor --without-debugger for linux-coredump 2016-11-06 22:04:45 +01:00
pancake
eb272dc6f3 Honor SN in syscall resolution on disasm 2016-10-28 02:27:50 +02:00
pancake
be9df39f6f Fixed 40 null derefs reported by coverity 2016-10-20 15:02:25 +02:00
pancake
7a1b6871d9 Fix a bunch of outstanding coverities 2016-10-20 14:11:02 +02:00
Álvaro Felipe Melchor
f0f54ad1c6 move check of num_threads into get_proc_process_content 2016-10-03 00:13:35 +02:00
Álvaro Felipe Melchor
218474ec13 Remove unused variable and coding style file.c 2016-10-02 02:05:23 +02:00
Álvaro Felipe Melchor
b0ee337c0f Fix regression in coredump 2016-10-01 11:03:05 +02:00
Álvaro Felipe Melchor
6f2b0e5b64 more coverities 2016-09-29 12:56:13 +02:00
alvaro_fe
9763de3b0b coding styles changes 2016-09-26 17:00:03 +02:00
zonkzonk
7fe4084b32 update linux_coredump.c check nullptr for elf_proc_note->n_threads
.
2016-09-26 17:00:01 +02:00
pancake
490d2a498a Fix #2571 - dcs is working again 2016-09-26 13:40:25 +02:00
pancake
a86ae89f1d Fix syntax error from termux 2016-09-19 12:39:00 +02:00
dromero
20ed81af73 Fixing debugging problems at MIPS (32bits) (#5800) 2016-09-19 02:10:43 +02:00
leberus
03b2079c15 Fix: fix segfault for really long mapped files processes (#5714) 2016-09-09 14:30:41 +02:00
leberus
74e6fda450 Coredump support for ARM and fix-ups (#5549)
* Fixes: 5540 (now i386 will not complain in case they're missing GETREGSET)
 * Fixup: Owner set to Linux for NT_PRXFPREG
 * Fixup: Now extra section hdr is being written with the right offset
 * Fixup: Bug with multithread cfg fixed
 * Add: Now r2 is able to generate coredumps on ARM platforms
2016-08-18 10:43:08 +02:00
Eugene
b0970d563e fixes #5418 (#5421) 2016-07-30 18:56:24 +02:00
leberus
8890d0650e Fix: segfault and #ifdef vs #if 2016-07-06 23:39:12 +02:00
Eugene
3773a1d088 Added vars init in linux corefile gen (#5281) 2016-07-04 13:59:00 +02:00
pancake
df7c33f297 Fix build for Linux <= 2.6.32 (coredump not supported) 2016-07-04 01:45:44 +02:00
Joshua J. Drake
09435c7317 Don't print SIGTRAP signals or stops
A TRAP signal signifes expected stops for breakpoints and so on. There's no
need to display these as signals or stops since they will be communicated
inside r_debug_bp_hit.
2016-07-01 21:32:02 -05:00
pancake
b53a99aca2 Mark some x86-specific code only for x86 2016-06-26 03:56:08 +02:00
pancake
dcc02e87c5 More if DEBUGGER for linux 2016-06-25 18:48:26 +02:00
pancake
feff5b59e4 Do not use %p for ut64 values 2016-06-22 19:20:59 +02:00
Joshua J. Drake
722c62827b Major rework to the native debugger (esp on Linux) (#5185)
The major contribution here is completely re-worked breakpoint hit/recoil
handling. This work fixes #4907 and lays the ground work for future native
debugger improvements (multi-threading, etc).

* Give a human friendly type to enums
* Change many wait functions to return RDebugReasonType
* Better return checking (from r_debug_reg_sync, r_bp_restore)
* Optimized register synchronization
* Lots of comments and whitespace changes
* Improved inferior death detection

Handle EXIT_PID events differently than DEAD process events

* Move breakpoint/recoil handling to wait/cont/step

Rather than handing breakpoint related things inside cmd_debug.c, do that
inside the r_debug API functions. This seems like the most logical place for it
to live since it should apply to just about any platform/architecture.  This
also centralizes calling into "cmd.bp" handling via the CoreBind callback.

* Track how the caller wishes to continue

It turns out that handling break point recoils is very complicated. The ptrace
API on Linux returns SIGTRAP for just about every type of operation (not just
breakpoints getting hit). Add the "recoil_mode" flag to indicate whether we are
single-stepping or continuing and whether or not we are inside the recoil.

* Proper handling for swstep=true

Since r_debug_step_soft calls r_debug_continue, it's already hitting the recoil
case there. Move the recoil handling from r_debug_step to r_debug_step_hard
only.

For the swstep=true case, special handling is required inside r_debug_recoil.
By resetting all of the breakpoints except the one we just hit, we ensure we
can step the original instruction and hit the new swstep breakpoint. Add a new
bp function called r_bp_restore_except to do this.

To make matters worse, we cannot use a BreakpointItem pointer because that
leads to a use-after-free condition. Instead, we the breakpoint address
instead.

Now breakpoints should work regardless of the swtep setting.

* Always call the recoil before continuing

Some callers of r_debug_continue might not have ever inserted any breakpoints
before. If we don't restore breakpoints before each call to the underlying
continue we won't hit them.

* Hide software step breakpoint events from the user

When a breakpoint even happens due to a software-step, hide it from the user.
They aren't really breakpoints as far as they are concerned.

* Improve process exit handling on Linux

There are three types of process exiting events on Linux:

1. PTRACE_EVENT_EXIT occurs just before a process exits. It's not possible to
prevent it from exiting, but it can be used to inspect the pre-exit state.
2. The process can exit for a variety of reasons and we can notice when we call
waitpid(2).
3. The process could die randomly on us :-/

On Windows, h->wait will return R_DEBUG_REASON_EXIT_PID, but it's more likely
on Linux to find out the process is already dead.

* Check more bits within waitpid status

We can often make a decision about what happened strictly by looking at the
status returned from waitpid. In other cases, we need to call
r_debug_handle_signals.

If we reach the end of this function without knowing what happened, consider it
an error.
2016-06-22 10:34:45 +02:00