summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2020-05-03 20:19:18 -0400
committer AJR <ajrhacker@users.noreply.github.com>2020-05-03 20:19:32 -0400
commitc4ee747357bf29df1970e5b4f1929128091fe134 (patch)
tree26543fb768b7ec4c07542c3cd7df6248bc63ab63
parentaa2e069e20a6adac23d44964c059ffd12e71caa2 (diff)
Add optional condition parameter to debugger gex command
-rw-r--r--src/emu/debug/debugcmd.cpp10
-rw-r--r--src/emu/debug/debugcpu.cpp31
-rw-r--r--src/emu/debug/debugcpu.h3
-rw-r--r--src/emu/debug/debughlp.cpp2
4 files changed, 34 insertions, 12 deletions
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp
index 5af1288ddb8..01d2f462d50 100644
--- a/src/emu/debug/debugcmd.cpp
+++ b/src/emu/debug/debugcmd.cpp
@@ -157,8 +157,8 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu
m_console.register_command("gv", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_commands::execute_go_vblank, this, _1, _2));
m_console.register_command("gint", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_go_interrupt, this, _1, _2));
m_console.register_command("gi", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_go_interrupt, this, _1, _2));
- m_console.register_command("gex", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_go_exception, this, _1, _2));
- m_console.register_command("ge", CMDFLAG_NONE, 0, 0, 1, std::bind(&debugger_commands::execute_go_exception, this, _1, _2));
+ m_console.register_command("gex", CMDFLAG_NONE, 0, 0, 2, std::bind(&debugger_commands::execute_go_exception, this, _1, _2));
+ m_console.register_command("ge", CMDFLAG_NONE, 0, 0, 2, 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));
@@ -899,7 +899,11 @@ void debugger_commands::execute_go_exception(int ref, const std::vector<std::str
if (params.size() > 0 && !validate_number_parameter(params[0], exception))
return;
- m_cpu.get_visible_cpu()->debug()->go_exception(exception);
+ parsed_expression condition(m_cpu.get_visible_cpu()->debug()->symtable());
+ if (params.size() > 1 && !debug_command_parameter_expression(params[1], condition))
+ return;
+
+ m_cpu.get_visible_cpu()->debug()->go_exception(exception, (condition.is_empty()) ? "1" : condition.original_string());
}
diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp
index 79fb43c9d65..17468e6da49 100644
--- a/src/emu/debug/debugcpu.cpp
+++ b/src/emu/debug/debugcpu.cpp
@@ -1499,9 +1499,25 @@ void device_debug::exception_hook(int exception)
// see if this matches an exception breakpoint
if ((m_flags & DEBUG_FLAG_STOP_EXCEPTION) != 0 && (m_stopexception == -1 || m_stopexception == exception))
{
- m_device.machine().debugger().cpu().set_execution_stopped();
- m_device.machine().debugger().console().printf("Stopped on exception (CPU '%s', exception %d, PC=%X)\n", m_device.tag(), exception, m_state->pcbase());
- compute_debug_flags();
+ bool matched = true;
+ if (m_exception_condition && !m_exception_condition->is_empty())
+ {
+ try
+ {
+ matched = m_exception_condition->execute();
+ }
+ catch (expression_error &)
+ {
+ return;
+ }
+ }
+
+ if (matched)
+ {
+ m_device.machine().debugger().cpu().set_execution_stopped();
+ m_device.machine().debugger().console().printf("Stopped on exception (CPU '%s', exception %d, PC=%X)\n", m_device.tag(), exception, m_state->pcbase());
+ compute_debug_flags();
+ }
}
}
@@ -1513,18 +1529,18 @@ void device_debug::exception_hook(int exception)
void device_debug::privilege_hook()
{
- bool matched = 1;
-
if ((m_flags & DEBUG_FLAG_STOP_PRIVILEGE) != 0)
{
+ bool matched = true;
if (m_privilege_condition && !m_privilege_condition->is_empty())
{
try
{
matched = m_privilege_condition->execute();
}
- catch (...)
+ catch (expression_error &)
{
+ return;
}
}
@@ -1847,12 +1863,13 @@ void device_debug::go_next_device()
// exception fires on the visible CPU
//-------------------------------------------------
-void device_debug::go_exception(int exception)
+void device_debug::go_exception(int exception, const char *condition)
{
assert(m_exec != nullptr);
m_device.machine().rewind_invalidate();
m_stopexception = exception;
+ m_exception_condition = std::make_unique<parsed_expression>(m_symtable, condition);
m_flags |= DEBUG_FLAG_STOP_EXCEPTION;
m_device.machine().debugger().cpu().set_execution_running();
}
diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h
index 8c8a5cc1cbb..36b718c6a16 100644
--- a/src/emu/debug/debugcpu.h
+++ b/src/emu/debug/debugcpu.h
@@ -201,7 +201,7 @@ public:
void go(offs_t targetpc = ~0);
void go_vblank();
void go_interrupt(int irqline = -1);
- void go_exception(int exception);
+ void go_exception(int exception, const char *condition);
void go_milliseconds(u64 milliseconds);
void go_privilege(const char *condition);
void go_next_device();
@@ -320,6 +320,7 @@ private:
int m_stopirq; // stop IRQ number for DEBUG_FLAG_STOP_INTERRUPT
int m_stopexception; // stop exception number for DEBUG_FLAG_STOP_EXCEPTION
std::unique_ptr<parsed_expression> m_privilege_condition; // expression to evaluate on privilege change
+ std::unique_ptr<parsed_expression> m_exception_condition; // expression to evaluate on exception hit
attotime m_endexectime; // ending time of the current execution
u64 m_total_cycles; // current total cycles
u64 m_last_total_cycles; // last total cycles
diff --git a/src/emu/debug/debughlp.cpp b/src/emu/debug/debughlp.cpp
index 8eb65554f90..4a6b265628e 100644
--- a/src/emu/debug/debughlp.cpp
+++ b/src/emu/debug/debughlp.cpp
@@ -137,7 +137,7 @@ static const help_item static_help_list[] =
" o[ver] [<count>=1] -- single steps over <count> instructions (F10)\n"
" out -- single steps until the current subroutine/exception handler is exited (Shift-F11)\n"
" g[o] [<address>] -- resumes execution, sets temp breakpoint at <address> (F5)\n"
- " ge[x] [<exception>] -- resumes execution, setting temp breakpoint if <exception> is raised\n"
+ " ge[x] [<exception>[,<condition>]] -- resumes execution, setting temp breakpoint if <exception> is raised\n"
" gi[nt] [<irqline>] -- resumes execution, setting temp breakpoint if <irqline> is taken (F7)\n"
" gt[ime] <milliseconds> -- resumes execution until the given delay has elapsed\n"
" gv[blank] -- resumes execution, setting temp breakpoint on the next VBLANK (F8)\n"