Page 1 of 1

Configuration for debugging - linux/clang

Posted: Wed May 29, 2013 7:17 pm
by Arbalest
I have been using CodeLite with g++ in the windows environment without problems. I recently set up CodeLite under Ubuntu Linux 12.04 (in a virtual machine) and that work OK as well.

However, after installing and building a simple test program with the clang compiler -- in the Linux environment -- I can't seem get the debugger to work for me. The simple few line program that works in regular run mode. When I press F5 the debugger stuff starts, an output window opens and that is it. I can't single step, etc. Yes, compiler has the "-g" option and the active configuration is debug. The debugger output pane acknowledges that breakpoints are set or cleared. It must be a configuration issue or something simple, right? But what?

For what it's worth, I installed everything from binaries rather than build anything.

Re: Configuration for debugging - linux/clang

Posted: Wed May 29, 2013 8:01 pm
by eranif
Please use this thread to provide all the relevant information:

HOW TO POST

Eran

Re: Configuration for debugging - linux/clang

Posted: Wed May 29, 2013 9:10 pm
by Arbalest
Sorry, I thought that since it was likely a configuration problem that I had already included all the relevant information. Also, I realize that this is not the latest version of CodeLite. But, again since it seemed like a config issue...

CodeLite: V2.8.0.4537
GDB: 7.4-2012.04
Clang: 3.1

OS: Unbuntu 12.04, under VMware

Self Compiled: NO, for nothing

Debug Log: below, but the relevant line seems to be this:

(Note, the program is a just a bit more than hello world, and it does run properly without the debugger.)

DEBUG>>00000219^error,msg="During startup program exited with code 1."

=====================================

Using gdbinit file: /home/vmplanet/.gdbinit
Current working dir: /home/vmplanet/projects/ikm1
Launching gdb from : ./Debug
Starting debugger : gdb --tty=/dev/? --interpreter=mi "./ikm1"
Debug session started successfully!
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
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.
This GDB was configured as "i686-linux-gnu".\nFor bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/vmplanet/projects/ikm1/Debug/ikm1...
done.
Catchpoint 1 (throw)
Successfully set breakpoint 2 at: /home/vmplanet/projects/ikm1/main.cpp:16
Successfully set breakpoint 3 at: /home/vmplanet/projects/ikm1/main.cpp:18
Breakpoint 3 deleted
Successfully set temporary breakpoint 5 at: /home/vmplanet/projects/ikm1/main.cpp:16
Debug session ended
Using gdbinit file: /home/vmplanet/.gdbinit
Current working dir: /home/vmplanet/projects/ikm1
Launching gdb from : ./Debug
Starting debugger : gdb --tty=/dev/? --interpreter=mi "./ikm1"
DEBUG>>set unwindonsignal on
DEBUG>>set breakpoint pending on
DEBUG>>catch throw
DEBUG>>set width 0
DEBUG>>set height 0
DEBUG>>set print pretty on
DEBUG>>set print elements 200
DEBUG>>00000216-break-insert "\"/home/vmplanet/projects/ikm1/main.cpp:16\""
DEBUG>>00000217-break-insert main
Debug session started successfully!
DEBUG>>00000218-exec-arguments
DEBUG>>00000219-exec-run
DEBUG>>set unwindonsignal on
set unwindonsignal on
DEBUG>>set breakpoint pending on
set breakpoint pending on
DEBUG>>catch throw
catch throw
DEBUG>>set width 0
set width 0
DEBUG>>set height 0
set height 0
DEBUG>>set print pretty on
set print pretty on
DEBUG>>set print elements 200
set print elements 200
DEBUG>>00000216-break-insert "\"/home/vmplanet/projects/ikm1/main.cpp:16\""
DEBUG>>00000217-break-insert main
DEBUG>>00000218-exec-arguments
DEBUG>>00000219-exec-run
DEBUG>>=thread-group-added,id="i1"
=thread-group-added,id="i1"
DEBUG>>~"GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04\n"
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
DEBUG>>~"Copyright (C) 2012 Free Software Foundation, Inc.\n"
Copyright (C) 2012 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 \"i686-linux-gnu\".\nFor bug reporting instructions, please see:\n"
This GDB was configured as "i686-linux-gnu".\nFor bug reporting instructions, please see:
DEBUG>>~"<http://bugs.launchpad.net/gdb-linaro/>...\n"
<http://bugs.launchpad.net/gdb-linaro/>...
DEBUG>>~"Reading symbols from /home/vmplanet/projects/ikm1/Debug/ikm1..."
Reading symbols from /home/vmplanet/projects/ikm1/Debug/ikm1...
DEBUG>>~"done.\n"
done.
DEBUG>>&"set unwindonsignal on\n"
DEBUG>>^done
DEBUG>>&"set breakpoint pending on\n"
DEBUG>>^done
DEBUG>>&"catch throw\n"
DEBUG>>&"Function \"__cxa_throw\" not defined.\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",times="0",original-location="__cxa_throw"}
=breakpoint-created,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",what="exception throw",times="0",original-location="__cxa_throw"}
DEBUG>>^done
DEBUG>>&"set width 0\n"
DEBUG>>^done
DEBUG>>&"set height 0\n"
DEBUG>>^done
DEBUG>>&"set print pretty on\n"
DEBUG>>^done
DEBUG>>&"set print elements 200\n"
DEBUG>>^done
DEBUG>>00000216^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x080486b6",func="main(int, char**)",file="main.cpp",fullname="/home/vmplanet/projects/ikm1/main.cpp",line="16",times="0",original-location="/home/vmplanet/projects/ikm1/main.cpp:16"}
Found the breakpoint ID!
Storing debugger breakpoint Id=2
Successfully set breakpoint 2 at: /home/vmplanet/projects/ikm1/main.cpp:16
DEBUG>>00000217^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x08048694",at="<main(int, char**)+4>",times="0",original-location="main"}
DEBUG>>00000218^done
DEBUG>>&"/dev/?: No such file or directory.\n"
DEBUG>>=thread-group-started,id="i1",pid="18370"
=thread-group-started,id="i1",pid="18370"
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>>00000219^error,msg="During startup program exited with code 1."
DEBUG>>00000220-var-update "*"
During startup program exited with code 1.
DEBUG>>00000220-var-update "*"
DEBUG>>00000220^done,changelist=[]

Re: Configuration for debugging - linux/clang

Posted: Thu May 30, 2013 12:33 am
by eranif
Indeed, your codelite version is quite old. I am not sure its configuration issue as it should work with the default settings.
Please try to upgrade your codelite as suggested here:

http://codelite.org/LiteEditor/Repositories#toc1

I suspect that it will solve your problem

Eran

Re: Configuration for debugging - linux/clang

Posted: Thu May 30, 2013 6:17 am
by Arbalest
THANKS! That did solve the problem.

One curiosity though: When I was using the previous version of CodeLite,
the compiler complained that it did not recognize the switch -std=c++0x

So, in Workplace > Active Project Settings, I changed it to -std=c++11
per the LLVM site documentation. After the CodeLite upgrade the compiler is
complaining about the -std=c++11 switch so I had to change it back to -std=c++0x.

That had me worried that I had somehow downgraded clang.
But /usr/bin/clang++ --version does indicate that it is version 3.1.

I know this is not a CodeLite issue.

Re: Configuration for debugging - linux/clang

Posted: Thu May 30, 2013 9:38 pm
by Arbalest
Maybe I spoke too soon. After upgrading to clang 3.2 the build process is trying to include gcc headers and that results in errors.

Again, I know this is a user issue rather than a codelite issue but I have not found a possible cause for this after carefully looking at the information in this site. In fact I see this in older clang boards/fora so I will pursue it there mainly. Anyway, the error is

/usr/include/wchar.h:40:11: fatal error: 'stdarg.h' file not found


Rather than ask directly about this, I want to clarify the role (and differences) among the following configuration settings:

Settings > Build Settings > [compiler] > Compiler Switches (is this for help, or some tool tip type stuff?)

Settings > Build Settings > [compiler] > Compiler Options (although this looks like it would be for the actual settings it appears informational as well)

Workspace > Active Project Settings > Common Settings > Compiler (this seems to be the actual settings that are used by the compiler).

Re: Configuration for debugging - linux/clang

Posted: Thu May 30, 2013 10:19 pm
by eranif
Your problem is clang compiler. You need to fix this.
Arbalest wrote:Settings > Build Settings > [compiler] > Compiler Switches
Usually, in 99% of the cases you should not modify it. It contains the macros that used by codelite to generate makefiles cross compilers, again - you should not need to change it

Arbalest wrote:Settings > Build Settings > [compiler] > Compiler Options (although this looks like it would be for the actual settings it appears informational as well)
This is a _global_ compiler options. It will affect all workspaces. You can add flags here that will be added to all of your projects
Arbalest wrote:Workspace > Active Project Settings > Common Settings > Compiler (this seems to be the actual settings that are used by the compiler).
Not only. They are used in conjunction with the global ones. In the global settings (Settings -> Build Settings ..) you affect all workspaces and projects. While this affects only the current project (actually, only the current build configuration)

Eran