Commit graph

540 commits

Author SHA1 Message Date
pancake
d001066eb4 Support longer wopD.. still not complete 2016-08-15 01:40:34 +02:00
pancake
3654e5f33b Fix regression in reg.type=flg 2016-08-14 19:12:52 +02:00
pancake
f60597b2ee Fix ar 1 to honor RReg.Type.flg 2016-08-14 02:23:47 +02:00
Ahmed Mohamed Abd El-MAwgood
52da64becc Fix for function name decorators (oridinal, sym.blablabla) (#5488)
implemented function guess matched name which finds longest function name in sdb_types that is substring of the current function name
2016-08-14 02:07:43 +02:00
Ahmed Mohamed Abd El-MAwgood
4f413e7720 initial support for type matching (#5480)
Enabling stepping over
Basic (sym.imp.*) call catching routines
Fixing esil tracing bug and verbosity
Adding some apis for handling function prototypes and abstacting sbd queries
Fixing the double execusion bug in esil tracing
passing types into vars for `stack`
fixing trailing spaces
doing the regester branch
doing the stack_rev
2016-08-13 12:09:14 +02:00
Ahmed Mohamed Abd El-MAwgood
ad1565d9e4 few enhancements for afv FIX #5459 (#5461)
replacing afv[bsr]n  with afvn
replacing negative sign `n` with `_`
being consistent across the documentations (args + locals = vars)
refactoring code
2016-08-09 00:17:42 +02:00
pancake
3e5f636869 Fix Vcdn to rename local vars - reported by @ret2libc 2016-08-08 01:00:47 +02:00
Roman Valls Guimerà
33c6d01531 [AVR] First approach to afCl/cdecl for AVR (#5453)
* First approach to afCl/cdecl. Thanks @oddcoder.
* Remove compilers that do not exist for AVR
* Remove unnecessary platform-specific code since 'cc-arch-bits' should be already a stable convention.
* Typo on the afC way
2016-08-07 17:14:14 +02:00
Ahmed Mohamed Abd El-MAwgood
5adf93a570 fixing aek- (#5454)
according to `ae?`,  aek- is used to delete all esil->stats key/value pairs, but it wasn't actually implemented.
2016-08-07 17:08:52 +02:00
pancake
b53a7bb84b Fix regression in AFR related to io_is_valid 2016-08-07 14:08:13 +02:00
pancake
a4ff60743f Follow fcn calls one step further WIP 2016-08-07 09:17:05 +01:00
pancake
2113751573 Fix some false positives in aad using the API instead of r2cmd 2016-08-05 14:41:59 +02:00
Ahmed Mohamed Abd El-MAwgood
4668bc5ea3 Adding nonull (#5441) 2016-08-05 13:35:44 +02:00
pancake
53e9e91b4c Increase rafind2 -ZS wide and do not run aad in aaa 2016-08-05 00:30:56 +02:00
pancake
5b189ee595 Fix #5447 - Implement aO command 2016-08-04 23:52:30 +02:00
Maijin
9a404b6d9c Add rowlog for aad in aaa 2016-08-04 14:26:30 -07:00
pancake
3ca1d5653c Add 'aad' to analyze data refs which are actually code 2016-08-04 22:53:18 +02:00
pancake
f840836af8 Add aad command to analyze data refs as code (LEA) 2016-08-04 22:52:33 +02:00
pancake
d917902b4e Fix #5427 - ao[n] shows same bytes on all instructions 2016-08-01 16:18:24 +02:00
pancake
7b0622f85d Fix latest covs 2016-08-01 14:46:17 +02:00
Maijin
f211c68095 Remove afg 2016-07-31 11:55:09 +02:00
Ahmed Mohamed Abd El-MAwgood
7c8414f585 FIX #5392 display values of args and locals in debugger (#5417) 2016-07-29 19:35:34 +02:00
Eugene
ef8daed816 Fixes #5389 - Add aflqj 2016-07-29 19:34:43 +02:00
pancake
f2ac0a1d52 Enhance ignore call warning message and minor refactor in mach0 entitlements parser 2016-07-28 11:33:53 +02:00
Ahmed Mohamed Abd El-MAwgood
2dbb3d8fc6 Calling convention profiles in SDB (#5358) 2016-07-27 13:50:14 +02:00
Ahmed Mohamed Abd El-MAwgood
5586355bb8 autoloading windows types when file is windows executable (#5304)
and few other adjustements
2016-07-07 00:14:06 +02:00
pancake
f85536ac76 Add agC for full program callgraph
Fix afi indentation issues
2016-07-05 17:37:29 +02:00
monosource
cea1c14750 Typo fix "afss-" -> "afvs-" (#5261) 2016-07-01 19:46:01 +02:00
Ahmed Mohamed Abd El-MAwgood
b31dd80724 Args/vars the last commit (#5245)
renaming afa, afv and afe to afvb afvr, and afvs respectively
making arguments analysis obeys e anal.vars
improving the json format for args/vars
fixing varsub to use the new comands for x86 and arm
fixing var commenting commands to use the new commands var configuration
2016-07-01 16:15:29 +02:00
pancake
4c21937caa Reuse 6502 regsize hack for AVR 2016-07-01 15:22:10 +02:00
Álvaro Felipe Melchor
4b08d38cb1 more mem leak fixes 2016-06-29 10:11:25 +02:00
Jeffrey Crowell
10b9fc1db0 rm unneeded calls to r_cons_printf 2016-06-26 00:17:16 -04:00
pancake
6ace96c3a5 Fix #5160 - make afbj great again 2016-06-25 04:17:31 +02:00
pancake
b9e9d7fe4c Fix #4936 - Verify call destination in aac 2016-06-25 03:37:01 +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
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
ekse
60220bc525 Check that a required argument was passed for a couple of commands. (#5166) 2016-06-17 23:17:24 +02:00
monosource
dc61e8c511 Change afbr description (#5163)
`afbr`'s description isn't worded properly. It doesn't actually print addresses of `ret` instructions, but of instructions which cause the flow of the program to leave the function body, like `call`, `jmp`, `hlt` etc.
2016-06-17 14:26:46 +02:00
pancake
911fef209a Implement afbr and * sub-variants to list return addresses of current function 2016-06-17 02:50:01 +02:00
pancake
84aa6782f1 Add trailing newline in afbj 2016-06-15 13:41:45 +02:00
Riccardo Schirone
04190287c1 core: fix uber confusing indentation in cmd_anal "afl" command 2016-06-15 11:15:42 +02:00
pancake
1bdcb740dc Fix regressions introduced in last commit 2016-06-15 00:23:44 +02:00
pancake
e032a48cbe Fix latest 26 COVs 2016-06-14 23:47:58 +02:00
robbje
a772452d27 Cgs (#5126)
* refactor function listing code

* adhere to style guide

* use tabs instead of spaces

* recover default behaviour for afi commands

* work in commentary and fix the two regression tests I broke

* some more cosmetic changes

* shorten function names
2016-06-14 17:54:17 +02:00
pancake
eda7899adc Various enhancements to aae 2016-06-14 01:30:40 +02:00
Ahmed Mohamed Abd El-MAwgood
0027246ec4 Fixing arguments docs 2016-06-13 13:09:46 +02:00
pancake
2ca927caea Add anal.vinfun for aav (only grab values outside function boundaries) 2016-06-09 21:52:25 +02:00
Ahmed Mohamed Abd El-MAwgood
000c602348 FIX #5096 (#5101) 2016-06-08 18:13:36 +02:00
pancake
24aec5be8c Fix all latest COVs 2016-06-07 10:03:04 +02:00
pancake
12d8fbca15 Fix crash in aoe 2016-06-06 10:16:26 +02:00