coreinit: Always try to print symbols for PPC stack traces

This commit is contained in:
Exzap 2026-04-29 22:32:06 +02:00
parent 4051683973
commit 0b661488d7
4 changed files with 6 additions and 11 deletions

View File

@ -69,7 +69,7 @@ sint32 ScoreStackTrace(OSThread_t* thread, MPTR sp)
return score;
}
void DebugLogStackTrace(OSThread_t* thread, MPTR sp, bool printSymbols)
void DebugLogStackTrace(OSThread_t* thread, MPTR sp)
{
// sp might not point to a valid stackframe
// 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)
}
}
if (highestScoreSP != sp)
cemuLog_log(LogType::Force, fmt::format("Trace starting at SP {0:08x} r1 = {1:08x}", highestScoreSP, sp));
else
cemuLog_log(LogType::Force, fmt::format("Trace starting at SP/r1 {0:08x}", highestScoreSP));
cemuLog_log(LogType::Force, fmt::format("Trace starting at SP {:08x} r1={:08x}", highestScoreSP, sp));
// print stack trace
uint32 currentStackPtr = highestScoreSP;
@ -108,9 +105,7 @@ void DebugLogStackTrace(OSThread_t* thread, MPTR sp, bool printSymbols)
uint32 returnAddress = 0;
returnAddress = memory_readU32(nextStackPtr + 4);
RPLStoredSymbol* symbol = nullptr;
if(printSymbols)
symbol = rplSymbolStorage_getByClosestAddress(returnAddress);
RPLStoredSymbol* symbol = rplSymbolStorage_getByClosestAddress(returnAddress);
if(symbol)
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));

View File

@ -95,7 +95,7 @@ void ExceptionHandler_LogGeneralInfo()
MPTR currentStackVAddr = hCPU->gpr[1];
CrashLog_WriteLine("");
CrashLog_WriteHeader("PPC stack trace");
DebugLogStackTrace(currentThread, currentStackVAddr, true);
DebugLogStackTrace(currentThread, currentStackVAddr);
// stack dump
CrashLog_WriteLine("");

View File

@ -624,7 +624,7 @@ inline uint32 GetTitleIdLow(uint64 titleId)
#include "Cafe/HW/Espresso/PPCCallback.h"
// PPC stack trace printer
void DebugLogStackTrace(struct OSThread_t* thread, MPTR sp, bool printSymbols = false);
void DebugLogStackTrace(struct OSThread_t* thread, MPTR sp);
// generic formatter for enums (to underlying)
template <typename Enum>

View File

@ -272,7 +272,7 @@ void DebugPPCThreadsWindow::RefreshThreadList()
void DebugPPCThreadsWindow::DumpStackTrace(OSThread_t* thread)
{
cemuLog_log(LogType::Force, "Dumping stack trace for thread {0:08x} LR: {1:08x}", memory_getVirtualOffsetFromPointer(thread), _swapEndianU32(thread->context.lr));
DebugLogStackTrace(thread, _swapEndianU32(thread->context.gpr[1]), true);
DebugLogStackTrace(thread, _swapEndianU32(thread->context.gpr[1]));
}
void DebugPPCThreadsWindow::PresentProfileResults(OSThread_t* thread, const std::unordered_map<VAddr, uint32>& samples)