5

I have a crash dump which I'm trying to analyze (VC++ 2010).

I then have a callstack that looks like this (I've trimmed a lot here for readability):

myapp.exe!std::_Tree<std::_Tmap_traits<unsigned int,StructB,std::less<unsigned int> ... >::_Erase(...)
myapp.exe!std::_Tree<std::_Tmap_traits<unsigned int,StructA,std::less<unsigned int>,... >::clear() 

(clear() calls _Erase() )

Note the difference in the template parameter of the value (StructA vs. StructB). Now, I know different methods which have exactly the same binary can have the same symbol in the PDB even though they actually use different code. I assume this is the case here (std::map::_Erase is the same no matter the value type).

But how can I know? Is there a list of stl methods (for this MS implementation) for which this applies? Is it possible it's some sort of a bug?

Update:

Looking into the PDB (in a text editor), I see many std::map<...>::_Erase, and specifically I see them for both StructA and StructB. I don't know if it means anything about the folding.

In addition, the disassembled code of std::map shows a call to an address which is interpreted as std::map. I guess this mean code folding...

Asaf
  • 4,317
  • 28
  • 48
  • Maybe if you'll open your exe/dll with dependency walker you can find all the _Erase symbols and see if there're actually two. I never tried to check it myself, so I can't say from experience if this will be helpful in this case. – selalerer May 07 '13 at 19:43

2 Answers2

1

You can use /OPT:NOICF to disable the code folding behavior.

http://msdn.microsoft.com/en-us/library/bxwfs976%28v=vs.80%29.aspx

StilesCrisis
  • 15,972
  • 4
  • 39
  • 62
  • Thanks. Is there a way to do it postmortem? Or at least get the compiler to print which functions it folded together / skipped folding together? – Asaf May 07 '13 at 19:41
  • @Asaf: The most trustable version is the outer one, since it is the one that most probably have code depending on the real type. At any rate, find the first symbol that is not inside the standard library which hopefully does not use too many different map types. – David Rodríguez - dribeas May 07 '13 at 19:54
0

Well, I ended up rebuilding with creating a map file. In the map file I can see that both methods (_Erase for StructA and _Erase for StructB) have the same address. So it's not a bug.

Asaf
  • 4,317
  • 28
  • 48