Author Topic: Debugger doesn't stop  (Read 33537 times)

Offline Mubisco

  • Single posting newcomer
  • *
  • Posts: 4
Debugger doesn't stop
« on: November 19, 2010, 09:03:52 pm »
Hi

I've installed Codeblocks 10.05 (the version that cames with mingw ), and it compiles OK any program, but if I want to debug just doesn't stop. I toggle a breakpoint at the beggining of the code and when I click on de start debugging, the program just runs from beggining to end. I've been sarching many pages but I don't find any solution, because everything it's OK.

The output of the debbuger is this

PATH=.;C:\Program Files (x86)\CodeBlocks\MinGW\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\
Command-line: C:\Program Files (x86)\CodeBlocks\MinGW\bin\gdb.exe -nx -fullname  -quiet -args bin/Debug/Unidad07.exe
Working dir : D:\DAI\PLE\PROGS\CodeBlocks\Unidad07\
> 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:
> catch throw
Function "__cxa_throw" not defined in loaded symbols.
>>>>>>cb_gdb:
> source C:\Program Files (x86)\CodeBlocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
>>>>>>cb_gdb:
> directory D:/DAI/PLE/PROGS/CodeBlocks/Unidad07/
>>>>>>cb_gdb:
> break "D:/DAI/PLE/PROGS/CodeBlocks/Unidad07/main.c:6"
No source file named D:/DAI/PLE/PROGS/CodeBlocks/Unidad07/main.c in loaded symbols.
Breakpoint 1 ("D:/DAI/PLE/PROGS/CodeBlocks/Unidad07/main.c:6) pending.
>>>>>>cb_gdb:
> run
gdb: win32_init_thread_list
[New thread 672.0xc34]
Error: dll starting at 0x76c90000 not found.
Error: dll starting at 0x766d0000 not found.
Error: dll starting at 0x76c90000 not found.
Error: dll starting at 0x76db0000 not found.
[New thread 672.0x1a4]
Program exited with code 030000000472.
>>>>>>cb_gdb:
> set debugevents off
>>>>>>cb_gdb:
> quit

I'm running it on a Windows 7 64 bits.

Thanks for the help.
Greetings
Xan.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugger doesn't stop
« Reply #1 on: November 19, 2010, 09:35:26 pm »
(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 Mubisco

  • Single posting newcomer
  • *
  • Posts: 4
Re: Debugger doesn't stop
« Reply #2 on: November 19, 2010, 10:39:27 pm »
Hi again

Read this: http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks

I've read what you show and I think I have everything  OK. Only I don't completely understand the 'call stack' option. My window project doesn't show any of that libxxx icons and  when I click to show the Call Stack window, it appears empty.

The rest of the steps showed on the link are OK (I've checked the path, the version of the Mingw and I am not working with a single file) but it still doesn't work. I don't know if there is any difference between Windows and Linux version of Codeblocks.

By the way, thanks for the hint. I'll keep searching.

Xan.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugger doesn't stop
« Reply #3 on: November 19, 2010, 10:42:00 pm »
> break "D:/DAI/PLE/PROGS/CodeBlocks/Unidad07/main.c:6"
No source file named D:/DAI/PLE/PROGS/CodeBlocks/Unidad07/main.c in loaded symbols.
Breakpoint 1 ("D:/DAI/PLE/PROGS/CodeBlocks/Unidad07/main.c:6) pending.
>>>>>>cb_gdb:

Are you sure that you've compiled your app with debug symbols?
The log tells us that you've not:)
(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 Mubisco

  • Single posting newcomer
  • *
  • Posts: 4
Re: Debugger doesn't stop
« Reply #4 on: November 19, 2010, 10:51:00 pm »
Hi

Are you sure that you've compiled your app with debug symbols?
The log tells us that you've not:)

I've checked it again, in the Project -> Build Options the 'Produce debugging symbols (-g) is checked on in the Project General options and the Debug options, and when I target to Debug, the program runs without breakpoints.

Is another symbol I have to check?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugger doesn't stop
« Reply #5 on: November 19, 2010, 11:48:06 pm »
Quote
Make sure that the project is compiled with the -g (debugging symbols) compiler option on, and the -s (strip symbols) option off. This ensures that the executable has debug symbols included.
Compiler optimization switches should be turned off, stripping symbols (-s) must be turned off.
Keep in mind that you may have to re-build your project as up-to-date object files might not be re-compiled with -g otherwise.

Also read this: http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F and verify that the correct options are passed to the compiler
(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 Mubisco

  • Single posting newcomer
  • *
  • Posts: 4
Re: Debugger doesn't stop
« Reply #6 on: November 20, 2010, 12:20:27 am »
Thanks!!

It's solved now. Finally it debugs OK

I have to reinstall Codeblocks directly on C: (out of the Program Files folder). I guess the (x86) suffix - i'm running it on 64 bits - was the reason for this.

Many thanks again for the help, and sorry for the noob question.
Xan.

elieserdejesus

  • Guest
Re: Debugger doesn't stop
« Reply #7 on: December 30, 2010, 01:46:21 pm »
Hello! I had the same problem, but found a different solution.

My C:: B was also not running the break points. My project was stored in a directory with many space characters (whitespaces) in the name. The name of the directory where the project was being stored was something like: "Project Test - Version two - before pointer fix problems" (just a example).

I changed the directory name for "Project" (no whitespaces, no extra words) and the break points were ok.

My conclusion: it is possible that the debugger does not handle spaces in directory name.

Sorry for bad English! :)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Debugger doesn't stop
« Reply #8 on: December 30, 2010, 01:54:00 pm »
I guess you use Windows.
Yes, the gdb does not works quite well with file path containing spaces(so does gcc).
So, avoid using spaces in the full file path!!!
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.