c++visual-studiowinapiwindowdebug-symbols

Is it possible to obtain a stack trace on Windows without PDB files present? If yes, how?


I know StackWalk64() API can be used to print call stack in windows. There has been quite a few discussions about how does this work on SO.

Function Call Stack in C++

StackWalk64 on Windows - Get symbol name

StackWalker - Walking the callstack

I observed StackWalk64() requires symbol file(PDB file) to present in order to find out function names. If pdb file is not present symbol info is not printed.

My questions are -

  1. Is my understanding correct ? I don't find this documented.
  2. Is this API exposed for testing/debugging purpose ? How to make it work on
    production systems where pdb files are not present ?
  3. On Linux if symbol file is not present then mangled like call stack printed. At least can it be achieved on windows ?

Solution

  • Answers to your questions -

    1. Is my understanding correct ? I don't find this documented.

    Yes. You need symbols to print function names. No need to have private symbols, public symbols will also work (if you want to ship pdbs).

    2. Is this API exposed for testing/debugging purpose ? How to make it work on production systems where pdb files are not present ?

    This API is mainly for debuggers but it can be used in many tools e.g. Advance task manager which shows thread stack (ProcessExplorer). If you want function names then symbols are required (at least public symbols).

    3. On Linux if symbol file is not present then mangled like call stack printed. At least can it be achieved on windows

    What you can achieve without symbols is - call stack will modulename with offset (from start of module) e.g. xyz.dll+0x62