I am trying to capture a stack trace on exceptions using the following code:
#include \"stdafx.h\"
#include
#include
#incl
Had the same problem with your code.
Fixed it with:
HANDLE process = GetCurrentProcess();
SymInitialize( process,NULL,TRUE );
Note: now, the SymGetLineFromAddr64
fails for some big address, with error 487 (ERROR_INVALID_ADDRESS
)
Use the following for tracing:
printf("Error from SymGetLineFromAddr64: %lu for address 0x%I64x.\n",
GetLastError(),
frame.AddrPC.Offset);
EDIT: when I use the Go to Disassembly in my Visual Studio and enter the fist address which make SymGetLineFromAddr64
fail (here, it's 0x000000005a03da08
), it shows the source code for:
f:\dd\vctools\crt_bld\self_x86\crt\prebuild\eh\throw.cpp