Eclipse CDT prettyprint broken
Asked Answered
T

1

2

I am using Ubuntu 13.10, Eclipse Kepler Service Release 1, GDB 7.6.1-ubuntu and latest CDT available through the Eclipse "install new software". I followed the instructions posted on several sites to set up prettyprinting for the STL containers.

Since it didn't work this way, following other instructions I modified the printers.py to have the len of strings maximized to 100 and formatted all raise ValueError, "..." to raise ValueError("...").

My .gdbinit file is the following:

python
import sys
sys.path.insert(0, '/home/fbence/stlPrettyPrinter')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end

My settings are these:

http://fbence.web.elte.hu/setup.png

If I go to the debug button it has my configuration set as first, and it seems to use it too (otherwise I wouldn't had have to change the printers.py I think), but the debug as... is empty.

The gbd traces have messages like these:

193,677 36^error,msg="Could not get children iterator".

193,674 35^done,name="var5",numchild="0",value="{static npos = , _M_dataplus = {> = {<__\ gnu_cxx::new_allocator> = {}, }, _M_p = 0x0}}",type="std::stri\ ng",thread-id="1",displayhint="string",dynamic="1",has_more="0"

This is the output: http://fbence.web.elte.hu/eclipseproblem.png

Using gdb from the terminal results in the following output, when I want to print a simple vector:

Python Exception <class 'TypeError'> iter() returned non-iterator of type '_iterator':

$3 = std::vector of length 6, capacity 16

Obviously, my question is, how do I fix this? Without prettyprint I'd just rather debug under windows, but I don't really want to do that:)

Thorndike answered 6/1, 2014 at 15:23 Comment(2)
Does pretty printing work in gdb command line without Eclipse?Peirsen
I edited the question, short answer is no:)Thorndike
P
3

gdb libstdc++ pretty printers are actually broken in Ubuntu 13.10 now. See this bug for example.

gdb is linked with Python3 in Ubuntu 13.10, while pretty printers scripts support only Python2 syntax. You may apply this patch to you pretty printers. It will add support of Python3. This solution worked for me though I don't use Eclipse for debugging.

Peirsen answered 9/1, 2014 at 12:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.