From cb4a23a2baf25456583c190f66057cb78e088f12 Mon Sep 17 00:00:00 2001 From: TuxSH <1922548+TuxSH@users.noreply.github.com> Date: Thu, 3 Dec 2020 21:48:16 +0000 Subject: [PATCH] gdb: fix handling of bkpt instructions --- sysmodules/rosalina/source/gdb/debug.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sysmodules/rosalina/source/gdb/debug.c b/sysmodules/rosalina/source/gdb/debug.c index 6e2ef3f..35456d5 100644 --- a/sysmodules/rosalina/source/gdb/debug.c +++ b/sysmodules/rosalina/source/gdb/debug.c @@ -460,8 +460,8 @@ int GDB_SendStopReply(GDBContext *ctx, const DebugEventInfo *info) switch(exc.type) { case EXCEVENT_UNDEFINED_INSTRUCTION: - case EXCEVENT_PREFETCH_ABORT: // doesn't include hardware breakpoints - case EXCEVENT_DATA_ABORT: // doesn't include hardware watchpoints + case EXCEVENT_PREFETCH_ABORT: + case EXCEVENT_DATA_ABORT: case EXCEVENT_UNALIGNED_DATA_ACCESS: case EXCEVENT_UNDEFINED_SYSCALL: { @@ -491,9 +491,11 @@ int GDB_SendStopReply(GDBContext *ctx, const DebugEventInfo *info) case STOPPOINT_BREAKPOINT: { - // /!\ Not actually implemented (and will never be) + // Note: this includes both "bkpt" and hw breakpoints, but we never use the latter... + // However, since our GDB executable only knows about svc 0xFF as sw breakpoint for the 3DS ABI, + // we can use swbreak as reason (it'll dismiss the bkpt instruction and try to auto-step over it). GDB_ParseCommonThreadInfo(buffer, ctx, SIGTRAP); - return GDB_SendFormattedPacket(ctx, "%shwbreak:;", buffer); + return GDB_SendFormattedPacket(ctx, "%s", buffer); break; }