From 12f43029dce51119c7fba40486c82339f2a9908b Mon Sep 17 00:00:00 2001 From: Sven Schnelle Date: Tue, 6 Nov 2018 14:57:00 +0100 Subject: debugger: add 'gp' command gp 'go privilege' starts execution until the privilege mode changes. This can be used to break on task switches. I.e on m68k, one could do: gp { ~sr & 0x2000 && crp_aptr == 0x1234567 } which would execute until the privilege mode changes to user mode and the CPU root pointer is 0x1234567. for cpu code, all that is needed to make this work is calling debugger_privilege_hook() when the execution level changes. --- src/emu/debug/debugcmd.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/emu/debug/debugcmd.cpp') diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index 4dc4844ae6c..868dfec1fde 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -160,6 +160,7 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu m_console.register_command("ge", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_go_exception, this, _1, _2)); m_console.register_command("gtime", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_go_time, this, _1, _2)); m_console.register_command("gt", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_go_time, this, _1, _2)); + m_console.register_command("gp", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_go_privilege, this, _1, _2)); m_console.register_command("next", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_next, this, _1, _2)); m_console.register_command("n", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_next, this, _1, _2)); m_console.register_command("focus", CMDFLAG_NONE, 0, 1, 1, std::bind(&debugger_commands::execute_focus, this, _1, _2)); @@ -899,6 +900,19 @@ void debugger_commands::execute_go_time(int ref, const std::vector } + +/*------------------------------------------------- + execute_go_privilege - execute the gp command +-------------------------------------------------*/ +void debugger_commands::execute_go_privilege(int ref, const std::vector ¶ms) +{ + parsed_expression condition(&m_cpu.get_visible_cpu()->debug()->symtable()); + if (params.size() > 0 && !debug_command_parameter_expression(params[0], condition)) + return; + + m_cpu.get_visible_cpu()->debug()->go_privilege((condition.is_empty()) ? "1" : condition.original_string()); +} + /*------------------------------------------------- execute_next - execute the next command -------------------------------------------------*/ -- cgit v1.2.3