diff options
author | 2018-04-02 17:23:38 +0100 | |
---|---|---|
committer | 2018-04-02 12:23:38 -0400 | |
commit | 06a09d38216c4a64f1dd33a3137ed8ef4df92fdc (patch) | |
tree | 178381f45cd6887728f8a0b35eefe912a8044067 /src/emu/debug/debugcmd.cpp | |
parent | 729c0ca3edb36a29238f30f90f9165a02bd37e01 (diff) |
Added suspend and resume debugger commands (#3411)
Diffstat (limited to 'src/emu/debug/debugcmd.cpp')
-rw-r--r-- | src/emu/debug/debugcmd.cpp | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index 6b393e21552..55632bd4e85 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -163,6 +163,8 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu m_console.register_command("focus", CMDFLAG_NONE, 0, 1, 1, std::bind(&debugger_commands::execute_focus, this, _1, _2)); m_console.register_command("ignore", CMDFLAG_NONE, 0, 0, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_ignore, this, _1, _2)); m_console.register_command("observe", CMDFLAG_NONE, 0, 0, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_observe, this, _1, _2)); + m_console.register_command("suspend", CMDFLAG_NONE, 0, 0, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_suspend, this, _1, _2)); + m_console.register_command("resume", CMDFLAG_NONE, 0, 0, MAX_COMMAND_PARAMS, std::bind(&debugger_commands::execute_resume, this, _1, _2)); m_console.register_command("comadd", CMDFLAG_NONE, 0, 1, 2, std::bind(&debugger_commands::execute_comment_add, this, _1, _2)); m_console.register_command("//", CMDFLAG_NONE, 0, 1, 2, std::bind(&debugger_commands::execute_comment_add, this, _1, _2)); @@ -1023,6 +1025,109 @@ void debugger_commands::execute_observe(int ref, const std::vector<std::string> } } +/*------------------------------------------------- + execute_suspend - suspend execution on cpu +-------------------------------------------------*/ + +void debugger_commands::execute_suspend(int ref, const std::vector<std::string> ¶ms) +{ + /* if there are no parameters, dump the ignore list */ + if (params.empty()) + { + std::string buffer; + + /* loop over all executable devices */ + for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device())) + + /* build up a comma-separated list */ + if (exec.device().debug()->suspended()) + { + if (buffer.empty()) + buffer = string_format("Currently suspended device '%s'", exec.device().tag()); + else + buffer.append(string_format(", '%s'", exec.device().tag())); + } + + /* special message for none */ + if (buffer.empty()) + buffer = string_format("No currently suspended devices"); + m_console.printf("%s\n", buffer.c_str()); + } + else + { + device_t *devicelist[MAX_COMMAND_PARAMS]; + + /* validate parameters */ + for (int paramnum = 0; paramnum < params.size(); paramnum++) + if (!validate_cpu_parameter(params[paramnum].c_str(), devicelist[paramnum])) + return; + + for (int paramnum = 0; paramnum < params.size(); paramnum++) + { + /* make sure this isn't the last live CPU */ + bool gotone = false; + for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device())) + if (&exec.device() != devicelist[paramnum] && !exec.device().debug()->suspended()) + { + gotone = true; + break; + } + if (!gotone) + { + m_console.printf("Can't suspend all devices!\n"); + return; + } + + devicelist[paramnum]->debug()->suspend(true); + m_console.printf("Suspended device '%s'\n", devicelist[paramnum]->tag()); + } + } +} + +/*------------------------------------------------- + execute_resume - Resume execution on CPU +-------------------------------------------------*/ + +void debugger_commands::execute_resume(int ref, const std::vector<std::string> ¶ms) +{ + /* if there are no parameters, dump the ignore list */ + if (params.empty()) + { + std::string buffer; + + /* loop over all executable devices */ + for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device())) + + /* build up a comma-separated list */ + if (exec.device().debug()->suspended()) + { + if (buffer.empty()) + buffer = string_format("Currently suspended device '%s'", exec.device().tag()); + else + buffer.append(string_format(", '%s'", exec.device().tag())); + } + + /* special message for none */ + if (buffer.empty()) + buffer = string_format("No currently suspended devices"); + m_console.printf("%s\n", buffer.c_str()); + } + else + { + device_t *devicelist[MAX_COMMAND_PARAMS]; + + /* validate parameters */ + for (int paramnum = 0; paramnum < params.size(); paramnum++) + if (!validate_cpu_parameter(params[paramnum].c_str(), devicelist[paramnum])) + return; + + for (int paramnum = 0; paramnum < params.size(); paramnum++) + { + devicelist[paramnum]->debug()->suspend(false); + m_console.printf("Resumed device '%s'\n", devicelist[paramnum]->tag()); + } + } +} /*------------------------------------------------- execute_comment - add a comment to a line |