I found and fixed some bugs regarding the debugger.
The bug report 825915 is pretty vague about what
doesn't work in the debugger, but I have a feeling this
probably fixes most of that. The fixes are as follows:
Dev-Cpp was keeping an array of break points. The ID
of the breakpoint was its index in the array.
Therefore if you have 2 breakpoints set, they would
have ID 1 and 2. Removing and adding breakpoints
always kept the max ID == to the number of breakpoints
in the array. So if you had 4 breakpoints, and removed
2 the next breakpoint added would have id 3.
However, GDB does not work this way. It continues to
number breakpoints in chronological order regardless if
breakpoint 1 is no longer set. That is, if you have 4
breakpoints in GDB and deleted 2, your next breakpoint
would have ID 5.
i fixed this by adding a class variable BreakPointIndex
to TGdbBreakPoint. Each time a new breakpoint is set,
a value gets incremented. The new breakpoint then
takes this incremented value as its index. This index
is what is sent to GDB, not the index into the
breakpoint array.
This fixes the problem of adding a breakpoint, then
removing it and having Dev-Cpp continue to stop at this
point even after the breakpoint is gone.
I also added a boolean called IsBroken in
DebugWait.pas. If the debugger is running and not
broken on a breakpoint, this is false. When IsBroken
is false you cannot add a breakpoint in Dev-Cpp. I was
annoyed because you could click in the gutter of the
editor and a red dot would appear indicating a
breakpoint was set when GDB was running. However, GDB
had no knowledge of this breakpoint. Disabling the
addition of a breakpoint while the debugger is not
broken removes this ambiguity.
I also worked on RunToCursor. Mainly I added
TurnOnBreakpoint and TurnOffBreakpoint to editor.pas.
Ocasionally RunToCursor would get confused and Toggle
somewhere where it shouldn't. If there was no
breakpoint at this location, it would turn it on.
Writing explicit functions to turn on or turn off a
breakpoint removes any chance of this happening.
I changed the following files:
Debugger.pas
editor.pas
main.pas
debugwait.pas
In all of the places where I added a change I added
comments, as well as my initials RNC to indicate a
change that I made.
This is the first time that I've contributed to a
project, so please let me know if there is something
else that I need to do. Or if there is something I
did incorrectly.
4 source files
Logged In: YES
user_id=25510
Applied, thank you ! Next time please just try to create a diff
file against latest cvs source code.
Colin