News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Debugger doesn't stop

Started by Mubisco, November 19, 2010, 09:03:52 PM

Previous topic - Next topic

Mubisco

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.

oBFusCATed

(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!]

Mubisco

Hi again

Quote from: oBFusCATed on November 19, 2010, 09:35:26 PM
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.

oBFusCATed

Quote from: Mubisco on November 19, 2010, 09:03:52 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!]

Mubisco

Hi

Quote from: oBFusCATed on November 19, 2010, 10:42:00 PM
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?

oBFusCATed

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!]

Mubisco

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

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! :)

ollydbg

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.