Why isn't SymGetSymFromAddr64 working? It returns error code 126

后端 未结 1 385
日久生厌
日久生厌 2021-01-13 15:36

I am trying to capture a stack trace on exceptions using the following code:

#include \"stdafx.h\"
#include 
#include 
#incl         


        
相关标签:
1条回答
  • 2021-01-13 16:23

    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

    0 讨论(0)
提交回复
热议问题