Stack Trace Logging (FPlatformStackWalk)¶
This project uses FPlatformStackWalk::StackWalkAndDump for ad-hoc call stack logging.
The correct UE 5.6-compatible pattern is:
#include "HAL/PlatformStackWalk.h"
ANSICHAR StackDump[4096];
FPlatformStackWalk::StackWalkAndDump(StackDump, UE_ARRAY_COUNT(StackDump), 0, nullptr);
UE_LOG(LogOnlineManagerSubsystem, Warning, TEXT("Stack:\n%s"), ANSI_TO_TCHAR(StackDump));
Notes:
- The buffer must be ANSICHAR[] (not TCHAR[]).
- Use UE_ARRAY_COUNT(StackDump) for the buffer length.
- The third argument is IgnoreCount (commonly 0).
- The fourth argument is an optional context pointer (use nullptr unless you need it).
- Convert to TCHAR for UE logging with ANSI_TO_TCHAR.
Common mistakes that cause build errors:
- Passing nullptr as the buffer or using TCHAR buffer.
- Using the wrong parameter order or missing arguments.
If you want to log in narrow/ANSI directly, you can also use UE_LOG with *FString(ANSI_TO_TCHAR(...)) as above.