Author Topic: [SOLVED] GDB and codeblocks (with QT -> QtWorkbench-0.6.0_alpha)  (Read 4574 times)

gophix

  • Guest
Hello,

I've got a problem using CodeBlocks with GDB. I'm using CodeBlocks 8.02 with MinGW (2 Versions: the one packed  to CodeBlocks and the one packed with QT_2009.3). Both versions of GDB ( 6.7.50.20071127 and 6.8 ) are working with CMD but not integrated into CB.

Here is the output with CMD to see if my compiler-Flags are working - seems to be fine.

CMD with gdb
Code
D:\qtTestDebug\bin\Debug>gdb qtTestDebug.exe
GNU gdb 6.7.50.20071127
Copyright (C) 2007 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 "i686-pc-mingw32"...
(gdb) break main.cpp:8
Breakpoint 1 at 0x40367a: file main.cpp, line 8.
(gdb) run
Starting program: D:\qtTestDebug\bin\Debug/qtTestDebug.exe

Breakpoint 1, qMain (argc=1, argv=0x3f4028) at main.cpp:8
8           std::cout << "This is just a test" << std::endl;
Current language:  auto; currently c++
(gdb) step
10          QApplication app(argc, argv);
(gdb)

Code
D:\qtTestDebug\bin\Debug>gdb qtTestDebug.exe
GNU gdb 6.8
Copyright (C) 2008 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 "i686-pc-mingw32"...
(gdb) break main.cpp:8
Breakpoint 1 at 0x40367a: file main.cpp, line 8.
(gdb) run
Starting program: D:\qtTestDebug\bin\Debug/qtTestDebug.exe
[New thread 1276.0xe04]

Breakpoint 1, qMain (argc=1, argv=0x3f4020) at main.cpp:8
8           std::cout << "This is just a test" << std::endl;
Current language:  auto; currently c++
(gdb) step
10          QApplication app(argc, argv);
(gdb)

But when I run it in CB it stops (...because it can't find the sourcefiles).

Debug output:
Code
Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: D:\qtTestDebug\
Adding source dir: D:\qtTestDebug\
Adding file: bin\Debug\qtTestDebug.exe
Starting debugger:
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb 6.7.50.20071127
No source file named D:/qtTestDebug/main.cpp.
Breakpoint 1 ("D:/qtTestDebug/main.cpp:8) pending.
Child process PID: 3632

Code
Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: D:\qtTestDebug\
Adding source dir: D:\qtTestDebug\
Adding file: bin\Debug\qtTestDebug.exe
Starting debugger:
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb 6.8
No source file named D:/qtTestDebug/main.cpp in loaded symbols.
Breakpoint 1 ("D:/qtTestDebug/main.cpp:8) pending.
Child process PID: 324

I've testet many settings but nothing made it working
i.e.:
  • CompilerFalgs: -ggdb3 | -gstabs | -gstabs+ (but normal using NO Flags, just the ones set by QtWorkbench)
          -> always with rebuild
  • using / instead of \ in the pathes
  • using "Additional Debuger search dirs"
  • changing Type (Console Application | GUI Application)

EDIT 1:
This is the Debuger output after activating "Settings"->"Compiler and Debuger"->"Debugger Settings"-> "Display Debugers log"

Code
PATH=.;C:\Programme\Qt\mingw\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\ATI Technologies\ATI Control Panel;C:\Programme\Qt\qt\bin;C:\Programme\CodeBlocks\MinGW\bin;C:\Programme\OpenCV\bin
Command-line: C:\Programme\Qt\mingw\bin\gdb.exe -nx -fullname  -quiet -args bin/Debug/qtTestDebug.exe
Working dir : D:\qtTestDebug\
> set prompt >>>>>>cb_gdb:
(gdb) >>>>>>cb_gdb:
> show version
GNU gdb 6.8
Copyright (C) 2008 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 "i686-pc-mingw32".
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set debugevents on
>>>>>>cb_gdb:
> set new-console on
>>>>>>cb_gdb:
> set disassembly-flavor att
>>>>>>cb_gdb:
> directory D:/QTTEST~1/
>>>>>>cb_gdb:
> break "D:/qtTestDebug/main.cpp:8"
No source file named D:/qtTestDebug/main.cpp in loaded symbols.
Breakpoint 1 ("D:/qtTestDebug/main.cpp:8) pending.
>>>>>>cb_gdb:
> run
gdb: win32_init_thread_list
[New thread 3180.0xef8]

How can I make CB helping GDB to find the sourcefiles? Normaly GBD finds the sources, but not when started from CB.

Thanks for all suggestions

EDIT 2:
So, I found out that this line (gdb) directory D:/QTTEST~1/ in the CMD with gdb makes a fault
Code
D:\qtTestDebug\bin\Debug>gdb qtTestDebug.exe
GNU gdb 6.7.50.20071127
...
This GDB was configured as "i686-pc-mingw32"...
(gdb) directory D:/QTTEST~1/
Source directories searched: D:/QTTEST~1;$cdir;$cwd
(gdb) break "D:/qtTestDebug/main.cpp:8"
No source file named D:/qtTestDebug/main.cpp.
Make breakpoint pending on future shared library load? (y or [n])

How to solve:

"Project"->"Properties..."->"Debugger"->"Additional Commands": Set the "Before Connection" to "directory ."

Have a nice day ;-) !

mattis
« Last Edit: July 15, 2009, 01:52:54 pm by gophix »