Fix file reopen in debug mode ood/doo (#16131) ##debug

This commit is contained in:
radare 2020-03-05 14:42:32 +01:00 committed by GitHub
parent 5e1d5faebd
commit 0cacc6e829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 2 deletions

View File

@ -75,7 +75,8 @@ R_API int r_core_file_reopen(RCore *core, const char *args, int perm, int loadbi
int newpid = odesc? odesc->fd: -1;
if (isdebug) {
r_debug_kill (core->dbg, core->dbg->pid, core->dbg->tid, 9); // KILL
r_debug_kill (core->dbg, core->dbg->pid, core->dbg->tid, 9); // SIGKILL
r_debug_continue (core->dbg);
perm = 7;
} else {
if (!perm) {

View File

@ -1117,9 +1117,9 @@ R_API void r_core_file_reopen_debug(RCore *core, const char *args) {
char *newfile = r_str_newf ("dbg://%s %s", escaped_path, args);
desc->uri = newfile;
desc->referer = NULL;
r_core_file_reopen (core, newfile, 0, 2);
r_config_set_i (core->config, "asm.bits", bits);
r_config_set_i (core->config, "cfg.debug", true);
r_core_file_reopen (core, newfile, 0, 2);
if (r_config_get_i (core->config, "dbg.rebase")) {
__rebase_everything (core, old_sections, old_base);
}

View File

@ -427,6 +427,8 @@ repeat:
if (WIFEXITED (status)) {
eprintf ("child exited with status %d\n", WEXITSTATUS (status));
if (pid == dbg->main_pid) {
r_list_free (dbg->threads);
dbg->threads = NULL;
reason = R_DEBUG_REASON_DEAD;
} else {
reason = R_DEBUG_REASON_EXIT_TID;

View File

@ -26,6 +26,21 @@ dbg:///bin/ls
EOF
RUN
NAME= ood after open in debug mode
FILE=../bins/elf/analysis/x86-helloworld-gcc
ARGS=-d
CMDS=<<EOF
ood > $_
dc
ood > $_
dc
EOF
EXPECT=<<EOF
Hello world!
Hello world!
EOF
RUN
NAME=oo ; dc
FILE=../bins/elf/analysis/x86-helloworld-gcc
ARGS=-d