Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

How to debug stl containers in exported classes in 2012?

$
0
0

Hi there.

After we moved to 2012, we can no longer debug some exported classes which have an stl container inside.

I'm posting this because I'm interested in the correct solution, and if others run into this, I have a hack solution (near the bottom).

a.dll -> exports 

class A {
  std::map<c,d> props;
  int v;
};

(yeah, I know the implications of exporting classes with stl containers in them, these dlls are only shared between our executables)

while debugging in b.dll, when I step into a function which has an instance of A, I can see a.v, but a.props shows as {...} instead of the expected {size=1}, and if I expand a.props I see a map without the visualizer (similar to watching "a.props,!"), but drilling into the tree itself I can't really see any of the data.

Our project is quite complicated with hundreds of dlls and unfortunately I couldn't reproduce the issue with a smaller test app/dlls -- it worked fine, which suggests that I'm missing something, I just don't know what at the moment.

More details which may provide some clues:

  1. in the test app, I had to export the template (extern template declspec(export) std::map<c,d>) to get it to debug correctly, but I do this in the real app too.
  2. if I create an instance of that stl map in b.dll, I can debug it perfectly!  

For now, I've added a hack to the header file where I declare class A: an inline function in an anonymous namespace that simple creates an instance of that map.  I never call the function.

I would prefer to remove the hack and understand what's going on, so any ideas are much appreciated.

Thanks!


Viewing all articles
Browse latest Browse all 21115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>