Sysprogs forums › Forums › VisualGDB › Unable to debug std::map when cmake is configured with flag -std=c++11
- This topic has 26 replies, 3 voices, and was last updated 8 years, 1 month ago by support.
-
AuthorPosts
-
February 8, 2016 at 06:42 #7613supportKeymaster
Good to know it works. Let us know if you encounter further problems.
February 8, 2016 at 14:35 #7617marrtinParticipantThanks, 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?
February 8, 2016 at 16:06 #7618marrtinParticipantMore 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<int, std::string>"> <AlternativeType Name="HandleValueT"/> </Type>
February 8, 2016 at 16:15 #7619marrtinParticipantHi.
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.
February 11, 2016 at 20:13 #7639supportKeymasterHi,
The “AlternativeType” system is not recursive, so the definition in your case should look like this:
<Type Name="std::map<int32_t, std::string>"> <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)?
May 2, 2016 at 21:28 #8152hromainParticipantHi,
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; };
May 6, 2016 at 14:48 #8175marrtinParticipantHi
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.
May 6, 2016 at 19:19 #8176supportKeymasterNo problem, we will add support for querying the underlying type in v5.2.
May 7, 2016 at 10:51 #8177hromainParticipantGreat !
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 8 years, 7 months ago by hromain.
May 7, 2016 at 18:36 #8179supportKeymasterHi,
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).
November 10, 2016 at 09:32 #9458marrtinParticipantHi
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.
November 10, 2016 at 21:16 #9462supportKeymasterHi,
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.
-
AuthorPosts
- You must be logged in to reply to this topic.