Debugger variables issues
Hello,
I am using Clion version 1.2 and I got some problem with showing variables in debugger, especially nested variables:
Debugger is showing this : "-var-create: unable to create variable object".
I found something about this issue here:
https://sysprogs.com/w/forums/topic/var-create-unable-to-create-variable-object/
But I am not sure if this is my problem, and I have absolutely no idea how to reslove this, since I am nut sure whether I am using gcc or g++. If I open CMake -> Cache, I can see that CMAKE_CXX_COMPILER is set to /usr/bin/c++.
I do not know wether this is g++ or gcc. And I have no idea how to use flag -gdwarf-2, not even what it means. Please do you know what could I do so my debugger can show nested variables, like inner structure inside some object ? Thank you very much. This is practically the last issue, which prevents me from working in Clion.
Thank you very much for your patience.
请先登录再写评论。
Hi Lukáš.
There are some problems with opening screenshot but I suppose that if you add the following lines into your CMake file:
the problem may disappear. Does that help?
I tried that, it did not help. I attach the file, because its not working as an image, I do not know why.
EDIT:
I read about that bug you posted, but I am not sure I am using g++. When I change CMAKE_CXX_COMPILER in CMake -> Cache from c++ to g++, debugger is not working at all i.e.: it will not stop at any breakpoint, like I just run it without debugging.
And next thing I noticed, in the bug tracker, there is written this bug has something to do with STL. The variable in the screenshot, which is not showing correctly is inside object of custom class. It is not from STL. So I am not sure where is the root of this problem, neither how to solve it.
Thank you very much for your time and patience.
EDIT1:
I added also screen of CMakeLists.txt and CMake Cache. Maybe something from it will be helpful.
Attachment(s):
Screenshot from 2015-12-15 09:47:21.png
Screenshot from 2015-12-15 19:55:13.png
You can determine which compiler version you are using via the following command in terminal:
Also changing compiler via changing flags in CMake cache is an incorrect way. CMake documentation states it should be avoided, as the CMake cache cab be invalidated and/or there can be other dependencies to the current compiler in the other cmake cache values.
Please try to use method #2 from http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F pass
to Preferences (Settings) | Build, Execution, Deployment | CMake | CMake options.
Then corresponding CMake cache variables will be overwritten respectively.
Ok, so, now I now I am using g++ 4.8.4 version. I tried to change this to GCC, and added this flag:
"-lstdc++"
Then I got so much errors in building process. For example this:
undefined reference to std::cout
It looks like there is not
-lstdc++, but it is. I am not sure I wrote it correctly. I am not very good with CMakeLists.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -lstdc++")
This is coppied from my Clion.
Maybe, if it could compile with gcc -gdwarf could help.
In the link I wrote in the first post is something like this:
"In my case, I built my project with GCC-4.8 and tried to debug with GCC-4.6. That was the problem."
Maybe this could be problem, except I am using g++, not gcc. But I have no idea, where to find, what version of g++ is used for debugging. But I do not know how could be used other than 4.8.4, because in my /usr/bin is just version 4.8.4.
Debugger shows correctly elements in vector and entire vector, but object of my custom class, which contains objects of my another custom class is not shown correctly. It is class tree and it contains pointer to object of class node. Maybe that is the problem. Second attribute of tree class is comparator and that is not a pointer. It is value and it is shown correctly as you can see on the screenshot.
Thank very much you for your help.
Attachment(s):
Screenshot from 2015-12-16 12:23:51.png
G++ means GCC compiler for С++, so you don't need to add this tag in your CMakeLists. Please send us a stand-alone example so we can reproduce the issue on our side. Also please specify which OS you are using?
I am using Linux Mint 17.2 Cinnamon edition 64-bit, and I also tried it on windows 10 64-bit with the same problem. I can send you my project, which is pretty small, but I do not want to send it publically on this forum, so any one will have access to this. I can sned it to some email or whatever.
Please send it to clion-support at jetbrains.com.
Sent to
clion-support@jetbrains.com.Has there been any development in this case ? I still cannot figure out how to correctly view variable, when it is pointer inside the object.
I have exactly the same problem. It turns out that it is also with a std::string. I also noticed something: if I add my string to Watches, the value is good in this section (but still not in "Variables") [see screenshots 1 and 2].
The same thing happens if I put my mouse on the object in question, the value displayed in the popup is good but the one in the "Variables" section is incorrect [see screenshot 3].
Any improvement ?
Léonard, we have the issue in our tracker: https://youtrack.jetbrains.com/issue/CPP-5504. Feel free to comment or upvote.
Lukáš, sorry for the delay. We are analyzing your project. I will write you as soon as we understand the problem.
Lukáš, I've created the issue in our tracker: https://youtrack.jetbrains.com/issue/CPP-6016. Please follow in case some additional information will be needed.
Léonard, CPP-5504 has been fixed in the latest CLion 2016.2 EAP. We'd like to ask you to give this EAP build a try and share if the problems you've experience with CLion's debugger are fixed. We'll appreciate your feedback greatly.
Please, find more details in our blog post by the link: http://blog.jetbrains.com/clion/2016/06/clion-2016-2-eap-debugger/.