diff options
author | 2019-03-13 23:53:34 -0400 | |
---|---|---|
committer | 2019-03-13 23:57:09 -0400 | |
commit | 1a3b2ef914cbdf3a3a504d5d43aaa9d8dae1356d (patch) | |
tree | 96a4ef14cd3f0a2785a29235ad0e0d10a133412b /src/emu/debug/debugcmd.cpp | |
parent | 88d4191991c141afc91f521b8647a71767a59261 (diff) |
Exclude non-CPUs from numerical indexing for debugger commands
Diffstat (limited to 'src/emu/debug/debugcmd.cpp')
-rw-r--r-- | src/emu/debug/debugcmd.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index 7f650a2e356..72f4becbdcc 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -461,12 +461,17 @@ bool debugger_commands::validate_cpu_parameter(const char *param, device_t *&res return false; } - /* if we got a valid one, return */ - device_execute_interface *exec = execute_interface_iterator(m_machine.root_device()).byindex(cpunum); - if (exec != nullptr) + // attempt to find by numerical index + int index = 0; + for (device_execute_interface &exec : execute_interface_iterator(m_machine.root_device())) { - result = &exec->device(); - return true; + // real CPUs should have pcbase + const device_state_interface *state; + if (exec.device().interface(state) && state->state_string(STATE_GENPCBASE) != "???" && index++ == cpunum) + { + result = &exec.device(); + return true; + } } /* if out of range, complain */ |