tags:

views:

17

answers:

1

On Windows if there is no symbols for a module involved in a callstack, say of a crash dump, then all the call below that module in the callstack would be wrong (not only the names are missed, but also the sequence).

On Linux or Mac OS X, if symbols are absent, the function names are not shown, but the call sequence are still remain.

What difference in the mechanism of callstack unwind or symbol generation cause such difference?

+1  A: 

In Windows it is still possible to get the full call stack for applications without symbol information, provided 'stack frame pointers' are put on the call stack. These stack frame pointers are generated by the Visual Studio compiler if you compile with debug, but not if you compile with optimization (/Ox). Therefore, if you still want the stack frame pointers with optimization, you have to add the /Oy- compiler option (Oy- stands for: don't remove the stack frame pointers).

The stack frame pointers do nothing more than just point to the next stack frame. Therefore, debuggers and crash-handlers can easily get the stack (by looking at the stack frame pointers to follow the stack, and using the return addresses on the stack).

If the application has no stack frame pointers, the debugger or crash-handler has to use the debug information to know the number of function arguments, the number of local variables, ... in order to get the size of each stack frame and to follow all the stack frames on the call stack.

Patrick