DBG Breakpoints, fixed ghost dublicates. gdb would get 2 breakpoints for one, if source was edited at time breakpoint was inserted

git-svn-id: trunk@28300 -
This commit is contained in:
martin 2010-11-17 22:46:43 +00:00
parent 4914d6170a
commit 7283a6aa2f
3 changed files with 9 additions and 45 deletions

View File

@ -2360,9 +2360,6 @@ end;
procedure TBaseBreakPoint.SetLocation (const ASource: String; const ALine: Integer );
begin
{$IFDEF DBG_VERBOSE_BRKPOINT}
debugln(['-*- TBaseBreakPoint.SetLocation',Dbgs(Self), ':', DbgsName(Self), ' Src=', Source, ' Line=',Line]);
{$ENDIF}
if (FSource = ASource) and (FLine = ALine) then exit;
FSource := ASource;
FLine := ALine;
@ -2371,9 +2368,6 @@ end;
procedure TBaseBreakPoint.SetValid(const AValue: TValidState );
begin
{$IFDEF DBG_VERBOSE_BRKPOINT}
debugln(['-*- TBaseBreakPoint.SetValid',Dbgs(Self), ':', DbgsName(Self), ' Src=', Source, ' Line=',Line]);
{$ENDIF}
if FValid <> AValue
then begin
FValid := AValue;
@ -2443,9 +2437,6 @@ end;
constructor TIDEBreakPoint.Create(ACollection: TCollection);
begin
{$IFDEF DBG_VERBOSE_BRKPOINT}
debugln(['-*- TIDEBreakPoint.Create ',Dbgs(Self), ':', DbgsName(Self)]);
{$ENDIF}
inherited Create(ACollection);
FGroup := nil;
FActions := [bpaStop];
@ -2455,9 +2446,6 @@ end;
destructor TIDEBreakPoint.Destroy;
begin
{$IFDEF DBG_VERBOSE_BRKPOINT}
debugln(['-*- TIDEBreakPoint.Create ',Dbgs(Self), ':', DbgsName(Self), ' Src=', Source, ' Line=',Line]);
{$ENDIF}
if (TIDEBreakPoints(Collection) <> nil)
then TIDEBreakPoints(Collection).NotifyRemove(Self);
@ -2714,9 +2702,6 @@ procedure TDBGBreakPoint.Hit(var ACanContinue: Boolean);
var
cnt: Integer;
begin
{$IFDEF DBG_VERBOSE_BRKPOINT}
debugln(['-*- TDBGBreakPoint.Hit ',Dbgs(Self), ':', DbgsName(Self), ' Src=', Source, ' Line=',Line]);
{$ENDIF}
cnt := HitCount + 1;
if BreakHitcount > 0
then ACanContinue := cnt < BreakHitcount;
@ -2753,9 +2738,6 @@ end;
procedure TDBGBreakPoint.SetSlave(const ASlave : TBaseBreakPoint);
begin
{$IFDEF DBG_VERBOSE_BRKPOINT}
debugln(['-*- TDBGBreakPoint.SetSlave ',Dbgs(Self), ':', DbgsName(Self),' CurSlave=', Dbgs(FSlave), ':', DbgsName(FSlave), ' NewSlave=', Dbgs(ASlave), ':', DbgsName(ASlave), ' Src=', Source, ' Line=',Line]);
{$ENDIF}
Assert(FSlave = nil, 'TDBGBreakPoint.SetSlave already has a slave');
FSlave := ASlave;
end;

View File

@ -5178,18 +5178,12 @@ end;
constructor TGDBMIBreakPoint.Create(ACollection: TCollection);
begin
{$IFDEF DBG_VERBOSE_BRKPOINT}
debugln(['-*- TGDBMIBreakPoint.Create ',Dbgs(Self), ':', DbgsName(Self)]);
{$ENDIF}
inherited Create(ACollection);
FBreakID := 0;
end;
destructor TGDBMIBreakPoint.Destroy;
begin
{$IFDEF DBG_VERBOSE_BRKPOINT}
debugln(['-*- TGDBMIBreakPoint.Destroy ',Dbgs(Self), ':', DbgsName(Self), ' BreakId=',FBreakID, ' Src=', Source, ' Line=',Line]);
{$ENDIF}
ReleaseBreakPoint;
inherited Destroy;
end;
@ -5229,9 +5223,6 @@ end;
procedure TGDBMIBreakPoint.SetBreakpoint;
begin
{$IFDEF DBG_VERBOSE_BRKPOINT}
debugln(['-*- TGDBMIBreakPoint.SetBreakPoint ',Dbgs(Self), ':', DbgsName(Self), ' BreakId=',FBreakID, ' Debugger=', Dbgs(Debugger), ':', DbgsName(Debugger), ' Src=', Source, ' Line=',Line]);
{$ENDIF}
if Debugger = nil then Exit;
if FBreakID <> 0
@ -5252,9 +5243,6 @@ procedure TGDBMIBreakPoint.SetBreakPointCallback(const AResult: TGDBMIExecResult
var
ResultList: TGDBMINameValueList;
begin
{$IFDEF DBG_VERBOSE_BRKPOINT}
debugln(['-*- TGDBMIBreakPoint.SetBreakPointCallback ',Dbgs(Self), ':', DbgsName(Self), ' BreakId=',FBreakID, ' Debugger=', Dbgs(Debugger), ':', DbgsName(Debugger), ' State=', dbgs(TGDBMIDebugger(Debugger).State)]);
{$ENDIF}
BeginUpdate;
try
ResultList := TGDBMINameValueList.Create(AResult, ['bkpt']);
@ -5287,9 +5275,6 @@ end;
procedure TGDBMIBreakPoint.ReleaseBreakPoint;
begin
{$IFDEF DBG_VERBOSE_BRKPOINT}
debugln(['-*- TGDBMIBreakPoint.ReleaseBreakPoint ',Dbgs(Self), ':', DbgsName(Self), ' BreakId=',FBreakID, ' Debugger=', Dbgs(Debugger), ':', DbgsName(Debugger), ' Src=', Source, ' Line=',Line]);
{$ENDIF}
if FBreakID = 0 then Exit;
if Debugger = nil then Exit;
@ -5302,9 +5287,6 @@ end;
procedure TGDBMIBreakPoint.SetLocation(const ASource: String; const ALine: Integer);
begin
{$IFDEF DBG_VERBOSE_BRKPOINT}
debugln(['-*- TGDBMIBreakPoint.SetLocation ',Dbgs(Self), ':', DbgsName(Self), ' BreakId=',FBreakID, ' Debugger=', Dbgs(Debugger), ':', DbgsName(Debugger) ]);
{$ENDIF}
if (Source = ASource) and (Line = ALine) then exit;
inherited;
if Debugger = nil then Exit;
@ -5317,9 +5299,6 @@ const
// Use shortstring as fix for fpc 1.9.5 [2004/07/15]
CMD: array[Boolean] of ShortString = ('disable', 'enable');
begin
{$IFDEF DBG_VERBOSE_BRKPOINT}
debugln(['-*- TGDBMIBreakPoint.UpdateEnable ',Dbgs(Self), ':', DbgsName(Self), ' BreakId=',FBreakID, ' Debugger=', Dbgs(Debugger), ':', DbgsName(Debugger) ]);
{$ENDIF}
if FBreakID = 0 then Exit;
if Debugger = nil then Exit;
@ -5331,9 +5310,6 @@ end;
procedure TGDBMIBreakPoint.UpdateExpression;
begin
{$IFDEF DBG_VERBOSE_BRKPOINT}
debugln(['-*- TGDBMIBreakPoint.UpdateExpression ',Dbgs(Self), ':', DbgsName(Self), ' BreakId=',FBreakID, ' Debugger=', Dbgs(Debugger), ':', DbgsName(Debugger), ' State=', dbgs(TGDBMIDebugger(Debugger).State)]);
{$ENDIF}
if FBreakID = 0 then Exit;
if Debugger = nil then Exit;

View File

@ -1083,7 +1083,7 @@ begin
if FManager.FDebugger <> nil
then begin
BP := FManager.FDebugger.BreakPoints.Add(ABreakpoint.Source, ABreakpoint.Line);
BP := FManager.FDebugger.BreakPoints.Add(ABreakpoint.Source, TManagedBreakPoint(ABreakpoint).DebugExeLine);
BP.Assign(ABreakPoint);
end;
FManager.CreateSourceMarkForBreakPoint(ABreakpoint,nil);
@ -1344,11 +1344,17 @@ begin
end;
function TManagedBreakPoint.DebugExeLine: Integer;
var
se: TSourceEditor;
begin
Result := Line;
if (FSourceMark <> nil) and (FSourceMark.SourceEditor <> nil) then
Result := TSourceEditor(FSourceMark.SourceEditor).SourceToDebugLine(Line)
else
Result := Line;
else begin
se := SourceEditorManager.SourceEditorIntfWithFilename(Source);
if se <> nil
then Result := se.SourceToDebugLine(Line);
end;
end;
procedure TManagedBreakPoint.UpdateSourceMark;