Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CaptureStackBackTrace with file information

Tags:

c++

winapi

I'm using CaptureStackBackTrace and SymFromAddr to identify the functions in the callstack. Is there a way to find the source file of each symbol with this (i can't find any documentation for this)? Or i have to use StackWalk ?

like image 463
Raxvan Avatar asked Sep 16 '25 12:09

Raxvan


1 Answers

The solution was to use SymGetLineFromAddr which gives the file path and the line number. In order to do this you must set SYMOPT_LOAD_LINES flag before calling SymInitialize. Also the 3'rd argument of SymGetLineFromAddr must be not NULL, otherwise it will crash.

like image 192
Raxvan Avatar answered Sep 18 '25 10:09

Raxvan