Skip to content

Commit b2f8567

Browse files
committed
coreinit: Always try to print symbols for PPC stack traces
1 parent 74302eb commit b2f8567

4 files changed

Lines changed: 6 additions & 11 deletions

File tree

src/Cafe/OS/libs/coreinit/coreinit.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ sint32 ScoreStackTrace(OSThread_t* thread, MPTR sp)
6969
return score;
7070
}
7171

72-
void DebugLogStackTrace(OSThread_t* thread, MPTR sp, bool printSymbols)
72+
void DebugLogStackTrace(OSThread_t* thread, MPTR sp)
7373
{
7474
// sp might not point to a valid stackframe
7575
// scan stack and evaluate which sp is most likely the beginning of the stackframe
@@ -88,10 +88,7 @@ void DebugLogStackTrace(OSThread_t* thread, MPTR sp, bool printSymbols)
8888
}
8989
}
9090

91-
if (highestScoreSP != sp)
92-
cemuLog_log(LogType::Force, fmt::format("Trace starting at SP {0:08x} r1 = {1:08x}", highestScoreSP, sp));
93-
else
94-
cemuLog_log(LogType::Force, fmt::format("Trace starting at SP/r1 {0:08x}", highestScoreSP));
91+
cemuLog_log(LogType::Force, fmt::format("Trace starting at SP {:08x} r1={:08x}", highestScoreSP, sp));
9592

9693
// print stack trace
9794
uint32 currentStackPtr = highestScoreSP;
@@ -108,9 +105,7 @@ void DebugLogStackTrace(OSThread_t* thread, MPTR sp, bool printSymbols)
108105
uint32 returnAddress = 0;
109106
returnAddress = memory_readU32(nextStackPtr + 4);
110107

111-
RPLStoredSymbol* symbol = nullptr;
112-
if(printSymbols)
113-
symbol = rplSymbolStorage_getByClosestAddress(returnAddress);
108+
RPLStoredSymbol* symbol = rplSymbolStorage_getByClosestAddress(returnAddress);
114109

115110
if(symbol)
116111
cemuLog_log(LogType::Force, fmt::format("SP {:08x} ReturnAddr {:08x} ({}.{}+0x{:x})", nextStackPtr, returnAddress, (const char*)symbol->libName, (const char*)symbol->symbolName, returnAddress - symbol->address));

src/Common/ExceptionHandler/ExceptionHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void ExceptionHandler_LogGeneralInfo()
9595
MPTR currentStackVAddr = hCPU->gpr[1];
9696
CrashLog_WriteLine("");
9797
CrashLog_WriteHeader("PPC stack trace");
98-
DebugLogStackTrace(currentThread, currentStackVAddr, true);
98+
DebugLogStackTrace(currentThread, currentStackVAddr);
9999

100100
// stack dump
101101
CrashLog_WriteLine("");

src/Common/precompiled.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ inline uint32 GetTitleIdLow(uint64 titleId)
624624
#include "Cafe/HW/Espresso/PPCCallback.h"
625625

626626
// PPC stack trace printer
627-
void DebugLogStackTrace(struct OSThread_t* thread, MPTR sp, bool printSymbols = false);
627+
void DebugLogStackTrace(struct OSThread_t* thread, MPTR sp);
628628

629629
// generic formatter for enums (to underlying)
630630
template <typename Enum>

src/gui/wxgui/windows/PPCThreadsViewer/DebugPPCThreadsWindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ void DebugPPCThreadsWindow::RefreshThreadList()
272272
void DebugPPCThreadsWindow::DumpStackTrace(OSThread_t* thread)
273273
{
274274
cemuLog_log(LogType::Force, "Dumping stack trace for thread {0:08x} LR: {1:08x}", memory_getVirtualOffsetFromPointer(thread), _swapEndianU32(thread->context.lr));
275-
DebugLogStackTrace(thread, _swapEndianU32(thread->context.gpr[1]), true);
275+
DebugLogStackTrace(thread, _swapEndianU32(thread->context.gpr[1]));
276276
}
277277

278278
void DebugPPCThreadsWindow::PresentProfileResults(OSThread_t* thread, const std::unordered_map<VAddr, uint32>& samples)

0 commit comments

Comments
 (0)