Dumping a stack trace from C++ (Windows) - fails to find symbols

Tim Cooper

I'm a developer of Windows desktop software, and from time to time our app crashes. In rare cases I'd like to get a customer to run a debug version of the app to send me a stack trace so I know where it crashed. I followed the instructions in here:

Windows C++ stack trace from a running app

...but while it works on my development machine, it doesn't work on any client machine or those of my colleagues, who don't have Visual Studio installed. So I presume that there's some .dll or something they need before it'll work. They're using the same .exe I'm using, i.e. the one I compiled in VC++ in debug mode.

After some painstaking "message window" debugging, I learnt it's failing in SymGetSymFromAddr64() - this returns FALSE. But when I walk the stack, this always returns FALSE or it returns garbage that doesn't make sense (random unrelated method names), as if it's the PC values which are invalid, not the mapping process. To reiterate, it's a debug mode .exe that produces a perfect symbolic stack trace on my development machine.

I did some research and found some mentions of "dbghelp.dll" and "imagehlp.dll" but I just ended up confused. "dbghelp.dll" ships with all versions of Windows, but with reduced functionality. There's some other things I could install, but it's a little scary to be installing some Windows "WDK" or "debug kits" which might overwrite important system .dll's or do god-knows-what to your computer.

So what I need to know is: "what's the simplest set of instructions I can give to these helper customers e.g. the minimum set of .dll's and where to stick them so that we can get proper symbolic information out of the stack traces when our program crashes?"

Tim Cooper

The most likely reason for failing to find the symbols is that the .pdb file cannot be found. Even if you generate a .exe in debug mode, the symbols are not in the .exe, they are in the .pdb file. Through a lot of empirical testing, it seems that the process has the pathname of the .pdb hardcoded in it, so if your clients don't have that file at that location, they won't necessarily find it. However, you can supply a "search path" to the SymInitialize() function - a folder or set of folders to use to search for the .pdb file.

In my configuration, I had an exe called "Edval.exe" and a .pdb called "DebugEdval.pdb". The process searches for "DebugEdval.pdb" in the search folders. This corresponds to what you've configured in "Properties > Linker > Debugging > Generate Program Database File".

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Android phone not dumping stack trace

From Dev

Android phone not dumping stack trace

From Dev

Dumping only stack trace in linux core dumps

From Dev

How to find calling thread stack trace from breakpoint?

From Dev

C mxe linking fails: ld cannot find symbols

From Dev

cygwin_exception::open_stackdumpfile: Dumping stack trace to cscope.exe.stackdump

From Dev

How to Find the Source of an NSInternalInconsistencyException in an Xcode Stack Trace

From Dev

Unable to find android NDK stack-trace

From Dev

Cant find the cause of my crash with this stack trace

From Dev

Stack trace in running program (pstack equivalent in Windows)

From Dev

Stack Trace completely missing from rails server in git bash terminal for windows

From Dev

Is there a way to extract actual call stack addresses from a Windows Performance Recorder trace (WPR)?

From Dev

How to get the .NET exception message and stack trace from a failing Windows Service?

From Dev

How to obtain a full stack trace when test fails with an error?

From Dev

python - going from a stack trace to a tree

From Dev

Finding the Stack Trace Log from an EXE that crashes

From Dev

Oracle datatype for C# storing stack trace

From Dev

Qt C++ Unhandled exceptions stack trace

From Dev

Getting stack offsets of variables from debugging symbols

From Dev

Dumping a windows hibernation in ubuntu

From Dev

Dumping a windows hibernation in ubuntu

From Dev

Fast capture stack trace on windows / 64-bit / mixed mode

From Dev

How do you get the JavaScript stack trace from Nashorn?

From Dev

Is it possible to extract locals and their values from a stack trace in Ruby?

From Dev

How to display entire stack trace for thrown exceptions from ScalaCheck tests?

From Dev

Java - how to get the stack trace from before a Runnable?

From Dev

How can I extract local variables from a stack trace?

From Dev

Migration from ASP.NET 3.1 to 5.0 stack trace error

From Dev

Migration from ASP.NET 3.1 to 5.0 stack trace error

Related Related

  1. 1

    Android phone not dumping stack trace

  2. 2

    Android phone not dumping stack trace

  3. 3

    Dumping only stack trace in linux core dumps

  4. 4

    How to find calling thread stack trace from breakpoint?

  5. 5

    C mxe linking fails: ld cannot find symbols

  6. 6

    cygwin_exception::open_stackdumpfile: Dumping stack trace to cscope.exe.stackdump

  7. 7

    How to Find the Source of an NSInternalInconsistencyException in an Xcode Stack Trace

  8. 8

    Unable to find android NDK stack-trace

  9. 9

    Cant find the cause of my crash with this stack trace

  10. 10

    Stack trace in running program (pstack equivalent in Windows)

  11. 11

    Stack Trace completely missing from rails server in git bash terminal for windows

  12. 12

    Is there a way to extract actual call stack addresses from a Windows Performance Recorder trace (WPR)?

  13. 13

    How to get the .NET exception message and stack trace from a failing Windows Service?

  14. 14

    How to obtain a full stack trace when test fails with an error?

  15. 15

    python - going from a stack trace to a tree

  16. 16

    Finding the Stack Trace Log from an EXE that crashes

  17. 17

    Oracle datatype for C# storing stack trace

  18. 18

    Qt C++ Unhandled exceptions stack trace

  19. 19

    Getting stack offsets of variables from debugging symbols

  20. 20

    Dumping a windows hibernation in ubuntu

  21. 21

    Dumping a windows hibernation in ubuntu

  22. 22

    Fast capture stack trace on windows / 64-bit / mixed mode

  23. 23

    How do you get the JavaScript stack trace from Nashorn?

  24. 24

    Is it possible to extract locals and their values from a stack trace in Ruby?

  25. 25

    How to display entire stack trace for thrown exceptions from ScalaCheck tests?

  26. 26

    Java - how to get the stack trace from before a Runnable?

  27. 27

    How can I extract local variables from a stack trace?

  28. 28

    Migration from ASP.NET 3.1 to 5.0 stack trace error

  29. 29

    Migration from ASP.NET 3.1 to 5.0 stack trace error

HotTag

Archive