From be66972aacde462f9c4578b71fc440a9f96d3889 Mon Sep 17 00:00:00 2001 From: vanshjangir Date: Thu, 12 Oct 2023 15:34:38 +0530 Subject: [PATCH] refactor quitconfirm in debug session --- librz/main/rizin.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/librz/main/rizin.c b/librz/main/rizin.c index 742bfa84d79..9363b3d3ced 100644 --- a/librz/main/rizin.c +++ b/librz/main/rizin.c @@ -1453,25 +1453,6 @@ RZ_API int rz_main_rizin(int argc, const char **argv) { } } - if (debug) { - if (no_question_debug) { - if (rz_config_get_i(r->config, "dbg.exitkills") && y_kill_debug) { - rz_debug_kill(r->dbg, r->dbg->pid, r->dbg->tid, 9); // KILL - } - } else { - if (rz_cons_yesno('y', "Do you want to quit? (Y/n)")) { - if (rz_config_get_i(r->config, "dbg.exitkills") && - rz_debug_can_kill(r->dbg) && - rz_cons_yesno('y', "Do you want to kill the process? (Y/n)")) { - rz_config_set_i(r->config, "scr.confirmquit", false); - rz_debug_kill(r->dbg, r->dbg->pid, r->dbg->tid, 9); // KILL - } - } else { - continue; - } - } - } - prj = rz_config_get(r->config, "prj.file"); bool compress = rz_config_get_b(r->config, "prj.compress"); RzProjectErr prj_err = RZ_PROJECT_ERR_SUCCESS; @@ -1496,6 +1477,21 @@ RZ_API int rz_main_rizin(int argc, const char **argv) { continue; } } + + if (debug) { + if (no_question_debug) { + if (rz_config_get_i(r->config, "dbg.exitkills") && y_kill_debug) { + rz_debug_kill(r->dbg, r->dbg->pid, r->dbg->tid, 9); // KILL + } + } else { + if (rz_config_get_i(r->config, "dbg.exitkills") && + rz_debug_can_kill(r->dbg) && + rz_cons_yesno('y', "Do you want to kill the process? (Y/n)")) { + rz_config_set_i(r->config, "scr.confirmquit", false); + rz_debug_kill(r->dbg, r->dbg->pid, r->dbg->tid, 9); // KILL + } + } + } } else { // rz_core_project_save (r, prj); if (debug && rz_config_get_i(r->config, "dbg.exitkills")) {