11657 Commits

Author SHA1 Message Date
pancake
feff5b59e4 Do not use %p for ut64 values 2016-06-22 19:20:59 +02:00
Sven Steinbauer
995c952c5d Fix #5097 : mov instruction with rex regs
sil, dil, spl, and bpl, registers now supported
2016-06-22 13:04:23 +02:00
Sven Steinbauer
db76ef6497 Add bt instruction [fix #1277] (#5194) 2016-06-22 12:31:08 +02:00
pancake
aaf3ff314c Fix #5138 - crash in swift demangler 2016-06-22 11:08:51 +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
Sylvain Pelissier
50aed82b66 Add lfence, mfence and sfence to x86.nz (#5193) 2016-06-22 10:29:26 +02:00
pancake
bc02cdb4b1 Fix regression in afl/afi 2016-06-22 10:29:16 +02:00
pancake
b553c1346d Update to the latest /m (1.7 -> 1.1MB) 2016-06-22 04:30:19 +02:00
pancake
f9482bcae7 Add console.html 2016-06-22 03:19:10 +02:00
pancake
bb00b4e91d Fix Android build, update Capstone and use Android's Studio NDK if available 2016-06-22 02:27:32 +02:00
Álvaro Felipe Melchor
8b957f8512 fix two uaf in anal.c 2016-06-21 23:32:40 +02:00
Álvaro Felipe Melchor
db28a0b20d fix hang in version info ELF 2016-06-21 16:42:34 +02:00
pancake
ab5f7bb9ee Update depgraph.pl 2016-06-21 13:16:00 +02:00
Álvaro Felipe Melchor
c5b6c78637 fix oob in dex 2016-06-21 12:44:43 +02:00
pancake
136d1d722d Fix #5184 - Remove useless warning message in r_debug_set_arch 2016-06-20 23:42:56 +02:00
danielps
1b21628964 V810: Fix floating-point instructions (#5186) 2016-06-20 23:39:01 +02:00
pancake
f7c2cdfdce Remove r_db from the pkg-config templates and update capstone 2016-06-20 23:16:13 +02:00
pancake
55e0804d1d Fix some null-terminated strings issues in the procfs parsing 2016-06-20 18:22:25 +02:00
Maijin
b3236816d9 Fix #5169 Update syscall table for iOS-32 2016-06-20 17:28:36 +02:00
Maijin
bc4ae90206 Fix #5169 Update syscall table for iOS 2016-06-20 17:27:32 +02:00
Joshua J. Drake
b03c1e2b3e Improve dkp and drp
Distinguish between "dXX" and "dXXYY" or "dXX?". Treat the latter two the same.
This provides the least surprise to the user when they mistype something.

Improve default handling in arp/drp

* Adds a new command "drp." for showing the register profile size.
* Provides better help for drpXXX commands.
* Provides help in the default case (eg. drpz)
* Fixes indentation
* Provides correct help strings for arp vs. drp

Improve default handling for "dko"

* Rework "dko" handling to simplify
* Use r_core_cmd_help
* Show help when things like "dkox" are used
* Prevent allocation/free when not necessary
2016-06-20 15:28:40 +02:00
Joshua J. Drake
16c27891a0 Switch to r_sys_perror for errors and fix two typos 2016-06-20 15:24:19 +02:00
Ahmed Mohamed Abd El-MAwgood
3bac42eda7 Improving variables on ARM (16, 32, 64) (#5146)
removing argument detection extension used in af now args are seperately detected by afCa
aa = af + afCa
using aliases as well as real registers
rewritten varsub
Fixing some of Arm esil and optimizing them for arg/var detection
2016-06-20 15:22:09 +02:00
pancake
1d5df40044 Fix r2 -nq - regression 2016-06-20 12:02:43 +02:00
pancake
90325a3ac0 Fix r2 -qc regression 2016-06-20 11:29:49 +02:00
pancake
0429420ee4 Fix the r_io regression thing 2016-06-20 11:08:21 +02:00
pancake
414aef609f Refix the ELF phdr max size issue 2016-06-10 11:00:40 +02:00
pancake
8c435e1a22 Fix doublefree issue 2016-06-10 10:58:10 +02:00
pancake
ab691c3a0f Fix r2 -i regression and add r2 -I for pre-scripting 2016-06-20 10:05:47 +02:00
pancake
550a91a17e Add asm.leahints to make @defragger happy 2016-06-20 09:46:03 +02:00
pancake
2a29662dbd More r_io cleanup 2016-06-20 09:30:29 +02:00
pancake
ddeb71b83b Fix regression in r_io_seek 2016-06-20 09:22:34 +02:00
pancake
e3bcc9e7a2 More refactorings, reindent and cleanup on r_io 2016-06-20 09:12:44 +02:00
pancake
6d4c16923d Run commands a bit before 2016-06-20 01:41:09 +02:00
pancake
ab1c8e313e Fix for io.default 2016-06-20 01:27:23 +02:00
pancake
4caafc964d Refactor r_io, while fixing some bugs and use more RList 2016-06-20 00:29:41 +02:00
pancake
81c977c979 Refactor r2 -iL and add oL (load plugins before r2 -L) 2016-06-19 23:32:58 +02:00
Álvaro Felipe Melchor
564803d5c2 express db breakpoints as dbm due to ASLR 2016-06-19 14:04:23 +02:00
Maijin
1117f5e19c Fix #3874 2016-06-19 12:30:30 +02:00
pancake
59f63e5f8d Handle Windows's noreturn call to ExitProcess 2016-06-19 12:26:58 +02:00
Jeffrey Crowell
769bcf98f6 add RBitmap to the rapi (#5176) 2016-06-19 11:10:59 +02:00
Jeffrey Crowell
387c2ce479 fix SIGFPE when queue is created with size <=0 2016-06-18 21:33:00 -04:00
Álvaro Felipe Melchor
93105250ab Handle bad PE files 2016-06-19 00:19:03 +02:00
Jeffrey Crowell
e90668c429 use kcov with unit tests 2016-06-18 14:59:59 -04:00
Jeffrey Crowell
59303f16b5 export PKG_CONFIG_PATH in .travis.yml 2016-06-18 00:22:33 -04:00
pancake
43781f390a Code cleanup 2016-06-18 01:15:52 +02:00
ekse
60220bc525 Check that a required argument was passed for a couple of commands. (#5166) 2016-06-17 23:17:24 +02:00
pancake
e2ab783250 Fix for regression in thumb/arm detection 2016-06-17 23:05:13 +02:00
pancake
016f5ec8ed Fix arm on thumb bins issue 2016-06-17 19:38:37 +02:00
pancake
3b0b7db100 Fix another oobread caused by callconv 2016-06-17 18:42:50 +02:00