all repos — mgba @ 41211639ba654e54ad1a1212682e4f829f3aad33

mGBA Game Boy Advance Emulator

Stack traces: fix flipped variables that cause a crash
Adam Higerd chighland@gmail.com
Mon, 03 Aug 2020 20:29:14 -0500
commit

41211639ba654e54ad1a1212682e4f829f3aad33

parent

c6ca0d25c01f1b65a2d90636e5b550eee27a545e

1 files changed, 2 insertions(+), 2 deletions(-)

jump to
M src/debugger/stack-trace.csrc/debugger/stack-trace.c

@@ -84,7 +84,7 @@ }

const char* functionName = mDebuggerSymbolReverseLookup(st, stackFrame->entryAddress, stackFrame->entrySegment); if (functionName) { written += snprintf(out + written, *length - written, "%s ", functionName); - } else if (prevFrame->entrySegment >= 0) { + } else if (stackFrame->entrySegment >= 0) { written += snprintf(out + written, *length - written, "0x%02X:%08X ", stackFrame->entrySegment, stackFrame->entryAddress); } else { written += snprintf(out + written, *length - written, "0x%08X ", stackFrame->entryAddress);

@@ -111,7 +111,7 @@ if (offset >= 0) {

functionName = mDebuggerSymbolReverseLookup(st, prevFrame->entryAddress, prevFrame->entrySegment); if (functionName) { written += snprintf(out + written, *length - written, " [%s+%d]", functionName, offset); - } else if (stackFrame->entrySegment >= 0) { + } else if (prevFrame->entrySegment >= 0) { written += snprintf(out + written, *length - written, " [0x%02X:%08X+%d]", prevFrame->entrySegment, prevFrame->entryAddress, offset); } else { written += snprintf(out + written, *length - written, " [0x%08X+%d]", prevFrame->entryAddress, offset);