Debuging MinGW C++ with gdb
-
- CodeLite Enthusiast
- Posts: 44
- Joined: Thu Oct 09, 2008 9:11 pm
- Contact:
Debuging MinGW C++ with gdb
I am attempting to debug a MinGW wxWidgets app built using the default debug settings. I installed gdb separately from MinGW (most recent) and it seems to work within the IDE. But it ignores my breakpoints, and will only occasionally show me the current line. I also have some difficulty finding errors. I think that it used to colorize the error messages and allow me to jump to them, but I'm not sure.
Other than these issues, Codelite is serving me well. It is an excellent and extremely useful package.
I am using build 1.0.2759 of Codelite.
Dave
(P.S.: When I try to search the forum on 'gdb', 'debug', or 'debugger' It tells me that these words are too common, and shows no results)
Other than these issues, Codelite is serving me well. It is an excellent and extremely useful package.
I am using build 1.0.2759 of Codelite.
Dave
(P.S.: When I try to search the forum on 'gdb', 'debug', or 'debugger' It tells me that these words are too common, and shows no results)
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Debuging MinGW C++ with gdb
Somethings to try:
- Make sure there are no spaces in the project path
- If u are using new g++, try to recompile your project with -gstab instead of -g
- enable debugger full logging (settings -> debugger settings -> enable full logging)
- rebuild your project with the new -gstab (for g++ 4.0 and up)
Keep me updated
Eran
- Make sure there are no spaces in the project path
- If u are using new g++, try to recompile your project with -gstab instead of -g
- enable debugger full logging (settings -> debugger settings -> enable full logging)
- rebuild your project with the new -gstab (for g++ 4.0 and up)
Keep me updated
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Enthusiast
- Posts: 44
- Joined: Thu Oct 09, 2008 9:11 pm
- Contact:
Re: Debuging MinGW C++ with gdb
Thank you. Eliminating a space in a folder name a couple of levels above my project corrected both the debugging and the error colorizing (etc.) problems.
Again, thank you for your excellent software and as well as your support.
dave
Again, thank you for your excellent software and as well as your support.
dave
-
- CodeLite Curious
- Posts: 7
- Joined: Mon Mar 09, 2009 1:27 pm
- Contact:
Re: Debuging MinGW C++ with gdb
This solution didn't work for me!
In my case, debugger works well, but does not show the current line!
I am using CodeLite build 1.0.2759 with Gcc 4.3.2
When I rebuild using -gstab I get this output:
----------Build Started--------
"c:/gcc/bin/make.EXE" -j 1 -f "boo_wsp.mk"
----------Building project:[ test - Debug ]----------
g++ -c "D:/dev/boo/test/main.cpp" -gstab -o ./Debug/main.o "-I."
cc1plus.exe: error: unrecognised debug output level "stab"
c:\gcc\bin\make.EXE[1]: *** [Debug/main.o] Error 1
make.EXE: *** [All] Error 2
----------Build Ended----------
0 errors, 0 warnings
In my case, debugger works well, but does not show the current line!
I am using CodeLite build 1.0.2759 with Gcc 4.3.2
When I rebuild using -gstab I get this output:
----------Build Started--------
"c:/gcc/bin/make.EXE" -j 1 -f "boo_wsp.mk"
----------Building project:[ test - Debug ]----------
g++ -c "D:/dev/boo/test/main.cpp" -gstab -o ./Debug/main.o "-I."
cc1plus.exe: error: unrecognised debug output level "stab"
c:\gcc\bin\make.EXE[1]: *** [Debug/main.o] Error 1
make.EXE: *** [All] Error 2
----------Build Ended----------
0 errors, 0 warnings
-
- CodeLite Curious
- Posts: 7
- Joined: Mon Mar 09, 2009 1:27 pm
- Contact:
Re: Debuging MinGW C++ with gdb
Any help? eranif?
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Debuging MinGW C++ with gdb
Well, it seems that the compiler used by codelite does not recognise the -gstab option.
Have u tried with only -g? it does not work?
If it still does not work and you are not able to debug - I suggest that you try and debug it from the command line to make sure that this is a gdb issue (I am 99% sure that this is a gdb/g++ issue)
Eran
Have u tried with only -g? it does not work?
If it still does not work and you are not able to debug - I suggest that you try and debug it from the command line to make sure that this is a gdb issue (I am 99% sure that this is a gdb/g++ issue)
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 7
- Joined: Mon Mar 09, 2009 1:27 pm
- Contact:
Re: Debuging MinGW C++ with gdb
Debugger works with -g option, but the éditor does not show the current line.
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Debuging MinGW C++ with gdb
please enable the debugger logging from "settings -> debuggers -> enable full logging"
debug your application again and please paste here the entire content of the "Debug" tab
Eran
debug your application again and please paste here the entire content of the "Debug" tab
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 7
- Joined: Mon Mar 09, 2009 1:27 pm
- Contact:
Re: Debuging MinGW C++ with gdb
Here it is
Code: Select all
DEBUG>>set new-console on
DEBUG>>set unwindonsignal on
DEBUG>>set width 0
DEBUG>>set height 0
-break-insert "D:/dev/boo/test/main.cpp:135"
DEBUG>>00000006-break-insert "D:/dev/boo/test/main.cpp:135"
Debug session started successfully!
DEBUG>>00000007-exec-run
DEBUG>>~"GNU gdb 6.8.0.20080328-cvs (cygwin-special)\n"
GNU gdb 6.8.0.20080328-cvs (cygwin-special)
DEBUG>>~"Copyright (C) 2008 Free Software Foundation, Inc.\n"
Copyright (C) 2008 Free Software Foundation, Inc.
DEBUG>>~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n"
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
DEBUG>>~"This is free software: you are free to change and redistribute it.\n"
This is free software: you are free to change and redistribute it.
DEBUG>>~"There is NO WARRANTY, to the extent permitted by law. Type \"show copying\"\n"
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
DEBUG>>~"and \"show warranty\" for details.\n"
and "show warranty" for details.
DEBUG>>~"This GDB was configured as \"i686-pc-cygwin\"...\n"
This GDB was configured as "i686-pc-cygwin"...
DEBUG>>(gdb)
DEBUG>>&"set new-console on\n"
set new-console on
DEBUG>>^done
DEBUG>>(gdb)
DEBUG>>&"set unwindonsignal on\n"
set unwindonsignal on
DEBUG>>^done
DEBUG>>(gdb)
DEBUG>>&"set width 0\n"
set width 0
DEBUG>>^done
DEBUG>>(gdb)
DEBUG>>&"set height 0\n"
set height 0
DEBUG>>^done
DEBUG>>(gdb)
Debuggee process ID: 3268
DEBUG>>00000006^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0040165a",func="main",file="D:/dev/boo/test/main.cpp",fullname="/cygdrive/d/dev/boo/test/main.cpp",line="135",times="0"}
Found the breakpoint ID!
Storing debugger breakpoint Id=1
Successfully set breakpoint 1 at: D:\dev\boo\test\main.cpp:135
DEBUG>>(gdb)
DEBUG>>00000007^running
Continuing...
DEBUG>>(gdb)
DEBUG>>~"[New thread 3268.0x1b8]\n"
[New thread 3268.0x1b8]
DEBUG>>00000007*stopped,reason="breakpoint-hit",bkptno="1",thread-id="1",frame={addr="0x0040165a",func="main",args=[],file="D:/dev/boo/test/main.cpp",fullname="/cygdrive/d/dev/boo/test/main.cpp",line="135"}
DEBUG>>00000008-file-list-exec-source-file
DEBUG>>(gdb)
DEBUG>>00000008^done,line="135",file="D:/dev/boo/test/main.cpp",fullname="/cygdrive/d/dev/boo/test/main.cpp",macro-info="0"
DEBUG>>00000009-stack-list-arguments 1 0 0
DEBUG>>00000010-stack-list-locals --all-values
DEBUG>>(gdb)
DEBUG>>00000009^done,stack-args=[frame={level="0",args=[]}]
DEBUG>>(gdb)
DEBUG>>00000010^done,locals=[{name="i",value="4216664"}]
DEBUG>>(gdb)
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Debuging MinGW C++ with gdb
Ok, this helps a lot:
The title is misleading, it says "Debuging MinGW C++ with gdb" however, your gdb is Cygwin gdb and NOT MinGW:
Eran
The title is misleading, it says "Debuging MinGW C++ with gdb" however, your gdb is Cygwin gdb and NOT MinGW:
The problem seems more clear now, since the debugger is configured to work with cygwin it results in file paths which can not been find unless you are the cygwin bash console:GNU gdb 6.8.0.20080328-cvs (cygwin-special)
Please make sure that codelite is using the MinGW gdb - if you dont have one, download codelite with the mingw bundle.DEBUG>>00000006^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0040165a",func="main",file="D:/dev/boo/test/main.cpp",fullname="/cygdrive/d/dev/boo/test/main.cpp",line="135",times="0"}
Eran
Make sure you have read the HOW TO POST thread