9879 Commits

Author SHA1 Message Date
Jeffrey Crowell
7436b51095 add r_reg_32_to_64 for @condret
closes #5206
2016-06-25 00:03:44 -04:00
pancake
30deb7e3f2 Fix 004e_00007ffd2a9dc86.. from gamozo 2016-06-25 04:44:19 +02:00
pancake
4f785d398f Fix --disable-debugger on OSX 2016-06-25 04:26:07 +02:00
pancake
6ace96c3a5 Fix #5160 - make afbj great again 2016-06-25 04:17:31 +02:00
pancake
7e4cb2749e Fix #5002 - @o is a new modifier to temporary switch to another fd 2016-06-25 03:43:32 +02:00
pancake
b9e9d7fe4c Fix #4936 - Verify call destination in aac 2016-06-25 03:37:01 +02:00
pancake
baca25dc73 Fix #5200 - __WALL is a linuxism, better use WAIT_ANY 2016-06-25 03:36:58 +02:00
condret
b8f26d248b fix #4422 (#5203) 2016-06-25 03:36:53 +02:00
pancake
90d42c0418 Refactor pia/pda and implement pdaj and pda= 2016-06-25 03:36:49 +02:00
pancake
c351c3d767 Fix oobread in dwarf die values 2016-06-24 19:35:34 +00:00
pancake
7dab05df70 Fix oobread in dwarf decls 2016-06-24 19:35:34 +00:00
Jeffrey Crowell
36650442f5 fix heap oob-read in dwarf parser
https://gist.github.com/4352a2f4a239a96b90e7b23bb22e8ef1
for repro file
2016-06-24 14:58:47 +00:00
Sven Steinbauer
2c086751b9 Add fsincos instruction [fix #5204] (#5205) 2016-06-24 15:08:52 +02:00
pancake
311a339473 Fix memleak in spawn swift-demangler 2016-06-23 17:46:37 +02:00
pancake
a55bcd628f Fix two swift demangler crashes and add tests 2016-06-23 17:11:17 +02:00
Joshua J. Drake
99678d2fe0 Fix return consistency and clarify variable naming (#5199) 2016-06-23 10:40:14 +02:00
Álvaro Felipe Melchor
efd4ece4c2 fix warning comparing unsigned int >= 0 2016-06-22 23:54:21 +02:00
Álvaro Felipe Melchor
d65889d15d add name to section when is empty 2016-06-22 23:51:33 +02:00
Álvaro Felipe Melchor
42e507ebfa comment out hackaround for huge number of sections 2016-06-22 23:51:31 +02:00
Álvaro Felipe Melchor
8e6b857cdf more work in PE loader 2016-06-22 23:51:27 +02:00
pancake
e4eb7e5ee9 Workaround for enum vs type swig hack 2016-06-22 19:43:19 +02:00
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
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
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
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
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
ab1c8e313e Fix for io.default 2016-06-20 01:27:23 +02:00