Author Topic: Debugger won't work  (Read 8463 times)

Offline verxintRising

  • Single posting newcomer
  • *
  • Posts: 4
Debugger won't work
« on: March 17, 2010, 07:46:37 am »
Out of nowhere, my debugger can no longer go line by line. I have "include debugging symbols" in the build options, but whenever I try to run to cursor, it runs through the whole program (or in this case, until it segfaults). I can't fix the aforementioned segfault without going a line at a time.

Thanks.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugger won't work
« Reply #1 on: March 17, 2010, 09:20:39 am »
C::B version, GCC version, GDB version, OS version?

Does gdb work from the console?
(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 verxintRising

  • Single posting newcomer
  • *
  • Posts: 4
Re: Debugger won't work
« Reply #2 on: March 17, 2010, 09:33:44 am »
C::B v 8.02 running on windows vista
GCC should be v4.3.3, or whatever the latest is.
GDB v6.7.50.20071127

GDB will still work fine from the console, as far as I can tell.. I don't really understand how to use it.

it does give 3 errors saying a DLL wasn't found at some random address, but it doesn't seem to stop GDB from running.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugger won't work
« Reply #3 on: March 17, 2010, 10:19:58 am »
Please try newer gdb... at least 6.8, but you could try and 7.0.2+ (search the forum for the binary)

Also consult the gdb help/manual how to use gdb from the console.
You can paste the output of the debugger's log, so we can take a look at this. To enable the log: settings -> compiler & debugger -> debugger -> show debugger's debug log (or something like that).

Another thing, does debugging of simple console project work?
(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 verxintRising

  • Single posting newcomer
  • *
  • Posts: 4
Re: Debugger won't work
« Reply #4 on: March 18, 2010, 05:46:45 am »
I'm using MinGW, are there any particulars for upgrading gdb I should know?

It seems like some programs will debug properly and other's won't. I can't find any consistency either, one project will go line by line perfectly, and another that's about equally simple won't.

here's the debug log for one of the ones that refuses to stop at the line I specify:
Code
Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: C:\Users\Verx\Documents\C++\Macro Killer (general)\convert a macro with arguments\
Adding source dir: C:\Users\Verx\Documents\C++\Macro Killer (general)\convert a macro with arguments\
Adding file: bin\Debug\convert a macro with arguments.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
Function "C:/Users/Verx/Documents/C++/Macro Killer (general)" not defined.
Breakpoint 1 ("C:/Users/Verx/Documents/C++/Macro Killer (general)/convert a macro with arguments/main.cpp:13) pending.
Child process PID: 1800
Program exited normally.
Debugger finished with status 0

and here's the log for one that works properly:
Code
Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: C:\Users\Verx\Documents\C++\OneLine\
Adding source dir: C:\Users\Verx\Documents\C++\OneLine\
Adding file: bin\Debug\OneLine.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
Child process PID: 6984
At C:/Users/Verx/Documents/C++/OneLine/main.cpp:11

this part seems to show up only in the non-working project:
Code
Function "C:/Users/Verx/Documents/C++/Macro Killer (general)" not defined.
Breakpoint 1 ("C:/Users/Verx/Documents/C++/Macro Killer (general)/convert a macro with arguments/main.cpp:13) pending.

I went through and removed the parenthesis in the file path, since I figured that might in some strange way be messing it up, and I get this now:
Code
Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: C:\Users\Verx\Documents\C++\Macro Killer\convert a macro with arguments\
Adding source dir: C:\Users\Verx\Documents\C++\Macro Killer\convert a macro with arguments\
Adding file: bin\Debug\convert a macro with arguments.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 C:/Users/Verx/Documents/C++/Macro Killer/convert a macro with arguments/main.cpp.
Breakpoint 1 ("C:/Users/Verx/Documents/C++/Macro Killer/convert a macro with arguments/main.cpp:13) pending.
Child process PID: 4828
Program exited normally.
Debugger finished with status 0

The hell does it mean there isn't a file named main.cpp.. There definitely is.

And I just realized there's a different debug log you guys want.. here's one running through a more complex program that also refuses to debug properly
Code
PATH=.;C:\Program Files (x86)\CodeBlocks\MinGW\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\java\jdk1.6.0_07\bin\
Command-line: C:\Program Files (x86)\CodeBlocks\MinGW\bin\gdb.exe -nx -fullname  -quiet -args "bin/Debug/Macro Killer (program).exe"
Working dir : C:\Users\Verx\Documents\C++\Macro Killer\Macro Killer\
> set prompt >>>>>>cb_gdb:
(gdb) >>>>>>cb_gdb:
> show version
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".
>>>>>>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 C:/Users/Verx/DOCUME~1/C__~1/MACROK~2/MACROK~1/
>>>>>>cb_gdb:
> tbreak "C:/Users/Verx/Documents/C++/Macro Killer/Macro Killer/main.cpp:5"
No source file named C:/Users/Verx/Documents/C++/Macro Killer/Macro Killer/main.cpp.
Breakpoint 1 ("C:/Users/Verx/Documents/C++/Macro Killer/Macro Killer/main.cpp:5) pending.
>>>>>>cb_gdb:
> run
gdb: win32_init_thread_list
Error: dll starting at 0x779b0000 not found.
Error: dll starting at 0x76170000 not found.
Error: dll starting at 0x779b0000 not found.
Error: dll starting at 0x77ae0000 not found.
Program exited normally.
>>>>>>cb_gdb:
> set debugevents off
>>>>>>cb_gdb:
> quit

Sorry for posting massive blocks of code but I have no idea where this could be coming from.
« Last Edit: March 18, 2010, 05:53:51 am by verxintRising »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Debugger won't work
« Reply #5 on: March 18, 2010, 06:00:25 am »
So, the question is: How can I help you? Can you give a test case?
BTW, we are using more newer version of gcc compiler and gdb debugger.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugger won't work
« Reply #6 on: March 18, 2010, 09:16:00 am »
Probably you need to remove the spaces from the project path.

Keep in mind that some versions of gcc have problems with spaces, too.

And please update your version gdb x.x.50 is an alpha/testing/pre release version of gdb... 6.8 is relatively stable, some report that 7.0.x have problems debugging c::b and wxWidgets....
(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 Cryogen

  • Regular
  • ***
  • Posts: 260
Re: Debugger won't work
« Reply #7 on: April 20, 2010, 11:43:45 pm »
 
  I couldn't debug at all with 7.x and had to revert to GDB 6.8. Wierd.

Cheers.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Debugger won't work
« Reply #8 on: April 21, 2010, 02:32:17 am »
 
  I couldn't debug at all with 7.x and had to revert to GDB 6.8. Wierd.

Cheers.

For me, on Windows, the GDB 7.01 is quite stable, and the other 7.x version has some problems.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.