When resuming after (during) recoil from a breakpoint, the swstep
implementation would fail to advance. In short, the debugger would immediately
interrupt again because r_bp_restore was re-setting the original breakpoint
just before continue. The following changes fix this issue:
1. Modify r_bp_get_in to stop including the byte after a breakpoint. This was
causing r_bp_recoil to fail because it thought there was already a breakpoint
on the next instruction.
2. Pass the real breakpoint address (pc - dbg->bpsize) to r_bp_recoil so
that r_bp_get_in can work properly. Stop adding the b->size there to keep it
going too.
3. Add a state flag to core->dbg to track that we are in the midst of a recoil.
4. When continuing from recoil (in r_debug_continue_kill), restore all
breakpoints except the one we just hit (with the new r_bp_restore_except) to
avoid hitting it again. Once we move past this instruction, that breakpoint
will be set again.
It should fix some layer problem on some binaries like ls-linux64 and in
the presence of self-loop. The previous algorithm could assign the same
layer to two nodes that are connected with an edge (and it should never
happen, because they have to be on different layers).
This patch uses the topological sort of a graph to assign the layer.
The "r_sys_perror" function previously would use "perror" on UNIX resulting in
location information of the "perror" callsite being shown. Renaming
"r_sys_perror" to "r_sys_perror_str" and replacing the original identifier with
a macro ensures that the displayed information is useful.
Further, this addreses a TODO that makes this functionality work on both
Windows and UNIX by moving these macros outside of the UNIX #if. The (now)
"r_sys_perror_str" is already implemented for both platforms. Let's use it!
fixes mentioned in the pr
fixed the Vp issue mentioned in the pr
fixes the mentioned parts
changed reallocation size
Signed-off-by: Riccardo Schirone <sirmy15@gmail.com>
If r2 is unsigned the message the user gets when trying to debug with it
isn't clear as to what the problem is. Add a line to suggest most likely issue and go see the docs to get a cert.