Page 1 of 1

Python error while starting GDB session

Posted: Sun Nov 12, 2017 12:23 am
by caibbor
Worked fine in Codelite 10. I moved to 11.0.4 today and found this problem, and then tried the latest git version today as well. Same problem in git/11.0.5

I'm not sure this is a bug, but it's beginning to smell like it.

here's full debug output:

Code: Select all

Using gdbinit file: /tmp/codelite_gdbinit.txt
Current working dir: /home/antic/Documents/proj/monticello/codelite
Launching gdb from : ../run
Starting debugger  : /usr/bin/gdb --command="/tmp/codelite_gdbinit.txt" --tty=/dev/pts/10 --interpreter=mi "../run/monticello_debug"
DEBUG>>set unwindonsignal on
DEBUG>>set breakpoint pending on
DEBUG>>catch throw
DEBUG>>set print object 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/antic/.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>>00000001-enable-pretty-printing
Debug session started successfully!
DEBUG>>00000002-exec-arguments 
DEBUG>>00000003-exec-run 
DEBUG>>=thread-group-added,id="i1"
=thread-group-added,id="i1"
DEBUG>>~"GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1\n"
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
DEBUG>>~"Copyright (C) 2016 Free Software Foundation, Inc.\n"
Copyright (C) 2016 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 ../run/monticello_debug..."
Reading symbols from ../run/monticello_debug...
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>>&"catch throw\n"
DEBUG>>~"Catchpoint 1 (throw)\n"
Catchpoint 1 (throw)
DEBUG>>=breakpoint-created,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",what="exception throw",catch-type="throw",times="0"}
=breakpoint-created,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",what="exception throw",catch-type="throw",times="0"}
DEBUG>>^done
DEBUG>>&"set print object on\n"
DEBUG>>=cmd-param-changed,param="print object",value="on"
=cmd-param-changed,param="print object",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/antic/.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>>00000001^done
DEBUG>>00000002^done
>> Debuggee process ID: 16271
DEBUG>>=thread-group-started,id="i1",pid="16271"
=thread-group-started,id="i1",pid="16271"
DEBUG>>=thread-created,id="1",group-id="i1"
=thread-created,id="1",group-id="i1"
DEBUG>>=library-loaded,id="/lib/ld-linux.so.2",target-name="/lib/ld-linux.so.2",host-name="/lib/ld-linux.so.2",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib/ld-linux.so.2",target-name="/lib/ld-linux.so.2",host-name="/lib/ld-linux.so.2",symbols-loaded="0",thread-group="i1"
DEBUG>>00000003^running
Continuing...
DEBUG>>*running,thread-id="all"
*running,thread-id="all"
DEBUG>>~"[Inferior 1 (process 16271) exited with code 0177]\n"
[Inferior 1 (process 16271) exited with code 0177]
DEBUG>>=thread-exited,id="1",group-id="i1"
=thread-exited,id="1",group-id="i1"
DEBUG>>=thread-group-exited,id="i1",exit-code="0177"
=thread-group-exited,id="i1",exit-code="0177"
DEBUG>>*stopped,reason="exited",exit-code="0177"
Program exited normally.
Debug session ended
My system information:

Code: Select all

antic@antic-Inspiron-7559:~$ cat /etc/issue
Ubuntu 16.04.3 LTS \n \l

antic@antic-Inspiron-7559:~$ uname -a
Linux antic-Inspiron-7559 4.9.11-040911-generic #201702181031 SMP Sat Feb 18 15:33:41 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
antic@antic-Inspiron-7559:~$ gdb -v
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
antic@antic-Inspiron-7559:~$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.2.0-1ubuntu1~16.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.2.0 (Ubuntu 7.2.0-1ubuntu1~16.04) 
antic@antic-Inspiron-7559:~$ codelite -v
the version of CodeLite from the 11.0.4 install package (GDB problem is present in this version as well):

Code: Select all

antic@antic-Inspiron-7559:~$ codelite -v
CodeLite IDE v11.0.4
the version of CodeLite from git (`make install`ed with previous git package removed first):

Code: Select all

15:09:58: Warning: Mismatch between the program and library build versions detected.
The library used 3.0 (wchar_t,compiler with C++ ABI 1009,wx containers,compatible with 2.8),
and your program used 3.0 (wchar_t,compiler with C++ ABI 1011,wx containers,compatible with 2.8).
CodeLite IDE v11.0.5
antic@antic-Inspiron-7559:~$
My project is a ~60k line game engine. I've been putting codelite to the test ;)

Re: Python error while starting GDB session

Posted: Sun Nov 12, 2017 1:01 am
by eranif
The python error is harmless.
It only says that the printers are already registered, nothing more
Do you have a real error?

Re: Python error while starting GDB session

Posted: Sun Nov 12, 2017 2:57 am
by caibbor
When I start the debugger, codelite goes into debug mode and then back to normal mode like the program exited prematurely or something. I've put a breakpoint on main() but it never hits it.

Re: Python error while starting GDB session

Posted: Sun Nov 12, 2017 10:00 am
by eranif
Is there a missing symbol maybe? or maybe permission error?
Try running it without a debugger and see that it works
Next, try to debug it from a console, does this work?

Re: Python error while starting GDB session

Posted: Sun Nov 12, 2017 8:48 pm
by caibbor
if I run without the debugger (Shift+F5) then I get an output window with this:

Code: Select all

../run/monticello_debug: error while loading shared libraries: libSDL2-2.0.so.0: cannot open shared object file: No such file or directory
Press ENTER to continue...
which shouldn't be happening because that library is placed in a local directory in my project, and the directory is added to the linker settings for library path. This all works in the older version of codelite as mentioned.

I suspect codelite is ignoring my library include paths in Project Settings -> Linker -> Library Search Path. That setting is as follows (it's a 32bit program):

Code: Select all

../lib/lin;/usr/lib32
running my program with the following in a terminal works fune:

Code: Select all

LD_LIBRARY_PATH=../lib/lin/:$LD_LIBRARY_PATH ./monticello_debug
as for debugging from a terminal:

Code: Select all

antic@antic-Inspiron-7559:~/Documents/proj/monticello/run$ LD_LIBRARY_PATH=../lib/lin/:$LD_LIBRARY_PATH gdb ./monticello_debug
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./monticello_debug...stardone.
(gdb) start
Temporary breakpoint 1 at 0x813fe7e: file /home/antic/Documents/proj/monticello/src/base/main.cpp, line 67.
Starting program: /home/antic/Documents/proj/monticello/run/monticello_debug 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Temporary breakpoint 1, main (argc=1, argv=0xffffd534)
    at /home/antic/Documents/proj/monticello/src/base/main.cpp:67
67	    std::set_new_handler( monticello_new_handler );
(gdb) 
typing continue runs the program normally

Re: Python error while starting GDB session

Posted: Sun Nov 12, 2017 9:56 pm
by eranif
The settings in the linker are used for *link* time not runtime
You should add them to the LD_LIBRARY_PATH before launching the debugger.

Nothing changed in this regard bettween CodeLite 11 and 9 (I would even say CodeLite 6...)
If I had to guess, I would say that something was changed in your environment

Try setting the proper LD_LIBRARY_PATH in a terminal and then launch CodeLite, or update the LD_LIBRARY_PATH in settings->environment variables

Re: Python error while starting GDB session

Posted: Sun Nov 12, 2017 10:08 pm
by caibbor
That was it! Problem solved.

I don't know why it worked in the older version of CodeLite, but oh well.

Thank you for your help!