What's the use of .map files the linker produces?

A nice article on how to use map files for finding crashes.

http://www.codeproject.com/KB/debug/mapfile.aspx

Manually doing all this is very uninteresting.

I am not aware of any tools which can read map file and help in finding the crash location. If anybody knows please update us.


For embedded systems, map files are a lot more useful. (Although you wouldn't be using Visual C++ for that ;)

Things like knowing how close you are to running out of program/data memory, and what location a particular variable resides in, are important.


WinDBG uses .map and .pdb files to help debug crashes, when analysing .hdmp and .mdmp crash dumps.

Basically they map memory address offsets to functions and variables within the .exe (and/or loaded .dlls). Very useful in general if you need to figure out why a customer is upset. Even more useful when they prove it was not your fault.

The most useful way to debug "post-mortem" crashes is using WinDbg (Windows platform). Open it up, and open the crash dump. Then set the source path to point at the code (if you have it), the symbol path to point at your .map and .pdb and the image path to the .exe, and type "!analyse -v" in the command line. Now you have a full stack trace with lines of code and everything. Of course you need to have the correct version of the source code for the version of the exe's and DLLs you are debugging.

It's even better if you have the MS symbol server in the path, and if the full page heap was turned on or adplus was running. With ADPlus in particular you will likely have variable values captured as well.

Some favourite WinDbg resources of mine:
First stop :: http://www.microsoft.com/whdc/devtools/debugging/debugstart.mspx
Force load the symbols :: http://www.osronline.com/ShowThread.cfm?link=182377
Useful site :: http://www.dumpanalysis.org/blog/index.php/category/windbg-tips-and-tricks/page/7/