Cleanup debugger state during restart. (#17246) ##debug

This commit is contained in:
karliss 2020-07-09 11:29:13 +03:00 committed by GitHub
parent e3b67f124c
commit 14c7dfe5fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 0 deletions

View File

@ -116,6 +116,8 @@ R_API int r_core_file_reopen(RCore *core, const char *args, int perm, int loadbi
// Reset previous pid and tid
core->dbg->pid = -1;
core->dbg->tid = -1;
core->dbg->recoil_mode = R_DBG_RECOIL_NONE;
memset (&core->dbg->reason, 0, sizeof (core->dbg->reason));
// Reopen and attach
r_core_setup_debugger (core, "native", true);
r_debug_select (core->dbg, newpid, newtid);

View File

@ -68,3 +68,30 @@ EXPECT=<<EOF
1 fd: 4 +0x00000000 0x00000000 - 0x7ffffffffffffffe rwx
EOF
RUN
NAME=breakpoints after double doo
FILE=bins/elf/analysis/x86-helloworld-gcc
ARGS=
CMDS=<<EOF
db main
db main+3
doo > $_
dc # should hit the first breakpoint
.dr*
?v eip-main
doo > $_
dc # should hit the first breakpoint
.dr*
?v eip-main
dc # should hit the the second breakpoint
.dr*
?v eip-main
EOF
EXPECT=<<EOF
0x0
0x0
0x3
Hello world!
EOF
RUN