Inspecting STL containers with GDB pretty print [message #1230331] |
Sat, 11 January 2014 17:47  |
Eclipse User |
|
|
|
Hi all,
I'm trying to setup Eclipse to work with GDB stl pretty print. I have followed basic instructions, checkouted latest version of python prettyprinters from GNU website and inserted needed settings into .gdbinit.
Pretty printer works perfectly in standalone gdb. However when I try to debug the same simple testing application in Eclipse, it works only sometimes. The debugging fails very often with following output on the gdb console.
The target endianness is set automatically (currently little endian)
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
/home/zumbi/gdb-7.6.1/gdb/varobj.c:3532: internal-error: c_value_of_variable: Assertion `!value_lazy (var->value)' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) [answered Y; input not from terminal]
/home/zumbi/gdb-7.6.1/gdb/varobj.c:3532: internal-error: c_value_of_variable: Assertion `!value_lazy (var->value)' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) [answered Y; input not from terminal]
Does anyone have similar problem and know a solution?
Described situation is happening on Debian Jessie x64, GCC 4.8, GDB 7.6, Eclipse Kepler
BR
Jan
[Updated on: Sun, 12 January 2014 08:26] by Moderator Report message to a moderator
|
|
|
Re: Inspecting STL containers with GDB pretty print [message #1230668 is a reply to message #1230331] |
Sun, 12 January 2014 19:00   |
Eclipse User |
|
|
|
Hi,
today I discovered that the problem described in previous post is connected with using the std::list container.
Here is the minimal example that causes the problem. I have tried it on Debian jessie and Ubuntu 12.04. GDB in 80% of tries fails. It surprises me that standalone gdb in command line works well.
#include <list>
int main()
{
list<int> x;
list<int> y;
x.push_back(1);
x.push_back(2);
y.push_back(1);
y.push_back(1);
return 0;
}
thanks
Jan
|
|
|
|
Re: Inspecting STL containers with GDB pretty print [message #1231376 is a reply to message #1230986] |
Tue, 14 January 2014 14:11   |
Eclipse User |
|
|
|
Marc Khouzam wrote on Mon, 13 January 2014 09:32
Can you give the steps to reproduce the crash?
Hi Marc,
surprisingly today it was not easy to me to reproduce the bug again. At last I have discovered that using following code
#include <list>
using namespace std;
struct Foo {
int x;
int y;
};
int main()
{
list<int> x;
list<int> y;
list<Foo> z;
x.push_back(1);
x.push_back(2);
y.push_back(1);
y.push_back(1);
z.push_back(Foo{1,0});
z.push_back(Foo{1,0});
return 0;
}
these steps lead to GDB crash in more that 50% of tries.
Variables or Expressions view has to be visible.
1. Set the breakpoint to the line with return
2. Start debug session
3. Run the application
4. GDB fails with returning -1, traces are attached as traces_log1
or
1. Start debug session
2. Step through the program
3. GDB hangs when accessing second or third line of the main(), traces are attached as traces_log2
I will try to reproduce it with GDB itself later this week.
thanks
Jan
Attachment: traces_log1
(Size: 21.61KB, Downloaded 295 times)
Attachment: traces_log2
(Size: 23.80KB, Downloaded 304 times)
[Updated on: Tue, 14 January 2014 14:11] by Moderator Report message to a moderator
|
|
|
Re: Inspecting STL containers with GDB pretty print [message #1231787 is a reply to message #1231376] |
Wed, 15 January 2014 11:59   |
Eclipse User |
|
|
|
I can reproduce the crash as well. In fact, I see it with the simpler program below. It looks like we need two lists to crash GDB.
This should be reported to the GDB community.
#include <list>
using namespace std;
int main()
{
list<int> x;
list<int> y;
x.push_back(1);
y.push_back(2);
return 0;
}
|
|
|
|
|
Re: Inspecting STL containers with GDB pretty print [message #1232265 is a reply to message #1231816] |
Thu, 16 January 2014 14:50   |
Eclipse User |
|
|
|
I can crash it from the command line. The minimal set of commands is below. Start gdb like this:
Then copy paste the below after you put in your own gdbinit file and executable path:
-enable-pretty-printing
-gdb-set print object on
source /home/lmckhou/prettyPrint/gdbinit
-file-exec-and-symbols --thread-group i1 /home/lmckhou/testing/test
-break-insert --thread-group i1 -f /home/lmckhou/testing/test.cc:12
-break-insert --thread-group i1 -t -f main
-exec-run --thread-group i1
-var-create --thread-group i1 - * x
-var-create --thread 1 --frame 0 - * x
-var-list-children var2
-exec-continue --thread 1
-var-update 1 var2
|
|
|
Re: Inspecting STL containers with GDB pretty print [message #1232568 is a reply to message #1232265] |
Fri, 17 January 2014 08:21   |
Eclipse User |
|
|
|
Marc Khouzam wrote on Thu, 16 January 2014 15:50I can crash it from the command line. The minimal set of commands is below. Start gdb like this:
Then copy paste the below after you put in your own gdbinit file and executable path:
-enable-pretty-printing
-gdb-set print object on
source /home/lmckhou/prettyPrint/gdbinit
-file-exec-and-symbols --thread-group i1 /home/lmckhou/testing/test
-break-insert --thread-group i1 -f /home/lmckhou/testing/test.cc:12
-break-insert --thread-group i1 -t -f main
-exec-run --thread-group i1
-var-create --thread-group i1 - * x
-var-create --thread 1 --frame 0 - * x
-var-list-children var2
-exec-continue --thread 1
-var-update 1 var2
OK, I can reproduce the crash from the command line. Did you report the bug to the GDB folks?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05785 seconds