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

后端 未结 5 1339
悲哀的现实
悲哀的现实 2020-12-08 00:31

What is the use of .map files VC++ linker produces when /MAP parameter or \"Generate map file\" project setting is used? When do I need them and how do I benefit from them?<

5条回答
  •  爱一瞬间的悲伤
    2020-12-08 00:59

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

    Basically they map memory addresses to functions and variables within the .exe (or .dll). Very useful in general.

    EDIT: The most useful way to debug "after the fact" crashes is using WinDbg for me (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.
    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. See these two 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/

提交回复
热议问题