Page 1 of 1

GDB pretty printing

Posted: Mon Nov 09, 2015 4:48 pm
by eike
GDB pretty printing not worked for me. I was followed by instructions http://codelite.org/LiteEditor/GdbPrettyPrinting.
OS Xubuntu 15.10
Codelite version 9.00 (installed through apt-get install).
Python 2.7.10
GNU gdb (Ubuntu 7.10-1ubuntu2) 7.10
gcc (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
Can someone help me?

Re: GDB pretty printing

Posted: Mon Nov 09, 2015 7:22 pm
by eranif
Please post the debugger log.. (read the HOW TO POST thread, check my signature)

Eran

Re: GDB pretty printing

Posted: Tue Nov 10, 2015 11:33 am
by eike
Sorry for inattention.
debugger log:

Code: Select all

Debug session ended
Using gdbinit file: /tmp/codelite_gdbinit.txt
Current working dir: /home/kostenok/workspace/hg/epg/src/stv_epg_web
Launching gdb from : bin/debug
Starting debugger  : /usr/bin/gdb --command="/tmp/codelite_gdbinit.txt" --tty=/dev/pts/6 --interpreter=mi "./stv_epg_web"
DEBUG>>set unwindonsignal on
DEBUG>>set breakpoint pending on
DEBUG>>set width 0
DEBUG>>set height 0
DEBUG>>set print elements 200
DEBUG>>python
DEBUG>>import sys
DEBUG>>sys.path.insert(0, '/home/kostenok/.codelite/gdb_printers')
DEBUG>>from libstdcxx.v6.printers import register_libstdcxx_printers
DEBUG>>register_libstdcxx_printers (None)
DEBUG>>from qt4 import register_qt4_printers
DEBUG>>register_qt4_printers (None)
DEBUG>>from wx import register_wx_printers
DEBUG>>register_wx_printers (None)
DEBUG>>end
DEBUG>>00000132-break-insert -f "\"/home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp:93\""
DEBUG>>00000133-break-insert -f "\"/home/kostenok/workspace/hg/epg/src/crossplatform/EITGen.cpp:188\""
DEBUG>>00000134-break-insert -f "\"/home/kostenok/workspace/hg/epg/src/crossplatform/EITGen.cpp:189\""
DEBUG>>00000135-enable-pretty-printing
Debug session started successfully!
DEBUG>>00000136-exec-arguments -eit -nit -sdt -close
DEBUG>>00000137-exec-run 
DEBUG>>=thread-group-added,id="i1"
=thread-group-added,id="i1"
DEBUG>>~"GNU gdb (Ubuntu 7.10-1ubuntu2) 7.10\n"
GNU gdb (Ubuntu 7.10-1ubuntu2) 7.10
DEBUG>>~"Copyright (C) 2015 Free Software Foundation, Inc.\n"
Copyright (C) 2015 Free Software Foundation, Inc.
DEBUG>>~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\nand \"show warranty\" for details.\n"
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.  Type "show copying"\nand "show warranty" for details.
DEBUG>>~"This GDB was configured as \"x86_64-linux-gnu\".\nType \"show configuration\" for configuration details."
This GDB was configured as "x86_64-linux-gnu".\nType "show configuration" for configuration details.
DEBUG>>~"\nFor bug reporting instructions, please see:\n"
\nFor bug reporting instructions, please see:
DEBUG>>~"<http://www.gnu.org/software/gdb/bugs/>.\n"
<http://www.gnu.org/software/gdb/bugs/>.
DEBUG>>~"Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.\n"
Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/>.
DEBUG>>~"For help, type \"help\".\n"
For help, type "help".
DEBUG>>~"Type \"apropos word\" to search for commands related to \"word\"...\n"
Type "apropos word" to search for commands related to "word"...
DEBUG>>~"Reading symbols from ./stv_epg_web..."
Reading symbols from ./stv_epg_web...
DEBUG>>~"done.\n"
done.
DEBUG>>&"set unwindonsignal on\n"
DEBUG>>=cmd-param-changed,param="unwindonsignal",value="on"
=cmd-param-changed,param="unwindonsignal",value="on"
DEBUG>>^done
DEBUG>>&"set breakpoint pending on\n"
DEBUG>>=cmd-param-changed,param="breakpoint pending",value="on"
=cmd-param-changed,param="breakpoint pending",value="on"
DEBUG>>^done
DEBUG>>&"set width 0\n"
DEBUG>>=cmd-param-changed,param="width",value="4294967295"
=cmd-param-changed,param="width",value="4294967295"
DEBUG>>^done
DEBUG>>&"set height 0\n"
DEBUG>>=cmd-param-changed,param="height",value="4294967295"
=cmd-param-changed,param="height",value="4294967295"
DEBUG>>^done
DEBUG>>&"set print elements 200\n"
DEBUG>>^done
DEBUG>>&"python\n"
DEBUG>>&"Traceback (most recent call last):\n"
DEBUG>>&"  File \"<string>\", line 4, in <module>\n"
DEBUG>>&"  File \"/home/kostenok/.codelite/gdb_printers/libstdcxx/v6/printers.py\", line 1023, in register_libstdcxx_printers\n"
DEBUG>>&"    gdb.printing.register_pretty_printer(obj, libstdcxx_printer)\n"
DEBUG>>&"  File \"/usr/share/gdb/python/gdb/printing.py\", line 152, in register_pretty_printer\n"
DEBUG>>&"    printer.name)\n"
DEBUG>>&"RuntimeError: pretty-printer already registered: libstdc++-v6\n"
DEBUG>>&"Error while executing Python code.\n"
DEBUG>>^error,msg="Error while executing Python code."
^error,msg="Error while executing Python code."
DEBUG>>00000132^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x000000000042b14d",func="main(int, char**)",file="/home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp",fullname="/home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp",line="93",thread-groups=["i1"],times="0",original-location="/home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp:93"}
Found the breakpoint ID!
Storing debugger breakpoint Id=1
Successfully set breakpoint 1 at: /home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp:93
DEBUG>>00000133^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x00000000004092cf",func="prog_cycle[abi:cxx11](tinyxml2::XMLElement*)",file="/home/kostenok/workspace/hg/epg/src/crossplatform/EITGen.cpp",fullname="/home/kostenok/workspace/hg/epg/src/crossplatform/EITGen.cpp",line="188",thread-groups=["i1"],times="0",original-location="/home/kostenok/workspace/hg/epg/src/crossplatform/EITGen.cpp:188"}
Found the breakpoint ID!
Storing debugger breakpoint Id=2
Successfully set breakpoint 2 at: /home/kostenok/workspace/hg/epg/src/crossplatform/EITGen.cpp:188
DEBUG>>00000134^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x00000000004092f2",func="prog_cycle[abi:cxx11](tinyxml2::XMLElement*)",file="/home/kostenok/workspace/hg/epg/src/crossplatform/EITGen.cpp",fullname="/home/kostenok/workspace/hg/epg/src/crossplatform/EITGen.cpp",line="189",thread-groups=["i1"],times="0",original-location="/home/kostenok/workspace/hg/epg/src/crossplatform/EITGen.cpp:189"}
Found the breakpoint ID!
Storing debugger breakpoint Id=3
Successfully set breakpoint 3 at: /home/kostenok/workspace/hg/epg/src/crossplatform/EITGen.cpp:189
DEBUG>>00000135^done
DEBUG>>00000136^done
>> Debuggee process ID: 5892
DEBUG>>=thread-group-started,id="i1",pid="5892"
=thread-group-started,id="i1",pid="5892"
DEBUG>>=thread-created,id="1",group-id="i1"
=thread-created,id="1",group-id="i1"
DEBUG>>=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
DEBUG>>00000137^running
Continuing...
DEBUG>>*running,thread-id="all"
*running,thread-id="all"
DEBUG>>=library-loaded,id="/lib/x86_64-linux-gnu/libpthread.so.0",target-name="/lib/x86_64-linux-gnu/libpthread.so.0",host-name="/lib/x86_64-linux-gnu/libpthread.so.0",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib/x86_64-linux-gnu/libpthread.so.0",target-name="/lib/x86_64-linux-gnu/libpthread.so.0",host-name="/lib/x86_64-linux-gnu/libpthread.so.0",symbols-loaded="0",thread-group="i1"
DEBUG>>=library-loaded,id="/usr/lib/x86_64-linux-gnu/libstdc++.so.6",target-name="/usr/lib/x86_64-linux-gnu/libstdc++.so.6",host-name="/usr/lib/x86_64-linux-gnu/libstdc++.so.6",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/usr/lib/x86_64-linux-gnu/libstdc++.so.6",target-name="/usr/lib/x86_64-linux-gnu/libstdc++.so.6",host-name="/usr/lib/x86_64-linux-gnu/libstdc++.so.6",symbols-loaded="0",thread-group="i1"
DEBUG>>=library-loaded,id="/lib/x86_64-linux-gnu/libgcc_s.so.1",target-name="/lib/x86_64-linux-gnu/libgcc_s.so.1",host-name="/lib/x86_64-linux-gnu/libgcc_s.so.1",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib/x86_64-linux-gnu/libgcc_s.so.1",target-name="/lib/x86_64-linux-gnu/libgcc_s.so.1",host-name="/lib/x86_64-linux-gnu/libgcc_s.so.1",symbols-loaded="0",thread-group="i1"
DEBUG>>=library-loaded,id="/lib/x86_64-linux-gnu/libc.so.6",target-name="/lib/x86_64-linux-gnu/libc.so.6",host-name="/lib/x86_64-linux-gnu/libc.so.6",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib/x86_64-linux-gnu/libc.so.6",target-name="/lib/x86_64-linux-gnu/libc.so.6",host-name="/lib/x86_64-linux-gnu/libc.so.6",symbols-loaded="0",thread-group="i1"
DEBUG>>=library-loaded,id="/lib/x86_64-linux-gnu/libm.so.6",target-name="/lib/x86_64-linux-gnu/libm.so.6",host-name="/lib/x86_64-linux-gnu/libm.so.6",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib/x86_64-linux-gnu/libm.so.6",target-name="/lib/x86_64-linux-gnu/libm.so.6",host-name="/lib/x86_64-linux-gnu/libm.so.6",symbols-loaded="0",thread-group="i1"
DEBUG>>~"[Thread debugging using libthread_db enabled]\n"
[Thread debugging using libthread_db enabled]
DEBUG>>~"Using host libthread_db library \"/lib/x86_64-linux-gnu/libthread_db.so.1\".\n"
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
DEBUG>>=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x000000000042b14d",func="main(int, char**)",file="/home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp",fullname="/home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp",line="93",thread-groups=["i1"],times="1",original-location="/home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp:93"}
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x000000000042b14d",func="main(int, char**)",file="/home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp",fullname="/home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp",line="93",thread-groups=["i1"],times="1",original-location="/home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp:93"}
DEBUG>>~"\nBreakpoint "
\nBreakpoint
DEBUG>>~"1, main (argc=5, argv=0x7fffffffe488) at /home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp:93\n"
1, main (argc=5, argv=0x7fffffffe488) at /home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp:93
DEBUG>>~"93\t    std::map<std::string, int> command;\n"
93\t    std::map<std::string, int> command;
DEBUG>>*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x000000000042b14d",func="main",args=[{name="argc",value="5"},{name="argv",value="0x7fffffffe488"}],file="/home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp",fullname="/home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp",line="93"},thread-id="1",stopped-threads="all",core="2"
DEBUG>>00000138-stack-info-frame
DEBUG>>00000139-break-list
DEBUG>>00000138^done,frame={level="0",addr="0x000000000042b14d",func="main",file="/home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp",fullname="/home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp",line="93"}
DEBUG>>00000139^done,BreakpointTable={nr_rows="3",nr_cols="6",hdr=[{width="7",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="18",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_name="what",colhdr="What"}],body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x000000000042b14d",func="main(int, char**)",file="/home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp",fullname="/home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp",line="93",thread-groups=["i1"],times="1",original-location="/home/kostenok/workspace/hg/epg/src/stv_epg_web/main.cpp:93"},bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x00000000004092cf",func="prog_cycle[abi:cxx11](tinyxml2::XMLElement*)",file="/home/kostenok/workspace/hg/epg/src/crossplatform/EITGen.cpp",fullname="/home/kostenok/workspace/hg/epg/src/crossplatform/EITGen.cpp",line="188",thread-groups=["i1"],times="0",original-location="/home/kostenok/workspace/hg/epg/src/crossplatform/EITGen.cpp:188"},bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x00000000004092f2",func="prog_cycle[abi:cxx11](tinyxml2::XMLElement*)",file="/home/kostenok/workspace/hg/epg/src/crossplatform/EITGen.cpp",fullname="/home/kostenok/workspace/hg/epg/src/crossplatform/EITGen.cpp",line="189",thread-groups=["i1"],times="0",original-location="/home/kostenok/workspace/hg/epg/src/crossplatform/EITGen.cpp:189"}]}


Re: GDB pretty printing

Posted: Tue Nov 10, 2015 12:19 pm
by eike
I have find solution.
comment this code in Startup Commands.

Code: Select all

#from libstdcxx.v6.printers import 
#register_libstdcxx_printers
#register_libstdcxx_printers (None)
And add this code:

Code: Select all

# Load the pretty-printers.
from printers import register_libstdcxx_printers
register_libstdcxx_printers(gdb.current_objfile())
to libstdcxx\v6\__init__.py

Re: GDB pretty printing

Posted: Tue Nov 10, 2015 3:43 pm
by eranif
Do you have a reference on why you added this code? was something changed lately in GDB python API?
Thanks
Eran

Re: GDB pretty printing

Posted: Mon Nov 23, 2015 4:21 pm
by eike
I searched in google for "RuntimeError: pretty-printer already registered: libstdc++-v6\n Error while executing Python code.\n" and foud solution in thi url:
http://forums.codeblocks.org/index.php?topic=19997.0