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

View File

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

View File

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