Unable to debug std::map when cmake is configured with flag -std=c++11

Sysprogs forums Forums VisualGDB Unable to debug std::map when cmake is configured with flag -std=c++11

Viewing 12 posts - 16 through 27 (of 27 total)
  • Author
    Posts
  • #7613
    support
    Keymaster

    Good to know it works. Let us know if you encounter further problems.

    #7617
    marrtin
    Participant

    Thanks, works for me in VS 2015. Is there any chance that  in the future will be possible to use this feature without using .natvis file?

    #7618
    marrtin
    Participant

    More complicated typedef still didn’t work

    typedef int int32_t;
    typedef std::map< int32_t, std::string > HandleValueT;
    
    
    .natvis
    
    
    
    <Type Name="int">
    	<AlternativeType Name="int32_t"/>
    </Type>
    <Type Name="std::map&lt;int, std::string&gt;">
    	<AlternativeType Name="HandleValueT"/>
    </Type>
    
    
    
    		
    	
    #7619
    marrtin
    Participant

    Hi.

    Maybe the problem could be cause when these objects (HandleValueT) are coming as input parameters from external library via dbus and then could be not parsed correct.

    But thats only my hint (maybe totally bad). I don’t know how the visualisers work internally.

    #7639
    support
    Keymaster

    Hi,

    The “AlternativeType” system is not recursive, so the definition in your case should look like this:

      <Type Name="std::map&lt;int32_t, std::string&gt;">
        <AlternativeType Name="HandleValueT"/>
      </Type>

    We have just retested it on a simple MinGW project. What does the GDB session window show when you try evaluating your variable? Does it show any errors (you need to switch it to the “All GDB interaction” mode)?

    #8152
    hromain
    Participant

    Hi,

    I would be happy if you add a full typedef support like in QTcreator in the next release.

    The workaround with the “AlternativeType” in a natvis cannot be used in our project, because we use a lot of template classes with typedefs inside.

    example :

    template<class T>
    class C
    {
      typedef std::map<int, T> Map;
    };

     

    #8175
    marrtin
    Participant

    Hi

    Of course natvis approach cannot be used as universal solution. In large projects there are a lot of typedefs (also in my case). I also hope that next release will fix it problem. Sometimes I have to switched sometimes to eclipse or Qt creator for debugging purposes. It’s waste of time, because Visual studio with VisualGDB is very powerful tool.

    #8176
    support
    Keymaster

    No problem, we will add support for querying the underlying type in v5.2.

    #8177
    hromain
    Participant

    Great !

    An other case to solve about types, which do not occurs in QTCreator :

    class A {};
    class B : public class A { std::string foo; };
    A* obj = new B;

    In this case, we see obj at a A object instead of B, and naturally we don’t see the foo variable in the object watch.

    • This reply was modified 7 years, 11 months ago by hromain.
    #8179
    support
    Keymaster

    Hi,

    GDB can do that (and will do it automatically with VisualGDB as well) if the A class contains virtual methods. Otherwise it simply cannot determine the type of the object from the base pointer (even under Qt Creator).

    #9458
    marrtin
    Participant

    Hi

    In my new version 5.2 the debugging of std::map works better – (thanks for it, it really helps), but it is still not so good in comparison with windows development. Do you plan some improvements in the future? When there is map of maps or such more complex  structures. In such cases would be debugging very useful.

    #9462
    support
    Keymaster

    Hi,

    VisualGDB supports STL containers out-of-the-box and provides 2 mechanisms to support custom structures:

    If you believe some of those are not working properly, feel free to start another topic with details and we will investigate.

Viewing 12 posts - 16 through 27 (of 27 total)
  • You must be logged in to reply to this topic.