User forums > Using Code::Blocks
Don't understand debugging..???
Biplab:
@Jens,
Can you try this patch. If I remember correctly, it fixed that bug. :)
--- Code: ---Index: src/plugins/debuggergdb/debuggerstate.cpp
===================================================================
--- src/plugins/debuggergdb/debuggerstate.cpp (revision 4563)
+++ src/plugins/debuggergdb/debuggerstate.cpp (working copy)
@@ -337,8 +337,8 @@
m_pPlugin->Log(_("Setting breakpoints"));
m_pDriver->RemoveBreakpoint(0); // clear all breakpoints
- i = (int)m_Breakpoints.GetCount() - 1;
- while (i >= 0)
+ int j = (int)m_Breakpoints.GetCount() - 1;
+ for ( int i = 0; i <= j; ++i )
{
DebuggerBreakpoint* bp = m_Breakpoints[i];
m_pDriver->AddBreakpoint(bp);
--- End code ---
Jenna:
@Biplap
I applied the patch, but I also remove the "--i" at the end of the loop.
If it stays, there would be an endless loop, "i" starts with "0" is decreased at the last line of the loop by "--i" and then again increased by "++i" in the head of the for-loop.
So the code would only work if "j" is <= 0 (only one breakpoint).
Biplab:
--- Quote from: jens on October 27, 2007, 01:01:42 pm ---I applied the patch, but I also remove the "--i" at the end of the loop.
If it stays, there would be an endless loop, "i" starts with "0" is decreased at the last line of the loop by "--i" and then again increased by "++i" in the head of the for-loop.
So the code would only work if "j" is <= 0 (only one breakpoint).
--- End quote ---
Thanks a lot for the change. Sorry I lost the original patch and I recreated it. :)
But did it work??
My Fedora installation doesn't have this problem. So I can't reproduce this bug on my PC.
Jenna:
No it does not work.
The only thing that's different in the debugger-log is that the formerly bp with the number 1 is now 2 and vice-versa. But that is because the for-loop increases from 0 and the while-loop decreases to 0.
Adding breakpoints is not the problem I think.
I still believe the problem is that gdb stops automatically at the beginning of main and codeblocks does not recognize that there is also a user breakpoint set.
I try to debug it.
johne53:
As I predicted yesterday, today it's stopped working again.... :( In fact, when I try to start the debugger today I get a dialog box saying "Select Target" which asks me to select either the Debug or Release build. Whichever target I select, the app (to be debugged) never starts.
Biplap - I appreciate that it must be frustrating when somebody reports an ongoing problem which you cannot reproduce - but equally, I cannot obtain any reproducable (or predictable) behavior. Some days it works, Other days it doesn't. Sometimes I see a particular dialog box (like the one I just described) other times I see some different dialog - like the one asking me to save the default layout before continuing. Some days I won't get any dialog at all. There's no pattern to the behaviour - it's unpredictable.
If I could give you something repeatable, I would (exactly like I did yesterday). In fact, as far back as Sept 22nd I posted this output which I see consistently on those occasions when the debugger fails to work at all:-
--- Code: ---Setting breakpoints
Debugger name and version: GNU gdb 6.5
Continuing...
No symbol table is loaded. Use the "file" command.
--- End code ---
That's just about all the feedback I get so I don't know what more I could give you. Maybe tomorrow (without me changing anything) it'll suddenly start working again. i just never know....
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version