|
1 | 1 | #include "Cafe/OS/common/OSCommon.h"
|
2 | 2 | #include "Common/SysAllocator.h"
|
3 |
| -#include "Cafe/OS/RPL/rpl.h" |
| 3 | +#include "Cafe/OS/RPL/rpl_symbol_storage.h" |
4 | 4 |
|
5 | 5 | #include "Cafe/OS/libs/coreinit/coreinit_Misc.h"
|
6 | 6 |
|
@@ -69,7 +69,7 @@ sint32 ScoreStackTrace(OSThread_t* thread, MPTR sp)
|
69 | 69 | return score;
|
70 | 70 | }
|
71 | 71 |
|
72 |
| -void DebugLogStackTrace(OSThread_t* thread, MPTR sp) |
| 72 | +void DebugLogStackTrace(OSThread_t* thread, MPTR sp, bool printSymbols) |
73 | 73 | {
|
74 | 74 | // sp might not point to a valid stackframe
|
75 | 75 | // scan stack and evaluate which sp is most likely the beginning of the stackframe
|
@@ -107,7 +107,15 @@ void DebugLogStackTrace(OSThread_t* thread, MPTR sp)
|
107 | 107 |
|
108 | 108 | uint32 returnAddress = 0;
|
109 | 109 | returnAddress = memory_readU32(nextStackPtr + 4);
|
110 |
| - cemuLog_log(LogType::Force, fmt::format("SP {0:08x} ReturnAddr {1:08x}", nextStackPtr, returnAddress)); |
| 110 | + |
| 111 | + RPLStoredSymbol* symbol = nullptr; |
| 112 | + if(printSymbols) |
| 113 | + symbol = rplSymbolStorage_getByClosestAddress(returnAddress); |
| 114 | + |
| 115 | + if(symbol) |
| 116 | + 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)); |
| 117 | + else |
| 118 | + cemuLog_log(LogType::Force, fmt::format("SP {:08x} ReturnAddr {:08x}", nextStackPtr, returnAddress)); |
111 | 119 |
|
112 | 120 | currentStackPtr = nextStackPtr;
|
113 | 121 | }
|
|
0 commit comments