User forums > Using Code::Blocks

Cygwin with CodeBlocks gdb error

<< < (4/5) > >>

ollydbg:

--- Quote from: venom4u31 on December 10, 2013, 09:15:42 am ---Ok, I tried your solution and created a registry entry as described on this page: http://forums.codeblocks.org/index.php/topic,13791.msg92903.html

--- End quote ---
Yes, the above link shows a work around, the author said that the debugging works OK with his change to Windows registry.


--- Quote ---and this is the output I received when I retried debugging the program (the compiler and debugger have the exact settings restored, including the set filename-display relative initialisation command and the Use full path for source files(GDB workaround) checkbox)

--- End quote ---
Yes, you can leave these two settings to their default value.


--- Quote ---
--- Code: ---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\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]> set filename-display relative
[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 main.c, line 6.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: /cygdrive/c/test_project/bin/Debug/test_project.exe

Child process PID: 132

[debug][New Thread 132.0x88c]
[debug][New Thread 132.0x1808]
[debug]Breakpoint 2, main () at 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 code ---

--- End quote ---

OK, it looks like the GDB_driver::DetectCygwinMount functions does not works Ok in your case. Read the function source, it looks like there are some regestries in HKEY_CURRENT_USER? Can you try again?

I don't have more ways now, also I think the simplest way is to add an option (translate the cygdrive) in debugger setting dialog of C::B.


ollydbg:
For the record, currently, the GDB debugger plugin use an old GDB interface called annotated interface, see http://www.sourceware.org/gdb/onlinedocs/annotate.html

Here, the full(absolute path) is always used:


--- Quote ---13 Displaying Source

The following annotation is used instead of displaying source code:

     ^Z^Zsource filename:line:character:middle:addr

where filename is an absolute file name indicating which source file, line is the line number within that file (where 1 is the first line in the file), character is the character position within the file (where 0 is the first character in the file) (for most debug formats this will necessarily point to the beginning of a line), middle is ‘middle’ if addr is in the middle of the line, or ‘beg’ if addr is at the beginning of the line, and addr is the address in the target program associated with the source which is being displayed. addr is in the form ‘0x’ followed by one or more lowercase hex digits (note that this does not depend on the language).

--- End quote ---

So, I'm wondering there is an options to change this.... Can't find one.

The debugger plugin for GDB-MI mode is still under development, so I think we still need a solution currently.

venom4u31:
Wow, your suggestion absolutely worked.

For the record, to solve this problem I have created two registers under

HKEY_CURRENT_USER\\Software\\Cygnus Solutions\\Cygwin\\mounts v2

HKEY_LOCAL_MACHINE\\Software\\Cygnus Solutions\\Cygwin\\mounts v2

(the folders were manually created)

with the name cygdrive prefix
and the value /cygdrive

That's it. It worked.

However, the problem with the MinGW debugger has persisted. Apparently it's fixed if I just remove the Cygwin compiler and debugger settings from C::B, so it's not such a big problem.

Thank you so much for the support. You have been a huge help.

ollydbg:

--- Quote from: venom4u31 on December 10, 2013, 10:02:08 am ---Wow, your suggestion absolutely worked.

For the record, to solve this problem I have created two registers under

HKEY_CURRENT_USER\\Software\\Cygnus Solutions\\Cygwin\\mounts v2

HKEY_LOCAL_MACHINE\\Software\\Cygnus Solutions\\Cygwin\\mounts v2

(the folders were manually created)

with the name cygdrive prefix
and the value /cygdrive

That's it. It worked.


--- End quote ---
Nice to hear!!


--- Quote ---However, the problem with the MinGW debugger has persisted. Apparently it's fixed if I just remove the Cygwin compiler and debugger settings from C::B, so it's not such a big problem.

--- End quote ---
In-fact, I don't understand this problem, what's exactly the MinGW GDB problem??

I just see you have a problem when you try use GDB.exe(64bit, cygwin) to debug a program(build from GCC 64bit, cygwin), and now this problem is solved.

Basically, you should use a MinGW GDB to debug the application build from MinGW GCC compiler, never mixed the different type of GDB and GCC. (unless you are using cross building)


--- Quote ---Thank you so much for the support. You have been a huge help.

--- End quote ---
You are welcome, hope you will enjoy the Free/Open Source C::B IDE.

venom4u31:

--- Quote ---In-fact, I don't understand this problem, what's exactly the MinGW GDB problem??
--- End quote ---
Well, the problem is the one I mentioned in http://forums.codeblocks.org/index.php/topic,18663.msg127883.html#msg127883
The output is when I try to debug any program that uses the MinGW debugger.
The debugger seems to be stuck. I can't figure out why. This only happens if I have the Cygwin debug configuration in the Settings->Debugger window (asside the default one). After I delete it it works fine.

I have no idea of why this would happen.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version