DBG: added debugln/verbose for breakpoints

git-svn-id: trunk@28253 -
This commit is contained in:
martin 2010-11-15 19:39:26 +00:00
parent 78878863ea
commit 14b597be41
2 changed files with 56 additions and 1 deletions

View File

@ -1610,6 +1610,9 @@ function DBGCommandNameToCommand(const s: string): TDBGCommand;
function DBGStateNameToState(const s: string): TDBGState;
function DBGBreakPointActionNameToAction(const s: string): TIDEBreakPointAction;
function dbgs(AState: TDBGState): String; overload;
function dbgs(ADisassRange: TDBGDisassemblerEntryRange): String; overload;
(******************************************************************************)
(******************************************************************************)
(******************************************************************************)
@ -1635,6 +1638,11 @@ const
var
MDebuggerPropertiesList: TStringlist;
function dbgs(AState: TDBGState): String; overload;
begin
Result := DBGStateNames[AState];
end;
function dbgs(ADisassRange: TDBGDisassemblerEntryRange): String; overload;
var
fo: Integer;
@ -2323,6 +2331,9 @@ 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;
@ -2331,6 +2342,9 @@ 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;
@ -2400,6 +2414,9 @@ 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];
@ -2409,6 +2426,9 @@ 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);
@ -2665,6 +2685,9 @@ 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;
@ -2701,6 +2724,9 @@ 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

@ -4320,7 +4320,12 @@ begin
end;
if (State = dsRun) and (FTargetPID <> 0) // not in startup
then begin
debugln('WARNING: breakpoint hit, but nothing known about it');
debugln(['WARNING: breakpoint hit, but nothing known about it BreakId=', BreakID, ' brbtno=', List.Values['bkptno'] ]);
{$IFDEF DBG_VERBOSE_BRKPOINT}
debugln(['-*- List of breakpoints Cnt=', Breakpoints.Count]);
for BreakID := 0 to Breakpoints.Count - 1 do
debugln(['* ',Dbgs(Breakpoints[BreakID]), ':', DbgsName(Breakpoints[BreakID]), ' BreakId=',TGDBMIBreakPoint(Breakpoints[BreakID]).FBreakID, ' Source=', Breakpoints[BreakID].Source, ' Line=', Breakpoints[BreakID].Line ]);
{$ENDIF}
SetState(dsPause);
end;
Exit;
@ -4961,12 +4966,18 @@ 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;
@ -5006,6 +5017,9 @@ 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
@ -5026,6 +5040,9 @@ 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']);
@ -5058,6 +5075,9 @@ 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;
@ -5070,6 +5090,9 @@ 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;
@ -5082,6 +5105,9 @@ 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;
@ -5093,6 +5119,9 @@ 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;