rust-lang / backtrace-rs

Backtraces in Rust

Home Page:https://docs.rs/backtrace

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feature request: module name and rva offsets

shevernitskiy opened this issue · comments

I am developing dll, which injects into main process. As a side effect it provides crash report functionality.

While app crashing, it is necessary to know in which module it crashed. RVA will be handy in case of reversing main app with IDA or so.

For example, C++ std::stacktrace::current() output:

0> dfint_hook!NullExport+0x21BA7
1> KERNELBASE!UnhandledExceptionFilter+0x1E7
2> ntdll!memset+0x13B0
3> ntdll!_C_specific_handler+0x96
4> ntdll!_chkstk+0x11F
5> ntdll!RtlRaiseException+0x434
6> ntdll!KiUserExceptionDispatcher+0x2E
7> dfint_hook!NullExport+0x1EF64
8> Dwarf_Fortress+0x2F3BEA
9> Dwarf_Fortress+0x29D076
10> Dwarf_Fortress+0x59D82B
11> Dwarf_Fortress+0x7863A8
12> Dwarf_Fortress+0x5C3E07
13> Dwarf_Fortress+0x5C4AE9
14> SDL!SDL_KillThread+0x71
15> SDL!SDL_SemWaitTimeout+0x85
16> ucrtbase!configthreadlocale+0x92
17> KERNEL32!BaseThreadInitThunk+0x14
18> ntdll!RtlUserThreadStart+0x21
commented

Would frame.symbol_address() - frame.ip() and frame.module_base_address().unwrap() - frame.ip() work?

the second one works, but it is not RVA... this is example with ip - module_base_address (another cause, but with some same system calls)

1: backtrace::backtrace::trace::ha542dd0000ec3f1e + 0x104D7
2: dfint_hook::crash::handler::h008202f291f32902 + 0xBE00
3: UnhandledExceptionFilter + 0x15B7DC
4: RtlMoveMemory + 0xA837D
5: _C_specific_handler + 0x8EFA7
6: _chkstk + 0xA3CFF
7: RtlFindCharInUnicodeString + 0x1E456
8: KiUserExceptionDispatcher + 0xA2CEE
9:> strlen + 0x2CA21
10: dfint_hook::crash::handler::h008202f291f32902 + 0xD3B3
11: unknown + 0x49E5A2
12: unknown + 0x4A1063
13: unknown + 0xF92634
14: unknown + 0x561A2E
15: unknown + 0x87E1C6
16: unknown + 0x5C3FE8
17: unknown + 0x5C4AE9
18: SDL_KillThread + 0xE471
19: SDL_SemWaitTimeout + 0xE855
20: recalloc + 0x29363
21: BaseThreadInitThunk + 0x126AD
22: RtlUserThreadStart + 0x5A9F8