Changed gdbstub to no longer expect a CPU named ':maincpu' (#10170)

The logic was changed to find the first CPU, without any particular expectation about naming.  This should address issue #10141
This commit is contained in:
npwoods 2022-08-02 10:24:17 -04:00 committed by GitHub
parent 00d5699d73
commit e404f1ffe0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -643,7 +643,19 @@ void debug_gdbstub::wait_for_debugger(device_t &device, bool firststop)
if ( firststop && !m_initialized )
{
m_maincpu = m_machine->root_device().subdevice(":maincpu");
// find the "main" CPU, which is the first CPU (gdbstub doesn't seem to have any notion of switching CPUs)
for (device_t &device : device_enumerator(m_machine->root_device()))
{
auto *cpu = dynamic_cast<cpu_device *>(&device);
if (cpu)
{
m_maincpu = cpu;
break;
}
}
if (!m_maincpu)
fatalerror("gdbstub: cannot find any CPUs\n");
const char *cpuname = m_maincpu->shortname();
auto it = gdb_register_maps.find(cpuname);
if ( it == gdb_register_maps.end() )