Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Probable callstack symbolication #11

Open
W-Drew opened this issue Jan 2, 2025 · 0 comments
Open

Probable callstack symbolication #11

W-Drew opened this issue Jan 2, 2025 · 0 comments

Comments

@W-Drew
Copy link

W-Drew commented Jan 2, 2025

CrashLogger only symbolicates the thrown exception -- not the callstack that led to the exception. Example:

Unhandled exception "EXCEPTION_ACCESS_VIOLATION" at 0x7FF9867018CB TrueHUD.dll+00F18CB	movzx eax, byte ptr [rax] |  C:\Git\CommonLibVR\include\REX\REX\EnumSet.h:53 REX::EnumSet<RE::FormType,unsigned char>::get (mangled: ?get@?$EnumSet@W4FormType@RE@@E@REX@@QEBA?AW4FormType@RE@@XZ))

...

PROBABLE CALL STACK:
	[ 0] 0x7FF9867018CB       TrueHUD.dll+00F18CB
	[ 1] 0x7FF9866FC2A4       TrueHUD.dll+00EC2A4
	[ 2] 0x7FF9866FDA9B       TrueHUD.dll+00EDA9B
	[ 3] 0x7FF9866F5494       TrueHUD.dll+00E5494
	[ 4] 0x7FF9866F5474       TrueHUD.dll+00E5474
	[ 5] 0x7FF9866EB3ED       TrueHUD.dll+00DB3ED
	[ 6] 0x7FF667C717B5      SkyrimVR.exe+05117B5 -> 32469+0x4155	mov ebp, eax
	[ 7] 0x7FF667C71BD1      SkyrimVR.exe+0511BD1 -> 32469+0x4571	nop
	[ 8] 0x7FF667D8E9E8      SkyrimVR.exe+062E9E8 -> 37605+0xC58	nop
	[ 9] 0x7FF667D3040D      SkyrimVR.exe+05D040D -> 36016+0xF8D	nop
	[10] 0x7FF667D2A210      SkyrimVR.exe+05CA210 -> 35882+0x16E0	jmp 0x00007FF667D2A1F0
...

However, we have the necessary information to symbolicate callstacks for mods that provide PDBs which we can use in Callstack::print_probable_callstack

a_log.critical(fmt::format(
	" {}+{:07X}\t{} | {})"sv,
	mod->name(),
	reinterpret_cast<std::uintptr_t>(frame.address()) - mod->address(),
	frame.source_file(),
	frame.source_line()
));

Result with local changes:

Unhandled exception "EXCEPTION_ACCESS_VIOLATION" at 0x7FF9858618CB TrueHUD.dll+00F18CB	movzx eax, byte ptr [rax] |  C:\Git\CommonLibVR\include\REX\REX\EnumSet.h:53 REX::EnumSet<RE::FormType,unsigned char>::get (mangled: ?get@?$EnumSet@W4FormType@RE@@E@REX@@QEBA?AW4FormType@RE@@XZ))

...

PROBABLE CALL STACK:
 TrueHUD.dll+00F18CB	C:\Git\CommonLibVR\include\REX\REX\EnumSet.h | 53)
 TrueHUD.dll+00EC2A4	C:\Git\CommonLibVR\include\REX\REX\EnumSet.h | 52)
 TrueHUD.dll+00EDA9B	C:\Git\CommonLibVR\include\RE\T\TESForm.h | 294)
 TrueHUD.dll+00E5494	C:\Git\CommonLibVR\include\RE\F\FormTraits.h | 155)
 TrueHUD.dll+00E5474	C:\Git\CommonLibVR\include\RE\F\FormTraits.h | 150)
 TrueHUD.dll+00DB3ED	C:\Git\TrueHUD\src\HUDHandler.cpp | 43)
...

This makes investigating crash logs much easier, particularly when provided by users who do not have additional debug tools at their disposal.

Is there a technical limitation that prevented this from being included in CrashLogger prior (aside from it only being usable for some callstack frames), or are PRs welcome?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant