debugger: Erase prompt when repeating command.

Enterring a blank command continues the disassembly or stepping for one instruction. Erasing the prompt saves one line in the console so the disassembly doesn't appear double spaced. I don't know if the terminal control sequence works in Windows.
This commit is contained in:
joevt 2023-08-07 11:26:24 -07:00 committed by dingusdev
parent 625e474c03
commit 27d389c36a

View File

@ -438,6 +438,13 @@ static void mysig_handler(int signum)
} }
#endif #endif
static void delete_prompt() {
#ifndef _WIN32
// move up, carriage return (move to column 0), erase from cursor to end of line
cout << "\e[A\r\e[0K";
#endif
}
void enter_debugger() { void enter_debugger() {
string inp, cmd, addr_str, expr_str, reg_expr, last_cmd, reg_value_str, string inp, cmd, addr_str, expr_str, reg_expr, last_cmd, reg_value_str,
inst_string, inst_num_str, profile_name, sub_cmd; inst_string, inst_num_str, profile_name, sub_cmd;
@ -620,11 +627,17 @@ void enter_debugger() {
if (context == 2) { if (context == 2) {
#ifdef ENABLE_68K_DEBUGGER #ifdef ENABLE_68K_DEBUGGER
if (cmd_repeat) {
delete_prompt();
}
for (; --count >= 0;) { for (; --count >= 0;) {
exec_single_68k(); exec_single_68k();
} }
#endif #endif
} else { } else {
if (cmd_repeat) {
delete_prompt();
}
for (; --count >= 0;) { for (; --count >= 0;) {
ppc_exec_single(); ppc_exec_single();
} }
@ -703,6 +716,7 @@ void enter_debugger() {
if (context == 2) { if (context == 2) {
#ifdef ENABLE_68K_DEBUGGER #ifdef ENABLE_68K_DEBUGGER
if (cmd_repeat) { if (cmd_repeat) {
delete_prompt();
addr = next_addr_68k; addr = next_addr_68k;
} }
else { else {
@ -713,6 +727,7 @@ void enter_debugger() {
#endif #endif
} else { } else {
if (cmd_repeat) { if (cmd_repeat) {
delete_prompt();
addr = next_addr_ppc; addr = next_addr_ppc;
} }
else { else {