Question

I have the source code to an application which I compiled and gave to a friend. In the application, there is a signal handeler which will save a stack trace to disk (via backtrace or the windows version). After an exception occured and the program saved the stack to disk, my friend gave me a copy of the file and I want to translate the addresses back into symbols. How do I do that?

Was it helpful?

Solution

Without crash dump file it might be difficult, since ASLR (Address Space Layout Randomization) may put code at different addresses every time you start up.

Best way to handle this is to also make a crash dump file, then a debugger (Visual Studio or WinDbg) can translate the addresses back to the correct functions for you. In my own application I create a crash dump file from code whenever I have a crash (look for the function MiniDumpWriteDump in DBGHELP.DLL), but you can also create manually a crash dump of a running application with an external utility (Task Manager from Windows, Process Explorer or ProcDump from SysInternals).

You can then easily load the dump file in the debugger, and use it to translate addresses to function names. E.g. in Visual Studio, open the disassembly window and type the address of a function.

Some other utilities use the same trick. E.g. Very Sleepy CS (https://github.com/CyberShadow/verysleepy) can make a crash dump file while profiling an application in an environment where you don't have the symbols ready. The resolving of addresses to function names is then done afterwards. The addresses are mapped to offsets within DLL's/EXE (by using the crash dump file), and to function names (by using the PDB file).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top