Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using MAP file VS2010 MFC

I've developed a program by a customer who's experiencing when he do a certain operation. This isn't happening always on the same place and on the same data and, moreover, it is not happening nor in my local developing machine nor in my test Virtual Machine (which is free of all developing equipment).

Given these conditions, I've decided to compile with MAP (enabled in Configuring Properties-> Linker->Debugger with option /MAP) to see which function is causing crash.

If I've correctly understood, when the program crash I've to check down the offset error and then, search in my MAP under the column RVA+BASE:

     Address                         Publics by Value                                      Rva+Base       Lib:Object
 0001:00037af0       ?PersonalizzaPlancia@CDlgGestioneDatiProgetto@MosaicoDialogs@@IAEXXZ 00438af0 f   DlgGestioneDatiProgetto.obj
 0001:00038000       ?SalvaTemporanei@CDlgGestioneDatiProgetto@MosaicoDialogs@@IAEXXZ 00439000 f   DlgGestioneDatiProgetto.obj

Actually, my crash happens at offset:

00038C90
So I should think that it's somewhere in the method:
MosaicoDialogs::CDlgGestioneDatiProgetto::PersonalizzaPlancia

but this is not absolutely possible, so assuming that the computer can't be wrong, I'm the one who's doing it bad.

Can someone explain me how to read MAP in correct way?

like image 751
IssamTP Avatar asked Mar 26 '26 05:03

IssamTP


1 Answers

don't bother - instead, build the project with symbols enabled and strip them into a pdb file.

Modify the program a little, to write a minidump when it crashes using a unhandled exception handler

Give the newly compiled program to the customer, and when it crashes call MiniDumpWriteDump.

Ask the customer to send this .dmp file to you, and you then simply load it up in Visual Studio (or WinDbg) and it will match up the symbols to the program, and will also match up the code. You should be able to see the exact line of code and some of the variables involved. (if using VS, when you load the .dmp file, top right corner will be an option to "start debugging" click that as it will 'start debugging' at the point of the crash)

Try it first locally - put a div by zero error somewhere in your program and see if you can debug the dump after its been run. Note that you must keep the exact same symbol file for each build of your program - they match exactly. You cannot expect a symbol file for one build to match another build, even if nothing changed.

There are tutorials for this kind of thing, such as this one from CodeProject that looks like it describes what you need.

like image 95
gbjbaanb Avatar answered Mar 28 '26 18:03

gbjbaanb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!