User forums > Using Code::Blocks
Cygwin with CodeBlocks gdb error
venom4u31:
I have Code Blocks 12.11 and I have Cygwin 1.7.27 installed. I have configured C::B to run the Cygwin compiler and it works, but when I try to run the debugger from the Code Blocks environment I get the error:
--- Quote ---Cannot open file /cygdrive/c/some_path/main.c
At /cygdrive/c/some_path/main.c:15
--- End quote ---
If I try to run gdb on the same file from the cygwin command line interface, it works.
Can somebody please help me fix this problem?
oBFusCATed:
Can you post the full log from the debugger? (you should enable it first in settings -> debugger)
venom4u31:
Sure, here it is:
--- Quote ---Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\test_project\
Adding source dir: C:\test_project\
Adding file: C:\test_project\bin\Debug\test_project.exe
Changing directory to: C:/test_project/.
Set variable: PATH=.;C:\cygwin64\bin;C:\cygwin64;C:\Program Files (x86)\CodeBlocks\MinGW\bin;C:\Program Files (x86)\CodeBlocks\MinGW;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live
[debug]Command-line: C:\cygwin64\bin\gdb.exe -nx -fullname -quiet -args C:/test_project/bin/Debug/test_project.exe
[debug]Working dir : C:\test_project
Starting debugger: C:\cygwin64\bin\gdb.exe -nx -fullname -quiet -args C:/test_project/bin/Debug/test_project.exe
done
[debug]> set prompt >>>>>>cb_gdb:
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
[debug]Reading symbols from /cygdrive/c/test_project/bin/Debug/test_project.exe...done.
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 7.6.50.20130728-cvs (cygwin-special)
[debug]Copyright (C) 2013 Free Software Foundation, Inc.
[debug]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.
[debug]There is NO WARRANTY, to the extent permitted by law. Type "show copying"
[debug]and "show warranty" for details.
[debug]This GDB was configured as "x86_64-pc-cygwin".
[debug]Type "show configuration" for configuration details.
[debug]For bug reporting instructions, please see:
[debug]<http://www.gnu.org/software/gdb/bugs/>.
[debug]Find the GDB manual and other documentation resources online at:
[debug]<http://www.gnu.org/software/gdb/documentation/>.
[debug]For help, type "help".
[debug]Type "apropos word" to search for commands related to "word".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off
Debugger name and version: GNU gdb (GDB) 7.6.50.20130728-cvs (cygwin-special)
[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 0
[debug]>>>>>>cb_gdb:
[debug]> set new-console on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source C:\Program Files (x86)\CodeBlocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory C:/test_project/
[debug]Source directories searched: /cygdrive/c/test_project/C:/test_project:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "C:/test_project/main.c:6"
[debug]Breakpoint 2 at 0x1004010dd: file C:\test_project\main.c, line 6.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: /cygdrive/c/test_project/bin/Debug/test_project.exe
Child process PID: 7240
[debug][New Thread 7240.0x6c4]
[debug][New Thread 7240.0x1de8]
[debug]Breakpoint 2, main () at C:\test_project\main.c:6
[debug]/cygdrive/c/test_project/main.c:6:58:beg:0x1004010dd
[debug]>>>>>>cb_gdb:
Cannot open file: /cygdrive/c/test_project/main.c
At /cygdrive/c/test_project/main.c:6
--- End quote ---
ouch:
I would check your source directories:
--- Code: ---Source directories searched: /cygdrive/c/test_project/C:/test_project:$cdir:$cwd
--- End code ---
because that looks messed up...
ollydbg:
I have no experience with cygwin(gcc+gdb), but for your problem, I think it is good to build your exe with "relative path" enabled, so that C::B or GDB can try to search/open a file with relative path.
To use the relative path, you can try Settings->compilers->other settings->advanced options button->Others
Then, De-select the option "Use full path for source files(GDB workaround)".
BTW: it was a GDB workaround option, but with modern GDB(I think version >7.0) handles source file paths very well. So, it is safe to de-select this option.
Navigation
[0] Message Index
[#] Next page
Go to full version