Author Topic: [Solved] Debug won't stop at breakpoints [MinGW and GDB problem]  (Read 22650 times)

Offline Ripedox

  • Single posting newcomer
  • *
  • Posts: 6
Code
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: E:\Projects\Programming\C\CodeBlocks\ScanUserInput\
Adding source dir: E:\Projects\Programming\C\CodeBlocks\ScanUserInput\
Adding file: E:\Projects\Programming\C\CodeBlocks\ScanUserInput\bin\Debug\ScanUserInput.exe
Changing directory to: E:/Projects/Programming/C/CodeBlocks/ScanUserInput/.
Set variable: PATH=.;C:\Compilers\MinGW\bin;C:\Compilers\MinGW;E:\Program Files (x86)\CodeBlocks\MinGW\bin;E:\Program Files (x86)\CodeBlocks\MinGW;%COSMOSM%;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\QuickTime Alternative\QTSystem;C:\Program Files\Java\jdk1.8.0\bin;\\ C\Compilers\cygwin64\bin;C:\Compilers\MinGW\msys\1.0\bin;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files\Java\jdk1.7.0_03\bin

[debug]Command-line: C:\Compilers\MinGW\bin\gdb.exe -nx -fullname  -quiet  -args E:/Projects/Programming/C/CodeBlocks/ScanUserInput/bin/Debug/ScanUserInput.exe
[debug]Working dir : E:\Projects\Programming\C\CodeBlocks\ScanUserInput

Starting debugger: C:\Compilers\MinGW\bin\gdb.exe -nx -fullname  -quiet  -args E:/Projects/Programming/C/CodeBlocks/ScanUserInput/bin/Debug/ScanUserInput.exe
done

[debug]> set prompt >>>>>>cb_gdb:

Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints

[debug]Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in module E:/Projects/Programming/C/CodeBlocks/ScanUserInput/bin/Debug/ScanUserInput.exe]
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb 6.8
[debug]Copyright (C) 2008 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 "i686-pc-mingw32".
[debug]>>>>>>cb_gdb:
[debug]> set confirm off

Debugger name and version: GNU gdb 6.8

[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]Function "__cxa_throw" not defined in loaded symbols.
[debug]>>>>>>cb_gdb:
[debug]> source E:\Program Files (x86)\CodeBlocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
[debug]>>>>>>cb_gdb:
[debug]> directory E:/Projects/Programming/C/CodeBlocks/ScanUserInput/
[debug]>>>>>>cb_gdb:
[debug]> break "E:/Projects/Programming/C/CodeBlocks/ScanUserInput/main.c:90"
[debug]No source file named E:/Projects/Programming/C/CodeBlocks/ScanUserInput/main.c in loaded symbols.
[debug]Breakpoint 1 ("E:/Projects/Programming/C/CodeBlocks/ScanUserInput/main.c:90) pending.
[debug]>>>>>>cb_gdb:
[debug]> run

Child process PID: 3084

[debug][New thread 3084.0x108c]
[debug](no debugging symbols found)
[debug](no debugging symbols found)
[debug](no debugging symbols found)
[debug](no debugging symbols found)
[debug](no debugging symbols found)

Trying to pause the running process...

[debug]Error: dll starting at 0x76a90000 not found.
[debug]Error: dll starting at 0x74d90000 not found.
[debug]Error: dll starting at 0x76a90000 not found.
[debug]Error: dll starting at 0x76bb0000 not found.
[debug][New thread 3084.0x16d8]
[debug]Program received signal SIGTRAP, Trace/breakpoint trap.
[debug][Switching to thread 3084.0x16d8]
[debug]0x76ea000d in ntdll!LdrFindResource_U () from C:\Windows\system32\ntdll.dll
[debug]>>>>>>cb_gdb:

(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
Program received signal SIGTRAP, Trace/breakpoint trap.
In ntdll!LdrFindResource_U () (C:\Windows\system32\ntdll.dll)

[debug]> quit

Debugger finished with status 0

Happened after I moved by MinGW folder, tho I did my best to adjust the paths. It's now located at "C:\Compilers\MinGW". I also deleted "SDL-1.2.15", which I had no idea what role had and just now I realize it was probably important. Also, no "-s" enabled and "-g" is checked on every single page I could find. The project is compiling correctly and launches perfectly, but the debug won't work.
« Last Edit: June 20, 2014, 11:15:36 am by Ripedox »

Offline Ripedox

  • Single posting newcomer
  • *
  • Posts: 6
Re: Debug won't stop at breakpoints
« Reply #1 on: June 19, 2014, 06:08:10 pm »
Reinstalling codeblocks using the MinGW bundle was to no avail. I didn't set up any new paths after the installation. No SDL folder again (maybe it really was useless) and now I have a MinGW folder in the CodeBlocks also.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debug won't stop at breakpoints
« Reply #2 on: June 19, 2014, 09:04:19 pm »
You need to install newer GDB probably. Current version is at 7.7 and 6.8 is extremely old.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Ripedox

  • Single posting newcomer
  • *
  • Posts: 6
Re: Debug won't stop at breakpoints
« Reply #3 on: June 19, 2014, 09:38:39 pm »
GDP? How? I don't even know what you are talking about. Even so, this bug appeared after I moved the folders a few days ago, I used to debug with no problems.
Edit: I will get right on it, I luckily found the right thing in google.
« Last Edit: June 19, 2014, 09:40:23 pm by Ripedox »

Offline Ripedox

  • Single posting newcomer
  • *
  • Posts: 6
Re: Debug won't stop at breakpoints
« Reply #4 on: June 19, 2014, 10:56:07 pm »
I reinstalled the whole MinGW using it's installation manager and now it says I have version 7.6 but codeblocks is still debugging with 6.8 for some reason. I dont know what's going on...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debug won't stop at breakpoints
« Reply #5 on: June 19, 2014, 11:17:26 pm »
Are you sure that the executable started by C::B is the one you've installed?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Ripedox

  • Single posting newcomer
  • *
  • Posts: 6
Re: Debug won't stop at breakpoints
« Reply #6 on: June 19, 2014, 11:39:29 pm »
I don't know which executable you are addressing, but if it's the gdb.exe one, I even got into the settings of the debugger and checked that it leads to exactly the one in the freshly installed MinGW.
Also trying to debug in eclipse stops with the error "Dwarf Error: wrong version in compilation unit header (is 4, should be 2)" same as here except the debug doesn't get interrupted.
My knowledge of GDB, MinGW and other things like that is quite limited. I am quite a newbie in programming, first year learning it in university and following youtube vids I managed to find Codeblocks and configure it, so I don't understand many of the things you're saying :D But still I think the dwarf error has something to do with the fact that it's using version 6.8 instead of the newly installed 7.6 (I dont know why the MinGW installer didn't install the 7.7.1 version).
« Last Edit: June 19, 2014, 11:46:41 pm by Ripedox »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debug won't stop at breakpoints
« Reply #7 on: June 20, 2014, 12:02:59 am »
Do you have gdb 7.x installed?
You can verify that by starting a cmd.exe window, cd to the path where gdb is installed and execute gdb --version.

If it says you have 6.8 then it is:
1. the installer has failed
2. the installer has installed the new gdb in another location (most probable)

If it is 2) search you folders for *gdb*.exe to see where it is. A guess is c:\mingw\bin
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Ripedox

  • Single posting newcomer
  • *
  • Posts: 6
Re: Debug won't stop at breakpoints
« Reply #8 on: June 20, 2014, 09:53:43 am »
I did it!
In 5 minutes I learned how to use cmd, navigated to the location where MinGW was installed (C:\Compilers\MinGW), opened gdb.exe and it displayed "version 6.8".
I started the MinGW installer (the exe you get for making a fresh install) and I pointed to the MinGW location.
The installer told me that there already in such an installation done there and provided me with the option "Run now" which would run the installer for the current installation (otherwise I don't know how to run it, I would be happy if you tell me since I didn't find it in google).
After that, the new window told me it was version 7.6 for some reason.
I've never installed gdb before, so what I did was - get the "gdb.exe" for the newest version off of the internet and replace the one in MinGW\bin, which didn't work.
Then I thought it shouldn't be so simple, so I downloaded the gdb package and unzipped it.
I tried these instructions - http://www.tutorialspoint.com/gnu_debugger/installing_gdb.htm which failed after the command "$ gdb-6.6> ./configure" didn't work (I think I did everything properly).
The next command "$ gdb-6.6> make" told me there is no makefile (tho there was a makefile file in the directory).
So then I got the bright idea. I started the MinGW installer again which started the currently installed MinGW's installer for me and from the new window I marked "gdb" for removal and applied the changes.
Then I marked "gdb" for installation and I applied the changes.
I tested it with codeblocks and eclipse. VOILA! it's working perfectly on both places with gdb 7.6.1 (that the installer installed).
Whew... that was an adventure. Never knew this would be so hard to do, it's like I am trying to tame a wolf of something, even the internet doesn't know how to do it (at least when you don't know the right questions to ask).
Sorry for the post, I would be happy if you tell me how could I otherwise do it without the MinGW installer, where did I go wrong with unzipping the gdb package (I mean, how do you makefile, build it, where do you put it, what do you do with the outcome, etc.), or if you know a descent tutorial?
Truly a shame. I am close to mastering the level of C for microprocessor programming and yet I don't know how to handle this problem.
Thank you for your help! I hope other people that got this error like me see this.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debug won't stop at breakpoints
« Reply #9 on: June 20, 2014, 10:06:52 am »
Building from source is a tough task, especially on windows.

If I were you, I'd contact the developers of mingw to see what they think about this problem.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]