From a7d63cde543e1e1f74a376e3ff7194abe33a6894 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 10 May 2023 23:08:29 -0700 Subject: [PATCH] Core: Reattaching the same debugger is a no-op --- src/gb/core.c | 3 +++ src/gba/core.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/gb/core.c b/src/gb/core.c index b35616f2b..f1358ee69 100644 --- a/src/gb/core.c +++ b/src/gb/core.c @@ -1061,6 +1061,9 @@ static struct CLIDebuggerSystem* _GBCoreCliDebuggerSystem(struct mCore* core) { static void _GBCoreAttachDebugger(struct mCore* core, struct mDebugger* debugger) { struct SM83Core* cpu = core->cpu; + if (core->debugger == debugger) { + return; + } if (core->debugger) { SM83HotplugDetach(cpu, CPU_COMPONENT_DEBUGGER); } diff --git a/src/gba/core.c b/src/gba/core.c index 851a9dee6..7a4650a33 100644 --- a/src/gba/core.c +++ b/src/gba/core.c @@ -1129,6 +1129,9 @@ static struct CLIDebuggerSystem* _GBACoreCliDebuggerSystem(struct mCore* core) { } static void _GBACoreAttachDebugger(struct mCore* core, struct mDebugger* debugger) { + if (core->debugger == debugger) { + return; + } if (core->debugger) { GBADetachDebugger(core->board); }