debugging, added enum to identify bp modifications

This commit is contained in:
Basile Burg 2015-10-16 17:23:31 +02:00
parent a3aa014085
commit f81af3aa03
2 changed files with 9 additions and 7 deletions

View File

@ -42,7 +42,7 @@ type
procedure startDebugging; procedure startDebugging;
procedure killGdb; procedure killGdb;
procedure updateFileLineBrks; procedure updateFileLineBrks;
procedure editorModBrk(sender: TCESynMemo; line: integer; removed: boolean); procedure editorModBrk(sender: TCESynMemo; line: integer; modification: TBreakPointModification);
// GDB output processors // GDB output processors
procedure processInfoRegs(sender: TObject); procedure processInfoRegs(sender: TObject);
procedure processInfoStack(sender: TObject); procedure processInfoStack(sender: TObject);
@ -181,12 +181,12 @@ begin
end; end;
end; end;
procedure TCEGdbWidget.editorModBrk(sender: TCESynMemo; line: integer; removed: boolean); procedure TCEGdbWidget.editorModBrk(sender: TCESynMemo; line: integer; modification: TBreakPointModification);
var var
str: string; str: string;
nme: string; nme: string;
const const
cmd: array[boolean] of string = ('break ', 'clear '); cmd: array[TBreakPointModification] of string = ('break ', 'clear ');
begin begin
// set only breakpoint in live, while debugging // set only breakpoint in live, while debugging
// note: only works if execution is paused (breakpoint) // note: only works if execution is paused (breakpoint)
@ -196,7 +196,7 @@ begin
nme := sender.fileName; nme := sender.fileName;
if not FileExists(nme) then exit; if not FileExists(nme) then exit;
// //
str := cmd[removed] + nme + ':' + intToStr(line); str := cmd[modification] + nme + ':' + intToStr(line);
fGdb.Suspend; fGdb.Suspend;
gdbCommand(str); gdbCommand(str);
fGdb.Resume; fGdb.Resume;

View File

@ -16,9 +16,11 @@ type
TCESynMemo = class; TCESynMemo = class;
TBreakPointModification = (bpAdded, bpRemoved);
// breakpoint added or removed // breakpoint added or removed
TBreakPointModifyEvent = procedure(sender: TCESynMemo; line: integer; TBreakPointModifyEvent = procedure(sender: TCESynMemo; line: integer;
removed: boolean) of object; modification: TBreakPointModification) of object;
// Simple THintWindow descendant allowing the font size to be in sync with the editor. // Simple THintWindow descendant allowing the font size to be in sync with the editor.
TCEEditorHintWindow = class(THintWindow) TCEEditorHintWindow = class(THintWindow)
@ -1103,7 +1105,7 @@ begin
fBreakPoints.Add(pointer(line)); fBreakPoints.Add(pointer(line));
{$WARNINGS ON} {$WARNINGS ON}
if assigned(fBreakpointEvent) then if assigned(fBreakpointEvent) then
fBreakpointEvent(self, line, false); fBreakpointEvent(self, line, bpAdded);
end; end;
procedure TCESynMemo.removeBreakPoint(line: integer); procedure TCESynMemo.removeBreakPoint(line: integer);
@ -1116,7 +1118,7 @@ begin
fBreakPoints.Remove(pointer(line)); fBreakPoints.Remove(pointer(line));
{$WARNINGS ON} {$WARNINGS ON}
if assigned(fBreakpointEvent) then if assigned(fBreakpointEvent) then
fBreakpointEvent(self, line, true); fBreakpointEvent(self, line, bpRemoved);
end; end;
function TCESynMemo.findBreakPoint(line: integer): boolean; function TCESynMemo.findBreakPoint(line: integer): boolean;