Page 1 of 2

Cannot debug with 6.1

Posted: Tue Jul 22, 2014 10:44 pm
by tankist02
I can successfully build and run my program. But when I try to debug it I get a pop-up window that says:

Could not launch terminal for debugger.

I searched through CodeLite settings - all gdb-specific settings are empty. If it matters I use custom build utilizing my Makefiles.

My system is RedHat 6.5 x64 with its standard tools (gcc 4.4.7 and gdb 7.2-60).

Re: Cannot debug with 6.1

Posted: Tue Jul 22, 2014 11:00 pm
by DavidGH
Hi,

Often that message means that you don't have the 'xterm' package installed...

Regards,

David

Re: Cannot debug with 6.1

Posted: Wed Jul 23, 2014 4:10 am
by tankist02
I have xterm installed:

Code: Select all

# rpm -qa|grep xterm
xterm-253-1.el6.x86_64
and I can run it with Alt-F2.

Any other ideas?

Re: Cannot debug with 6.1

Posted: Wed Jul 23, 2014 2:03 pm
by DavidGH
Any other ideas?
You say the Gdb Settings menu is empty. Does that dialog have the full path to your gdb in the top field? If not, try adding it.

If that doesn't help, please turn on debugger full logging (the checkbox at the top of the 'Output' tab in the Debugger View). Then try to debug your project and post the output here.

The other thing is your gdb version. gdb 7.2 is old now, and untested by us. You could try installing the current release. It's not hard to build once you got the dependencies installed (e.g. the ncurses devel package), and if you configure it with --prefix=$(pwd) it won't interfere with your RedHat version. You can then put its full path in Gdb Settings.

Re: Cannot debug with 6.1

Posted: Wed Jul 23, 2014 3:08 pm
by eranif
Another workaround (if you don't really need the terminal) is to disable terminal while debugging.
This is done from:
project settings->common settings->general->This program is a GUI application

Eran

Re: Cannot debug with 6.1

Posted: Thu Jul 24, 2014 11:02 pm
by tankist02
Thanks for everybody trying to help me. I did the following, but still have the same error:

I switched to using newer RedHat dev tools 2.1:

gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC)
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-47.el6

I set the full path to gdb:
Settings/GDB Settings/Debugger Path:
/opt/rh/devtoolset-2/root/usr/bin/gdb

I enabled debugger full logging, but I get nothing there when I start debugging.

I tried using the built-in Codelite terminal. The terminal appearance changed when running without debugging, but this doesn't help with debugging.

This is a console application, not GUI. After I ticked "This Program is a GUI Application" I got the following error trying to run it without debugging:

Program exited with return code: -6

When I try to run it with debugging I got the following in debugger log:

Using gdbinit file: /tmp/codelite_gdbinit.txt
Current working dir: /data/terekhoa/dev/kmv/last/Components/AALM/Products/FunctionalTests/RFoTest/cl
Launching gdb from : .
Starting debugger : /opt/rh/devtoolset-2/root/usr/bin/gdb --command="/tmp/codelite_gdbinit.txt" --tty=/tmp/ptscalcMode=15 --interpreter=mi "../linux/RFoTest"
DEBUG>>set unwindonsignal on
DEBUG>>set breakpoint pending on
DEBUG>>set width 0
DEBUG>>set height 0
DEBUG>>set print elements 200
DEBUG>>00000001-break-insert -f "\"/data/terekhoa/dev/kmv/last/Components/AALM/Components/TestUtil/AalmTestUtil.cpp:85\""
Debug session started successfully!
DEBUG>>00000002-exec-arguments dataDir=/data/terekhoa/dev/kmv/Data/1_ImportC_O_twoC_1reg1overlapping_ImportConly/ calcMode=15
DEBUG>>00000003-exec-run
DEBUG>>=thread-group-added,id="i1"
=thread-group-added,id="i1"
DEBUG>>~"GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-47.el6\n"
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-47.el6
DEBUG>>~"Copyright (C) 2013 Free Software Foundation, Inc.\n"
Copyright (C) 2013 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-redhat-linux-gnu\".\nFor bug reporting instructions, please see:\n"
This GDB was configured as "x86_64-redhat-linux-gnu".\nFor bug reporting instructions, please see:
DEBUG>>~"<http://www.gnu.org/software/gdb/bugs/>...\n"
<http://www.gnu.org/software/gdb/bugs/>...
DEBUG>>~"Reading symbols from /data/terekhoa/dev/kmv/last/Components/AALM/Products/FunctionalTests/RFoTest/linux/RFoTest..."
Reading symbols from /data/terekhoa/dev/kmv/last/Components/AALM/Products/FunctionalTests/RFoTest/linux/RFoTest...
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>>&"No source file named /data/terekhoa/dev/kmv/last/Components/AALM/Components/TestUtil/AalmTestUtil.cpp.\n"
DEBUG>>00000001^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending="\"/data/terekhoa/dev/kmv/last/Components/AALM/Components/TestUtil/AalmTestUtil.cpp:85\"",times="0",original-location="\"/data/terekhoa/dev/kmv/last/Components/AALM/Components/TestUtil/AalmTestUtil.cpp:85\""}
Found the breakpoint ID!
Storing debugger breakpoint Id=1
Successfully set breakpoint 1 at: /data/terekhoa/dev/kmv/last/Components/AALM/Components/TestUtil/AalmTestUtil.cpp:85
DEBUG>>=cmd-param-changed,param="args",value="dataDir=/data/terekhoa/dev/kmv/Data/1_ImportC_O_twoC_1reg1overlapping_ImportConly/ calcMode=15"
=cmd-param-changed,param="args",value="dataDir=/data/terekhoa/dev/kmv/Data/1_ImportC_O_twoC_1reg1overlapping_ImportConly/ calcMode=15"
DEBUG>>00000002^done
DEBUG>>&"/tmp/ptscalcMode=15: No such file or directory.\n"
>> Debuggee process ID: 11749
DEBUG>>=thread-group-started,id="i1",pid="11749"
=thread-group-started,id="i1",pid="11749"
DEBUG>>=thread-created,id="1",group-id="i1"
=thread-created,id="1",group-id="i1"
DEBUG>>=thread-exited,id="1",group-id="i1"
=thread-exited,id="1",group-id="i1"
DEBUG>>=thread-group-exited,id="i1"
=thread-group-exited,id="i1"
DEBUG>>00000003^error,msg="During startup program exited with code 1."
Debug session ended
During startup program exited with code 1.


More details when trying to start debugging session if it helps:

I get an empty terminal window with the title:

Debugging: "my_executable params"

and an empty pop-up window saying:

Could not launch terminal for debugger.


So it looks like the terminal is actually launched, but then something bad happens. BTW if I change to use CL built-in terminal debugging session still launches the external xterm.

Re: Cannot debug with 6.1

Posted: Thu Jul 24, 2014 11:59 pm
by DavidGH
So (iiuc) the program starts, but exits too early.

What happens if you run the program inside gdb 'by hand', not using CodeLite? Does the same thing happen?

Re: Cannot debug with 6.1

Posted: Sat Jul 26, 2014 12:04 am
by tankist02
The programs works fine outside of Codelite debugger session. I can run it as is, I can debug it in gdb.

Re: Cannot debug with 6.1

Posted: Sat Jul 26, 2014 2:03 pm
by DavidGH
The programs works fine outside of Codelite debugger session. I can run it as is, I can debug it in gdb.
OK, so it must be a CodeLite problem somehow.

What happens if you create a new workspace/project using one of the template ones (Workspace > New workspace or from the Welcome page)? Does that debug successfully?

Our problem is that neither Eran nor I have access to a RedHat install for testing. However I can test in Fedora (various versions) and I'll be happy to do so if you can upload (or send me) a project where debugging fails for you. Ideally that would be a simple project that fails to debug; otherwise it would have to be your real program, if that's acceptable to you...

Re: Cannot debug with 6.1

Posted: Tue Jul 29, 2014 2:15 am
by tankist02
I created a simple console app for gnu g++. I was able to debug it, though the first line in the debugger terminal is a warning:

&"warning: GDB: Failed to set controlling terminal: Operation not permitted\n"

Does it help?