mirror of
https://github.com/holub/mame
synced 2025-07-07 19:03:29 +03:00
Add optional condition parameter to debugger gex command
This commit is contained in:
parent
aa2e069e20
commit
c4ee747357
@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user