Skip to content

Commit

Permalink
refactor quitconfirm in debug session
Browse files Browse the repository at this point in the history
  • Loading branch information
vanshjangir committed Oct 21, 2023
1 parent 90166d7 commit de189da
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions librz/main/rizin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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")) {
Expand Down

0 comments on commit de189da

Please sign in to comment.