Stack traces: fix flipped variables that cause a crash

This commit is contained in:
Adam Higerd 2020-08-03 20:29:14 -05:00 committed by Vicki Pfau
parent c6ca0d25c0
commit 41211639ba
1 changed files with 2 additions and 2 deletions

View File

@ -84,7 +84,7 @@ void mStackTraceFormatFrame(struct mStackTrace* stack, struct mDebuggerSymbols*
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 @@ void mStackTraceFormatFrame(struct mStackTrace* stack, struct mDebuggerSymbols*
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);