Exclude non-CPUs from numerical indexing for debugger commands

This commit is contained in:
AJR 2019-03-13 23:53:34 -04:00
parent 88d4191991
commit 1a3b2ef914

View File

@ -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 */