Page 1 of 1
Could not get the debugger to work
Posted: Sun Mar 06, 2011 4:38 pm
by reiy
Hi! I am currently using FreeBSD v8.2 (release) and using codelite v2.9.0.4684. I have tried both gdb v6.1.1 and gdb v7.2.
Whenever I add a breakpoint on the program and execute "Start/Continue Debugger", the program seems to be running in the debugging session but it does not pause at the specified breakpoint, and the buttons for "Step in" "Next" are not available to be used . However, if I use the "Quick Debug..." feature, the debugger will pause at the breakpoint and I can see the local variable values and perform "step in", "next" etc., though I cannot make use of the Breakpoints functionality too (i.e. if I click "Start"Continue Debugger", it will not stop at the breakpoints as well).
The following is the log when using the "Start/Continue Debugger":
Using gdbinit file: /home/user/.gdbinit
Current working dir: /usr/home/user/Programming/codelite/testgdb
Launching gdb from : ./Debug
Starting debugger : gdb72 --tty=/dev/pts/3 --interpreter=mi "./testgdb"
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>>00000109-break-insert -t main
Debug session started successfully!
DEBUG>>00000110-exec-arguments
DEBUG>>00000111-exec-run
DEBUG>>=thread-group-added,id="i1"
=thread-group-added,id="i1"
DEBUG>>~"GNU gdb (GDB) 7.2 [GDB v7.2 for FreeBSD]\n"
GNU gdb (GDB) 7.2 [GDB v7.2 for FreeBSD]
DEBUG>>~"Copyright (C) 2010 Free Software Foundation, Inc.\n"
Copyright (C) 2010 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 \"i386-portbld-freebsd8.0\".\nFor bug reporting instructions, please see:\n"
This GDB was configured as "i386-portbld-freebsd8.0".\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 /usr/home/user/Programming/codelite/testgdb/Debug/testgdb..."
Reading symbols from /usr/home/user/Programming/codelite/testgdb/Debug/testgdb...
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>>^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>>00000109^done,bkpt={number="2",type="breakpoint",disp="del",enabled="y",addr="0x080484e1",func="main(int, char**)",file="/usr/home/user/Programming/codelite/testgdb/main.cpp",fullname="/usr/home/user/Programming/codelite/testgdb/main.cpp",line="5",times="0",original-location="main"}
Storing internal breakpoint ID=2
DEBUG>>00000110^done
DEBUG>>=thread-group-started,id="i1",pid="89457"
=thread-group-started,id="i1",pid="89457"
DEBUG>>=thread-created,id="1",group-id="i1"
=thread-created,id="1",group-id="i1"
DEBUG>>00000111^running
Continuing...
Re: Could not get the debugger to work
Posted: Mon Mar 07, 2011 7:35 pm
by eranif
This seems like a known problem:
You are placing a breakpoint at the first line of main, however codelite also places a breakpoint on that location - so once it hit - codelite issues 'continue'
You can either:
- Place the breakpoint on another line
- Disable the feature that instructs codelite to place breakpoints after 'main' function was hit (Settings | Debugger Settings..., and uncheck the option "Apply berakpoints after main function is hit"
Eran
Re: Could not get the debugger to work
Posted: Tue Mar 08, 2011 6:46 pm
by reiy
Thanks for the reply!
Actually, I have tried placing the breakpoints at different lines and also tried checking and unchecking all the available debugger options (i.e. "automatically set breakpoint at main", "apply breakpoints after main function is hit" and "enable pending breakpoints), but somehow I am still not able to make debugging work.
Attached is what happened after I executed "Start/Continue Debugger" option.
Please help me with this problem as I am very keen in using codelite as the IDE for my C++ project, and do let me know if you need more info.
Re: Could not get the debugger to work
Posted: Wed Mar 09, 2011 4:01 pm
by eranif
Can u please paste the entire debugger log for your last attempt (when the options 'Automatically set breakpoint at main' && 'Apply breakpoints after main function is hit' are disabled)
Reading the first log you pasted, shows that codelite does not see your breakpoints at all ( I dont see any attempt to apply the breakpoints at all...)
Eran
Re: Could not get the debugger to work
Posted: Wed Mar 09, 2011 5:39 pm
by reiy
Oops sorry about it forgot to post the debugger log.
Using gdbinit file: /home/user/.gdbinit
Current working dir: /usr/home/user/Programming/codelite/testgdb
Launching gdb from : ./Debug
Starting debugger : gdb --tty=/dev/pts/2 --interpreter=mi "./testgdb"
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>>00000017-break-insert "\"/usr/home/user/Programming/codelite/testgdb/main.cpp:7\""
Debug session started successfully!
DEBUG>>00000018-exec-arguments
DEBUG>>00000019-exec-run
DEBUG>>~"GNU gdb 6.1.1 [FreeBSD]\n"
GNU gdb 6.1.1 [FreeBSD]
DEBUG>>~"Copyright 2004 Free Software Foundation, Inc.\n"
Copyright 2004 Free Software Foundation, Inc.
DEBUG>>~"GDB is free software, covered by the GNU General Public License, and you are\n"
GDB is free software, covered by the GNU General Public License, and you are
DEBUG>>~"welcome to change it and/or distribute copies of it under certain conditions.\n"
welcome to change it and/or distribute copies of it under certain conditions.
DEBUG>>~"Type \"show copying\" to see the conditions.\n"
Type "show copying" to see the conditions.
DEBUG>>~"There is absolutely no warranty for GDB. Type \"show warranty\" for details.\n"
There is absolutely no warranty for GDB. Type "show warranty" for details.
DEBUG>>~"This GDB was configured as \"i386-marcel-freebsd\"..."
This GDB was configured as "i386-marcel-freebsd"...
DEBUG>>~"\n"
DEBUG>>&"set unwindonsignal on\n"
DEBUG>>^done
Debuggee process ID: 5378
DEBUG>>&"set breakpoint pending on\n"
DEBUG>>^done
DEBUG>>&"catch throw\n"
DEBUG>>&"Function \"__cxa_throw\" not defined.\n"
DEBUG>>^error,msg="Function \"__cxa_throw\" not defined."
^error,msg="Function \"__cxa_throw\" not defined."
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>>00000017^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x080484f4",func="main",file="/usr/home/user/Programming/codelite/testgdb/main.cpp",line="7",times="0"}
Found the breakpoint ID!
Storing debugger breakpoint Id=1
Successfully set breakpoint 1 at: /usr/home/user/Programming/codelite/testgdb/main.cpp:7
DEBUG>>00000018^done
DEBUG>>00000019^running
Continuing...
DEBUG>>00000019*stopped,reason="breakpoint-hit",bkptno="1",thread-id="0",frame={addr="0x080484f4",func="main",args=[],file="/usr/home/user/Programming/codelite/testgdb/main.cpp",line="7"}
DEBUG>>00000020-var-update "*"
DEBUG>>00000021-file-list-exec-source-file
DEBUG>>00000022-break-list
DEBUG>>00000020^done,changelist=[]
DEBUG>>00000021^done,line="7",file="/usr/home/user/Programming/codelite/testgdb/main.cpp",fullname="/usr/home/user/Programming/codelite/testgdb/main.cpp"
DEBUG>>00000023-stack-list-locals 2
DEBUG>>00000024-stack-list-arguments 2 0 0
DEBUG>>00000022^done,BreakpointTable={nr_rows="1",nr_cols="6",hdr=[{width="3",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="10",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="0x080484f4",func="main",file="/usr/home/user/Programming/codelite/testgdb/main.cpp",line="7",times="1"}]}
And the IDE did not pause at the specified breakpoint line.
Re: Could not get the debugger to work
Posted: Wed Mar 09, 2011 6:14 pm
by eranif
GDB output says otherwise:
DEBUG>>00000019*stopped,reason="breakpoint-hit",bkptno="1",thread-id="0",frame={addr="0x080484f4",func="main",args=[],file="/usr/home/user/Programming/codelite/testgdb/main.cpp",line="7"}
DEBUG>>00000020-var-update "*"
DEBUG>>00000021-file-list-exec-source-file
DEBUG>>00000022-break-list
DEBUG>>00000020^done,changelist=[]
DEBUG>>00000021^done,line="7",file="/usr/home/user/Programming/codelite/testgdb/main.cpp",fullname="/usr/home/user/Programming/codelite/testgdb/main.cpp"
DEBUG>>00000023-stack-list-locals 2
DEBUG>>00000024-stack-list-arguments 2 0 0
DEBUG>>00000022^done,BreakpointTable={nr_rows="1",nr_cols="6",hdr=[{width="3",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="10",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="0x080484f4",func="main",file="/usr/home/user/Programming/codelite/testgdb/main.cpp",line="7",times="1"}]}
Note that line that says:
DEBUG>>00000019*stopped,reason="breakpoint-hit"
this means that GDB indeed hit the breakpoint and stopped.
What really interests me is that I don't see GDB response to commands 00000023 and 00000024 (there should be an output like 00000024^done,... and 00000023^done)
Did you truncate the output by any chance? if not then it looks like a bug in GDB/MI under FreeBSD.
This is the flow that you should see (I will describe here the conversation between codelite and gdb from the quote i pasted above):
- codelite: break at main.cpp:7
- gdb: breakpoint set
- codelite: continue
- gdb: running
- gdb: stopped, breakpoint-hit
- codelite: show me: current file position
- gdb: line="7",file="/usr/home/user/Programming/codelite/testgdb/main.cpp",fullname="/usr/home/user/Programming/codelite/testgdb/main.cpp"
- codelite: get list of breakpoints
- gdb: done
- codelite: show locals
- codelite: show function arguments
and at this point GDB does not reply...
Eran
Re: Could not get the debugger to work
Posted: Wed Mar 09, 2011 6:55 pm
by reiy
Okay, I have tried gdb v6.6 and gdb v7.2 and they all seem to have the same outcome.
Hmm well I doubt I have truncated any logging messages, but I noticed that after the first time I run debugging the logs seem to be "truncated", not sure if I am seeing things... Anyway the following is the log displayed after restarting codelite using gdb v6.6:
Using gdbinit file: /home/user/.gdbinit
Current working dir: /usr/home/user/Programming/codelite/testgdb
Launching gdb from : ./Debug
Starting debugger : gdb66 --tty=/dev/pts/4 --interpreter=mi "./testgdb"
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>>00000001-break-insert "\"/usr/home/user/Programming/codelite/testgdb/main.cpp:7\""
Debug session started successfully!
DEBUG>>00000002-exec-arguments
DEBUG>>00000003-exec-run
DEBUG>>~"GNU gdb 6.6 [GDB v6.6 for FreeBSD]\n"
GNU gdb 6.6 [GDB v6.6 for FreeBSD]
DEBUG>>~"Copyright (C) 2006 Free Software Foundation, Inc.\n"
Copyright (C) 2006 Free Software Foundation, Inc.
DEBUG>>~"GDB is free software, covered by the GNU General Public License, and you are\n"
GDB is free software, covered by the GNU General Public License, and you are
DEBUG>>~"welcome to change it and/or distribute copies of it under certain conditions.\n"
welcome to change it and/or distribute copies of it under certain conditions.
DEBUG>>~"Type \"show copying\" to see the conditions.\n"
Type "show copying" to see the conditions.
DEBUG>>~"There is absolutely no warranty for GDB. Type \"show warranty\" for details.\n"
There is absolutely no warranty for GDB. Type "show warranty" for details.
DEBUG>>~"This GDB was configured as \"i386-portbld-freebsd8.0\"...\n"
This GDB was configured as "i386-portbld-freebsd8.0"...
DEBUG>>&"set unwindonsignal on\n"
DEBUG>>^done
Debuggee process ID: 10654
DEBUG>>&"set breakpoint pending on\n"
DEBUG>>^done
DEBUG>>&"catch throw\n"
DEBUG>>&"Function \"__cxa_throw\" not defined.\n"
DEBUG>>^error,msg="Function \"__cxa_throw\" not defined."
^error,msg="Function \"__cxa_throw\" not defined."
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>>00000001^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x080484f4",func="main",file="/usr/home/user/Programming/codelite/testgdb/main.cpp",fullname="/usr/home/user/Programming/codelite/testgdb/main.cpp",line="7",times="0"}
Found the breakpoint ID!
Storing debugger breakpoint Id=1
Successfully set breakpoint 1 at: /usr/home/user/Programming/codelite/testgdb/main.cpp:7
DEBUG>>00000002^done
DEBUG>>00000003^running
Continuing...
DEBUG>>00000003*stopped,reason="breakpoint-hit",bkptno="1",thread-id="0",frame={addr="0x080484f4",func="main",args=[],file="/usr/home/user/Programming/codelite/testgdb/main.cpp",fullname="/usr/home/user/Programming/codelite/testgdb/main.cpp",line="7"}
DEBUG>>00000004-var-update "*"
DEBUG>>00000005-file-list-exec-source-file
DEBUG>>00000006-break-list
DEBUG>>00000004^done,changelist=[]
DEBUG>>00000005^done,line="7",file="/usr/home/user/Programming/codelite/testgdb/main.cpp",fullname="/usr/home/user/Programming/codelite/testgdb/main.cpp"
DEBUG>>00000007-stack-list-locals 2
DEBUG>>00000008-stack-list-arguments 2 0 0
DEBUG>>00000006^done,BreakpointTable={nr_rows="1",nr_cols="6",hdr=[{width="3",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="10",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="0x080484f4",func="main",file="/usr/home/user/Programming/codelite/testgdb/main.cpp",fullname="/usr/home/user/Programming/codelite/testgdb/main.cpp",line="7",times="1"}]}
DEBUG>>00000007^done,locals=[{name="x",type="int",value="0"}]
DEBUG>>00000008^done,stack-args=[frame={level="0",args=[]}]
Re: Could not get the debugger to work
Posted: Wed Mar 09, 2011 7:17 pm
by eranif
Did gdb handed over the control? from what I can see, codelite has the control (I dont see any 'Running' output from the gdb, and last output was of the 'locals') if the button is disabled, try typing from the 'Debugger' output window (the one from where you are pasting the output) the command 'list'
1) Does gdb respond?
2) Does any of the Debugger view is working? (Locals, Call Stack etc)
Eran
Re: Could not get the debugger to work
Posted: Wed Mar 09, 2011 7:31 pm
by reiy
You mean executing the commands from the prompt that has the "Send" button? I cannot, because it seems as though the debugging is over and so I cannot send any commands to GDB (to be more precise, the "Send" and "Stop" button are disabled). And also, all the Debugger views do not display any information (since as mentioned, it seems like debugging is over).
Hmm... somehow I have a feeling it is a problem at my end... though I hope not haha
Re: Could not get the debugger to work
Posted: Fri Jun 03, 2011 8:20 am
by reiy
I have updated Codelite to 2.10 but I am still facing the same problem as mentioned in my previous posts.