summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/debugger/debuggdbstub.cpp
diff options
context:
space:
mode:
author npwoods <npwoods@mess.org>2022-08-02 10:24:17 -0400
committer GitHub <noreply@github.com>2022-08-02 10:24:17 -0400
commite404f1ffe0a831a7b7a5cdb8acf9d98e89f7b76e (patch)
tree9b88195a62a57a1421d7a08ebc47479840f43b13 /src/osd/modules/debugger/debuggdbstub.cpp
parent00d5699d73f21840da631b4715bc4c4aa5a20fa4 (diff)
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
Diffstat (limited to '')
-rw-r--r--src/osd/modules/debugger/debuggdbstub.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/osd/modules/debugger/debuggdbstub.cpp b/src/osd/modules/debugger/debuggdbstub.cpp
index 5e477200dc2..cd21a4c5b1b 100644
--- a/src/osd/modules/debugger/debuggdbstub.cpp
+++ b/src/osd/modules/debugger/debuggdbstub.cpp
@@ -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() )