DBG: more debugLN

git-svn-id: trunk@31160 -
This commit is contained in:
martin 2011-06-10 23:15:51 +00:00
parent 63c8a49109
commit 066a27820b
5 changed files with 67 additions and 26 deletions

View File

@ -174,7 +174,7 @@ end;
procedure TCallStackDlg.CallStackChanged(Sender: TObject);
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCallStackDlg.CallStackChanged from ', DbgSName(Sender), ' Upd:', IsUpdating]); {$ENDIF}
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataWindow: TCallStackDlg.CallStackChanged from ', DbgSName(Sender), ' Upd:', IsUpdating]); {$ENDIF}
if not ToolButtonPower.Down then exit;
if FViewStart = 0
then UpdateView
@ -184,7 +184,7 @@ end;
procedure TCallStackDlg.CallStackCurrent(Sender: TObject);
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCallStackDlg.CallStackCurrent from ', DbgSName(Sender), ' Upd:', IsUpdating]); {$ENDIF}
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataWindow: TCallStackDlg.CallStackCurrent from ', DbgSName(Sender), ' Upd:', IsUpdating]); {$ENDIF}
if not ToolButtonPower.Down then exit;
UpdateView;
end;
@ -239,7 +239,7 @@ begin
Include(FUpdateFlags, ufNeedUpdating);
exit;
end;
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCallStackDlg.UpdateView']); {$ENDIF}
{$IFDEF DBG_DATA_MONITORS} try DebugLnEnter(['DebugDataMonitor: >>ENTER: TCallStackDlg.UpdateView']); {$ENDIF}
Exclude(FUpdateFlags, ufNeedUpdating);
@ -332,6 +332,7 @@ begin
lvCallStack.EndUpdate;
EndUpdate;
end;
{$IFDEF DBG_DATA_MONITORS} finally DebugLnExit(['DebugDataMonitor: <<EXIT: TCallStackDlg.UpdateView']); end; {$ENDIF}
end;
procedure TCallStackDlg.DoBeginUpdate;

View File

@ -2584,6 +2584,7 @@ function DBGBreakPointActionNameToAction(const s: string): TIDEBreakPointAction;
function dbgs(AState: TDBGState): String; overload;
function dbgs(ADisassRange: TDBGDisassemblerEntryRange): String; overload;
function dbgs(ADataState: TDebuggerDataState): String; overload;
function HasConsoleSupport: Boolean;
(******************************************************************************)
@ -2619,6 +2620,11 @@ begin
Result := DBGStateNames[AState];
end;
function dbgs(ADataState: TDebuggerDataState): String;
begin
writestr(Result, ADataState);
end;
function dbgs(ADisassRange: TDBGDisassemblerEntryRange): String; overload;
var
fo: Integer;
@ -2980,6 +2986,7 @@ procedure TSnapshotManager.DoStateChange(const AOldState: TDBGState);
begin
if FDebugger = nil then exit;
FCurrentState := Debugger.State;
{$IFDEF DBG_DATA_MONITORS} DebugLnEnter(['DebugDataMonitor: >>ENTER: TSnapshotManager.DoStateChange New-State=', DBGStateNames[FCurrentState]]); {$ENDIF}
BeginUpdate;
try
@ -3003,6 +3010,7 @@ begin
finally
EndUpdate;
end;
{$IFDEF DBG_DATA_MONITORS} DebugLnExit(['DebugDataMonitor: <<EXIT: TSnapshotManager.DoStateChange']); {$ENDIF}
end;
procedure TSnapshotManager.DoDebuggerIdle(AForce: Boolean = False);
@ -3327,6 +3335,7 @@ end;
procedure TLocalsSupplier.DoStateChange(const AOldState: TDBGState);
begin
if (Debugger = nil) or (CurrentLocalsList = nil) then Exit;
{$IFDEF DBG_DATA_MONITORS} DebugLnEnter(['DebugDataMonitor: >>ENTER: TLocalsSupplier.DoStateChange New-State=', DBGStateNames[Debugger.State ]]); {$ENDIF}
if FDebugger.State in [dsPause, dsInternalPause]
then begin
@ -3342,6 +3351,7 @@ begin
then Monitor.Clear;
end;
end;
{$IFDEF DBG_DATA_MONITORS} DebugLnExit(['DebugDataMonitor: <<EXIT: TLocalsSupplier.DoStateChange']); {$ENDIF}
end;
{ TLocalsMonitor }
@ -3507,6 +3517,7 @@ function TCurrentWatchValueList.CreateEntry(const AThreadId: Integer;
var
R: TWatchValue;
begin
{$IFDEF DBG_DATA_MONITORS} try DebugLnEnter(['DebugDataMonitor: >>ENTER: TCurrentWatchValueList.CreateEntry AThreadId=', AThreadId, ' AStackFrame=',AStackFrame, ' Expr=', FWatch.Expression]); {$ENDIF}
Result := TCurrentWatchValue.Create(FWatch, AThreadId, AStackFrame, ADisplayFormat);
Add(Result);
if FSnapShot <> nil then begin
@ -3514,6 +3525,7 @@ begin
FSnapShot.Add(R);
TCurrentWatchValue(Result).SnapShot := R;
end;
{$IFDEF DBG_DATA_MONITORS} finally DebugLnExit(['DebugDataMonitor: <<EXIT: TCurrentWatchValueList.CreateEntry']); end; {$ENDIF}
end;
{ TWatchValueList }
@ -3643,6 +3655,7 @@ end;
procedure TWatchValue.SetValidity(const AValue: TDebuggerDataState);
begin
if FValidity = AValue then exit;
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TWatchValue.SetValidity: FThreadId=', FThreadId, ' FStackFrame=',FStackFrame, ' Expr=', FWatch.Expression, ' AValidity=',dbgs(AValue)]); {$ENDIF}
FValidity := AValue;
ValidityChanged;
end;
@ -3733,6 +3746,7 @@ procedure TWatchesSupplier.DoStateChange(const AOldState: TDBGState);
begin
if (Debugger = nil) or (CurrentWatches = nil) then Exit;
FNotifiedState := Debugger.State;
{$IFDEF DBG_DATA_MONITORS} DebugLnEnter(['DebugDataMonitor: >>ENTER: TWatchesSupplier.DoStateChange New-State=', DBGStateNames[FNotifiedState]]); {$ENDIF}
if FDebugger.State in [dsPause, dsInternalPause]
then begin
@ -3744,10 +3758,11 @@ begin
if (AOldState in [dsPause, dsInternalPause]) or (AOldState = dsNone) { Force clear on initialisation }
then begin
CurrentWatches.ClearValues;
CurrentWatches.ClearValues; // TODO: block the update calls, update will be done for all on next line
Monitor.NotifyUpdate(CurrentWatches, nil);
end;
end;
{$IFDEF DBG_DATA_MONITORS} DebugLnExit(['DebugDataMonitor: <<EXIT: TWatchesSupplier.DoStateChange']); {$ENDIF}
end;
constructor TWatchesSupplier.Create(const ADebugger: TDebugger);
@ -4080,6 +4095,7 @@ end;
procedure TCurrentCallStack.SetCountValidity(AValidity: TDebuggerDataState);
begin
if FCountValidity = AValidity then exit;
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCurrentCallStack.SetCountValidity: FThreadId=', FThreadId, ' AValidity=',dbgs(AValidity)]); {$ENDIF}
FCountValidity := AValidity;
FMonitor.NotifyChange;
end;
@ -4087,6 +4103,7 @@ end;
procedure TCurrentCallStack.SetCurrentValidity(AValidity: TDebuggerDataState);
begin
if FCurrentValidity = AValidity then exit;
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCurrentCallStack.SetCurrentValidity: FThreadId=', FThreadId, ' AValidity=',dbgs(AValidity)]); {$ENDIF}
FCurrentValidity := AValidity;
FMonitor.NotifyCurrent;
end;
@ -4130,6 +4147,7 @@ var
begin
Result := inherited GetEntryForThread(AThreadId);
if Result = nil then begin
{$IFDEF DBG_DATA_MONITORS} try DebugLnEnter(['DebugDataMonitor: >>ENTER: TCurrentCallStackList.GetEntryForThread: ThreadId=', AThreadId]); {$ENDIF}
Result := TCurrentCallStack.Create(FMonitor);
Result.ThreadId := AThreadId;
Add(Result);
@ -4139,6 +4157,7 @@ begin
FSnapShot.Add(R);
TCurrentCallStack(Result).SnapShot := R;
end;
{$IFDEF DBG_DATA_MONITORS} finally DebugLnExit(['DebugDataMonitor: <<EXIT: TCurrentCallStackList.GetEntryForThread' ]) end; {$ENDIF}
end;
end;
@ -4251,6 +4270,7 @@ end;
procedure TCurrentThreads.SetValidity(AValidity: TDebuggerDataState);
begin
if FDataValidity = AValidity then exit;
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCurrentThreads.SetValidity ', dbgs(AValidity)]); {$ENDIF}
// Assign snapshot, if old data wasn't final
if (FDataValidity in [ddsUnknown, ddsEvaluating, ddsRequested]) and (FSnapShot <> nil)
@ -4265,6 +4285,7 @@ end;
procedure TCurrentThreads.SetCurrentThreadId(const AValue: Integer);
begin
if FCurrentThreadId = AValue then exit;
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCurrentThreads.SetCurrentThreadId ', AValue]); {$ENDIF}
inherited SetCurrentThreadId(AValue);
FMonitor.CurrentChanged; // TODO ChangedSelection
end;
@ -4338,6 +4359,7 @@ end;
procedure TThreadsSupplier.DoStateChange(const AOldState: TDBGState);
begin
if (Debugger = nil) or (CurrentThreads = nil) then Exit;
{$IFDEF DBG_DATA_MONITORS} DebugLnEnter(['DebugDataMonitor: >>ENTER: TThreadsSupplier.DoStateChange New-State=', DBGStateNames[Debugger.State ]]); {$ENDIF}
if Debugger.State in [dsPause, dsInternalPause]
then begin
@ -4352,6 +4374,7 @@ begin
then Monitor.Clear;
end;
end;
{$IFDEF DBG_DATA_MONITORS} DebugLnExit(['DebugDataMonitor: <<EXIT: TThreadsSupplier.DoStateChange']); {$ENDIF}
end;
{ TThreadsMonitor }
@ -4397,7 +4420,7 @@ end;
procedure TThreadsMonitor.CurrentChanged;
begin
FNotificationList.NotifyChange(Self);
FNotificationList.NotifyChange(Self); // TODO: is this required?? It should not
FNotificationList.NotifyCurrent(Self);
end;
@ -4418,6 +4441,7 @@ end;
procedure TThreadsMonitor.Clear;
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TThreadsMonitor.Clear']); {$ENDIF}
FCurrentThreads.Clear;
Changed;
end;
@ -7683,6 +7707,7 @@ end;
procedure TCallStackMonitor.UpdateCurrentIndex;
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCallStackMonitor.UpdateCurrentIndex']); {$ENDIF}
if Supplier <> nil then Supplier.UpdateCurrentIndex;
NotifyCurrent;
end;
@ -7695,6 +7720,7 @@ end;
procedure TCallStackMonitor.CallStackClear(Sender: TObject);
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCallStackMonitor.CallStackClear']); {$ENDIF}
// Don't clear, set it to 0 so there are no entries shown
//SetCount(0);
NotifyChange;
@ -7738,6 +7764,7 @@ end;
procedure TCallStackSupplier.Changed;
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCallStackSupplier.Changed']); {$ENDIF}
Monitor.NotifyChange;
end;
@ -7773,6 +7800,7 @@ var
e: TCallStackEntry;
It: TMapIterator;
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCallStackSupplier.RequestEntries']); {$ENDIF}
It := TMapIterator.Create(ACallstack.FEntries);
if not It.Locate(ACallstack.LowestUnknown )
@ -7793,6 +7821,7 @@ end;
procedure TCallStackSupplier.CurrentChanged;
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCallStackSupplier.CurrentChanged']); {$ENDIF}
if Monitor <> nil
then Monitor.NotifyCurrent;
end;
@ -7800,6 +7829,7 @@ end;
procedure TCallStackSupplier.DoStateChange(const AOldState: TDBGState);
begin
if (Debugger = nil) or (CurrentCallStackList = nil) then Exit;
{$IFDEF DBG_DATA_MONITORS} DebugLnEnter(['DebugDataMonitor: >>ENTER: TCallStackSupplier.DoStateChange New-State=', DBGStateNames[Debugger.State ]]); {$ENDIF}
if FDebugger.State in [dsPause, dsInternalPause]
then begin
@ -7815,6 +7845,7 @@ begin
Monitor.CallStackClear(Self);
end;
end;
{$IFDEF DBG_DATA_MONITORS} DebugLnExit(['DebugDataMonitor: <<EXIT: TCallStackSupplier.DoStateChange']); {$ENDIF}
end;
procedure TCallStackSupplier.UpdateCurrentIndex;

View File

@ -36,7 +36,7 @@ unit LocalsDlg;
interface
uses
SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ClipBrd,
SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ClipBrd, LCLProc,
ComCtrls, ActnList, Menus, BaseDebugManager, Debugger, DebuggerDlg;
type
@ -65,7 +65,7 @@ type
procedure actInspectUpdate(Sender: TObject);
procedure actWathExecute(Sender: TObject);
private
procedure ContextChanged(Sender: TObject);
FUpdateFlags: set of (ufNeedUpdating);
procedure LocalsChanged(Sender: TObject);
function GetThreadId: Integer;
function GetSelectedThreads(Snap: TSnapshot): TThreads;
@ -97,7 +97,7 @@ begin
inherited Create(AOwner);
LocalsNotification.OnChange := @LocalsChanged;
ThreadsNotification.OnCurrent := @LocalsChanged;
CallstackNotification.OnCurrent := @ContextChanged;
CallstackNotification.OnCurrent := @LocalsChanged;
SnapshotNotification.OnCurrent := @LocalsChanged;
Caption:= lisLocals;
@ -153,11 +153,6 @@ begin
Clipboard.Close;
end;
procedure TLocalsDlg.ContextChanged(Sender: TObject);
begin
LocalsChanged(nil);
end;
procedure TLocalsDlg.LocalsChanged(Sender: TObject);
var
n, idx: Integer;
@ -171,6 +166,15 @@ begin
lvLocals.Items.Clear;
exit;
end;
if IsUpdating then begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataWindow: TLocalsDlg.LocalsChanged in IsUpdating']); {$ENDIF}
Include(FUpdateFlags, ufNeedUpdating);
exit;
end;
Exclude(FUpdateFlags, ufNeedUpdating);
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TLocalsDlg.LocalsChanged']); {$ENDIF}
if GetStackframe < 0 then begin // TODO need dedicated validity property
lvLocals.Items.Clear;
exit;
@ -302,6 +306,7 @@ end;
procedure TLocalsDlg.DoEndUpdate;
begin
if ufNeedUpdating in FUpdateFlags then LocalsChanged(nil);
lvLocals.EndUpdate;
end;

View File

@ -50,12 +50,12 @@ var
Snap: TSnapshot;
begin
if IsUpdating then begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TThreadsDlg.ThreadsChanged from ', DbgSName(Sender), ' in IsUpdating']); {$ENDIF}
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataWindow: TThreadsDlg.ThreadsChanged from ', DbgSName(Sender), ' in IsUpdating']); {$ENDIF}
Include(FUpdateFlags, ufThreadChanged);
exit;
end;
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TThreadsDlg.ThreadsChanged from ', DbgSName(Sender)]); {$ENDIF}
{$IFDEF DBG_DATA_MONITORS} try DebugLnEnter(['DebugDataMonitor: >>ENTER: TThreadsDlg.ThreadsChanged from ', DbgSName(Sender)]); {$ENDIF}
Exclude(FUpdateFlags, ufThreadChanged);
if ThreadsMonitor = nil then begin
@ -112,6 +112,7 @@ begin
lvThreads.Items[i].SubItems[5] := Threads[i].GetFunctionWithArg;
lvThreads.Items[i].Data := Threads[i];
end;
{$IFDEF DBG_DATA_MONITORS} finally DebugLnExit(['DebugDataMonitor: <<EXIT: TThreadsDlg.ThreadsChanged']); end; {$ENDIF}
end;
procedure TThreadsDlg.tbCurrentClick(Sender: TObject);

View File

@ -370,7 +370,7 @@ end;
procedure TWatchesDlg.ContextChanged(Sender: TObject);
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TWatchesDlg.ContextChanged ', DbgSName(Sender), ' Upd:', IsUpdating]); {$ENDIF}
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataWindow: TWatchesDlg.ContextChanged ', DbgSName(Sender), ' Upd:', IsUpdating]); {$ENDIF}
UpdateAll;
end;
@ -440,7 +440,7 @@ procedure TWatchesDlg.SnapshotChanged(Sender: TObject);
var
NewWatches: TWatches;
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TWatchesDlg.SnapshotChanged ', DbgSName(Sender), ' Upd:', IsUpdating]); {$ENDIF}
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataWindow: TWatchesDlg.SnapshotChanged ', DbgSName(Sender), ' Upd:', IsUpdating]); {$ENDIF}
lvWatches.BeginUpdate;
try
NewWatches := Watches;
@ -620,18 +620,19 @@ var
i, l: Integer;
Snap: TSnapshot;
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['UpdateAll: TWatchesDlg.UpdateAll Upd:', IsUpdating]); {$ENDIF}
if Watches = nil then exit;
if IsUpdating then begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataWindow: TWatchesDlg.UpdateAll: TWatchesDlg.UpdateAll in IsUpdating:']); {$ENDIF}
FUpdateAllNeeded := True;
exit;
end;
{$IFDEF DBG_DATA_MONITORS} try DebugLnEnter(['DebugDataWindow: TWatchesDlg.UpdateAll: >>ENTER: TWatchesDlg.UpdateAll ']); {$ENDIF}
Snap := GetSelectedSnapshot;
if Snap <> nil
then Caption:= liswlWatchList + ' (' + Snap.LocationAsText + ')'
else Caption:= liswlWatchList;
if Watches = nil then exit;
if UpdateCount > 0 then begin
FUpdateAllNeeded := True;
exit;
end;
FUpdatingAll := True;
lvWatches.BeginUpdate;
try
@ -650,6 +651,7 @@ begin
lvWatches.EndUpdate;
lvWatchesSelectItem(nil, nil, False);
end;
{$IFDEF DBG_DATA_MONITORS} finally DebugLnExit(['DebugDataWindow: TWatchesDlg.UpdateAll: <<EXIT: TWatchesDlg.UpdateAll ']); end; {$ENDIF}
end;
procedure TWatchesDlg.DisableAllActions;
@ -692,9 +694,9 @@ procedure TWatchesDlg.WatchUpdate(const ASender: TWatches; const AWatch: TWatch)
var
Item: TListItem;
begin
if AWatch = nil then Exit;
if AWatch = nil then Exit; // TODO: update all
if AWatch.Collection <> FWatchesInView then exit;
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TWatchesDlg.WatchUpdate Upd:', IsUpdating, ' Watch=',AWatch.Expression]); {$ENDIF}
{$IFDEF DBG_DATA_MONITORS} try DebugLnEnter(['DebugDataWindow: TWatchesDlg.WatchUpdate Upd:', IsUpdating, ' Watch=',AWatch.Expression]); {$ENDIF}
Item := lvWatches.Items.FindData(AWatch);
if Item = nil
@ -703,6 +705,7 @@ begin
if not FUpdatingAll
then lvWatchesSelectItem(nil, nil, False);
{$IFDEF DBG_DATA_MONITORS} finally DebugLnExit(['DebugDataWindow: TWatchesDlg.WatchUpdate']); end; {$ENDIF}
end;
procedure TWatchesDlg.WatchRemove(const ASender: TWatches; const AWatch: TWatch);