debugger: Some commands should not repeat.

Entering a blank command causes the last command to repeat. This doesn't make sense for the following commands:
help, quit, regs, context, printenv, setenv, nvedit, amicint, viaint.
This commit is contained in:
joevt 2023-07-28 14:15:17 -07:00 committed by dingusdev
parent 17983e7fad
commit 006a90f681

View File

@ -487,10 +487,13 @@ void enter_debugger() {
cout << cmd << endl; cout << cmd << endl;
} }
if (cmd == "help") { if (cmd == "help") {
cmd = "";
show_help(); show_help();
} else if (cmd == "quit") { } else if (cmd == "quit") {
cmd = "";
break; break;
} else if (cmd == "profile") { } else if (cmd == "profile") {
cmd = "";
ss >> sub_cmd; ss >> sub_cmd;
ss >> profile_name; ss >> profile_name;
@ -503,6 +506,7 @@ void enter_debugger() {
} }
} }
else if (cmd == "regs") { else if (cmd == "regs") {
cmd = "";
if (context == 2) { if (context == 2) {
#ifdef ENABLE_68K_DEBUGGER #ifdef ENABLE_68K_DEBUGGER
print_68k_regs(); print_68k_regs();
@ -585,6 +589,7 @@ void enter_debugger() {
cout << exc.what() << endl; cout << exc.what() << endl;
} }
} else if (cmd == "go") { } else if (cmd == "go") {
cmd = "";
power_on = true; power_on = true;
ppc_exec(); // won't return! ppc_exec(); // won't return!
} else if (cmd == "disas" || cmd == "da") { } else if (cmd == "disas" || cmd == "da") {
@ -657,6 +662,7 @@ void enter_debugger() {
dump_mem(expr_str); dump_mem(expr_str);
#ifdef ENABLE_68K_DEBUGGER #ifdef ENABLE_68K_DEBUGGER
} else if (cmd == "context") { } else if (cmd == "context") {
cmd = "";
expr_str = ""; expr_str = "";
ss >> expr_str; ss >> expr_str;
if (expr_str == "ppc" || expr_str == "PPC") { if (expr_str == "ppc" || expr_str == "PPC") {
@ -668,10 +674,12 @@ void enter_debugger() {
} }
#endif #endif
} else if (cmd == "printenv") { } else if (cmd == "printenv") {
cmd = "";
if (ofnvram->init()) if (ofnvram->init())
continue; continue;
ofnvram->printenv(); ofnvram->printenv();
} else if (cmd == "setenv") { } else if (cmd == "setenv") {
cmd = "";
string var_name, value; string var_name, value;
ss >> var_name; ss >> var_name;
std::istream::sentry se(ss); // skip white space std::istream::sentry se(ss); // skip white space
@ -681,6 +689,7 @@ void enter_debugger() {
ofnvram->setenv(var_name, value); ofnvram->setenv(var_name, value);
#ifndef _WIN32 #ifndef _WIN32
} else if (cmd == "nvedit") { } else if (cmd == "nvedit") {
cmd = "";
cout << "===== press CNTRL-C to save =====" << endl; cout << "===== press CNTRL-C to save =====" << endl;
// save original terminal state // save original terminal state
@ -730,6 +739,7 @@ void enter_debugger() {
#endif #endif
#ifdef DEBUG_CPU_INT #ifdef DEBUG_CPU_INT
} else if (cmd == "amicint") { } else if (cmd == "amicint") {
cmd = "";
string value; string value;
int irq_id; int irq_id;
ss >> value; ss >> value;
@ -743,6 +753,7 @@ void enter_debugger() {
gMachineObj->get_comp_by_type(HWCompType::INT_CTRL)); gMachineObj->get_comp_by_type(HWCompType::INT_CTRL));
int_ctrl->ack_int(irq_id, 1); int_ctrl->ack_int(irq_id, 1);
} else if (cmd == "viaint") { } else if (cmd == "viaint") {
cmd = "";
string value; string value;
int irq_bit; int irq_bit;
ss >> value; ss >> value;