DBG: move same debugln to LazLogger cmd-line config

git-svn-id: trunk@35339 -
This commit is contained in:
martin 2012-02-12 22:59:28 +00:00
parent 5b4d7f2b9a
commit 369017a0c5
6 changed files with 84 additions and 45 deletions

View File

@ -247,6 +247,8 @@ type
function RegisterLogGroup(const AConfigName: String; ADefaulEnabled: Boolean) : PLazLoggerLogGroup;
function RegisterLogGroup(const AConfigName: String) : PLazLoggerLogGroup;
function FindOrRegisterLogGroup(const AConfigName: String; ADefaulEnabled: Boolean) : PLazLoggerLogGroup;
function FindOrRegisterLogGroup(const AConfigName: String) : PLazLoggerLogGroup;
// comma separated list / not present = defaults (none unless emabled in code) / - means none
property ParamForEnabledLogGroups: String read FParamForEnabledLogGroups write SetParamForEnabledLogGroups;
property LogGroupList: TLazLoggerLogGroupList read GetLogGroupList;
@ -1464,6 +1466,31 @@ begin
Result^.Flags := Result^.Flags + [lgfNoDefaultEnabledSpecified];
end;
function TLazLogger.FindOrRegisterLogGroup(const AConfigName: String;
ADefaulEnabled: Boolean): PLazLoggerLogGroup;
begin
Result := LogGroupList.Find(AConfigName);
if Result = nil then
Result := RegisterLogGroup(AConfigName, ADefaulEnabled)
else
begin
if (lgfNoDefaultEnabledSpecified in Result^.Flags) and
not(lgfAddedByParamParser in Result^.Flags)
then
Result^.Enabled := ADefaulEnabled;
Result^.Flags := Result^.Flags - [lgfNoDefaultEnabledSpecified, lgfAddedByParamParser];
end;
end;
function TLazLogger.FindOrRegisterLogGroup(const AConfigName: String): PLazLoggerLogGroup;
begin
Result := LogGroupList.Find(AConfigName);
if Result = nil then
Result := RegisterLogGroup(AConfigName)
else
Result^.Flags := Result^.Flags - [lgfAddedByParamParser];
end;
procedure TLazLogger.DebuglnStack(const s: string);
begin
DebugLn(s);

View File

@ -36,7 +36,7 @@ unit CallStackDlg;
interface
uses
SysUtils, Classes, Controls, Forms, LCLProc,
SysUtils, Classes, Controls, Forms, LCLProc, LazLogger,
IDEWindowIntf, DebuggerStrConst,
ComCtrls, Debugger, DebuggerDlg, Menus, ClipBrd, ExtCtrls, StdCtrls,
ActnList, IDEImagesIntf, IDECommands;
@ -151,6 +151,7 @@ uses
BaseDebugManager, LazarusIDEStrConsts;
var
DBG_DATA_MONITORS: PLazLoggerLogGroup;
imgSourceLine: Integer;
imgNoSourceLine: Integer;
@ -199,7 +200,7 @@ end;
procedure TCallStackDlg.CallStackChanged(Sender: TObject);
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataWindow: TCallStackDlg.CallStackChanged from ', DbgSName(Sender), ' Upd:', IsUpdating]); {$ENDIF}
DebugLn(DBG_DATA_MONITORS, ['DebugDataWindow: TCallStackDlg.CallStackChanged from ', DbgSName(Sender), ' Upd:', IsUpdating]);
if not ToolButtonPower.Down then exit;
if FViewStart = 0
then UpdateView
@ -209,7 +210,7 @@ end;
procedure TCallStackDlg.CallStackCurrent(Sender: TObject);
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataWindow: TCallStackDlg.CallStackCurrent from ', DbgSName(Sender), ' Upd:', IsUpdating]); {$ENDIF}
DebugLn(DBG_DATA_MONITORS, ['DebugDataWindow: TCallStackDlg.CallStackCurrent from ', DbgSName(Sender), ' Upd:', IsUpdating]);
if not ToolButtonPower.Down then exit;
UpdateView;
end;
@ -273,11 +274,11 @@ var
begin
if (not ToolButtonPower.Down) or FInUpdateView then exit;
if IsUpdating then begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataWindow: TCallStackDlg.UpdateView in IsUpdating']); {$ENDIF}
DebugLn(DBG_DATA_MONITORS, ['DebugDataWindow: TCallStackDlg.UpdateView in IsUpdating']);
Include(FUpdateFlags, ufNeedUpdating);
exit;
end;
{$IFDEF DBG_DATA_MONITORS} try DebugLnEnter(['DebugDataWindow: >>ENTER: TCallStackDlg.UpdateView']); {$ENDIF}
try DebugLnEnter(DBG_DATA_MONITORS, ['DebugDataWindow: >>ENTER: TCallStackDlg.UpdateView']);
Exclude(FUpdateFlags, ufNeedUpdating);
@ -370,7 +371,7 @@ begin
lvCallStack.EndUpdate;
EndUpdate;
end;
{$IFDEF DBG_DATA_MONITORS} finally DebugLnExit(['DebugDataWindow: <<EXIT: TCallStackDlg.UpdateView']); end; {$ENDIF}
finally DebugLnExit(DBG_DATA_MONITORS, ['DebugDataWindow: <<EXIT: TCallStackDlg.UpdateView']); end;
end;
procedure TCallStackDlg.DoBeginUpdate;
@ -671,7 +672,7 @@ var
Entry: TCallStackEntry;
Stack: TCallStack;
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataWindow: TCallStackDlg.BreakPointChanged ', DbgSName(ASender), ' Upd:', IsUpdating]); {$ENDIF}
DebugLn(DBG_DATA_MONITORS, ['DebugDataWindow: TCallStackDlg.BreakPointChanged ', DbgSName(ASender), ' Upd:', IsUpdating]);
Stack := GetSelectedCallstack;
if (BreakPoints = nil) or (Stack = nil) then
Exit;
@ -820,5 +821,7 @@ initialization
CallStackDlgWindowCreator.DividerTemplate.Add('ColumnCStackFunc', COL_STACK_FUNC, drsColWidthFunc);
CallStackDlgWindowCreator.CreateSimpleLayout;
DBG_DATA_MONITORS := DebugLogger.FindOrRegisterLogGroup('DBG_DATA_MONITORS' {$IFDEF DBG_DATA_MONITORS} , True {$ENDIF} );
end.

View File

@ -2970,7 +2970,7 @@ function HasConsoleSupport: Boolean;
implementation
var
DBG_STATE, DBG_EVENTS, DBG_STATE_EVENT: PLazLoggerLogGroup;
DBG_STATE, DBG_EVENTS, DBG_STATE_EVENT, DBG_DATA_MONITORS: PLazLoggerLogGroup;
const
COMMANDMAP: array[TDBGState] of TDBGCommands = (
@ -4047,7 +4047,7 @@ begin
if FDebugger = nil then exit;
FCurrentState := Debugger.State;
FForcedIdle := False;
{$IFDEF DBG_DATA_MONITORS} DebugLnEnter(['DebugDataMonitor: >>ENTER: TSnapshotManager.DoStateChange New-State=', DBGStateNames[FCurrentState]]); {$ENDIF}
DebugLnEnter(DBG_DATA_MONITORS, ['DebugDataMonitor: >>ENTER: TSnapshotManager.DoStateChange New-State=', DBGStateNames[FCurrentState]]);
BeginUpdate;
try
@ -4072,7 +4072,7 @@ begin
finally
EndUpdate;
end;
{$IFDEF DBG_DATA_MONITORS} DebugLnExit(['DebugDataMonitor: <<EXIT: TSnapshotManager.DoStateChange']); {$ENDIF}
DebugLnExit(DBG_DATA_MONITORS, ['DebugDataMonitor: <<EXIT: TSnapshotManager.DoStateChange']);
end;
procedure TSnapshotManager.DoDebuggerIdle(AForce: Boolean = False);
@ -4087,7 +4087,7 @@ begin
if (not Debugger.IsIdle) and (not AForce) then exit;
Include(FUpdateFlags, ufInDebuggerIdle);
CurSnap := FCurrentSnapshot;
{$IFDEF DBG_DATA_MONITORS} DebugLnEnter(['DebugDataMonitor: >>ENTER: TSnapshotManager.DoDebuggerIdle New-State=', DBGStateNames[FCurrentState]]); {$ENDIF}
DebugLnEnter(DBG_DATA_MONITORS, ['DebugDataMonitor: >>ENTER: TSnapshotManager.DoDebuggerIdle New-State=', DBGStateNames[FCurrentState]]);
try
if not(smrThreads in FRequestsDone) then begin
@ -4143,7 +4143,7 @@ begin
end;
finally
Exclude(FUpdateFlags, ufInDebuggerIdle);
{$IFDEF DBG_DATA_MONITORS} DebugLnExit(['DebugDataMonitor: <<EXIT: TSnapshotManager.DoDebuggerIdle']); {$ENDIF}
DebugLnExit(DBG_DATA_MONITORS, ['DebugDataMonitor: <<EXIT: TSnapshotManager.DoDebuggerIdle']);
end;
end;
@ -4608,7 +4608,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}
try DebugLnEnter(DBG_DATA_MONITORS, ['DebugDataMonitor: >>ENTER: TCurrentWatchValueList.CreateEntry AThreadId=', AThreadId, ' AStackFrame=',AStackFrame, ' Expr=', FWatch.Expression]);
Result := TCurrentWatchValue.Create(FWatch, AThreadId, AStackFrame, ADisplayFormat);
Add(Result);
if FSnapShot <> nil then begin
@ -4616,7 +4616,7 @@ begin
FSnapShot.Add(R);
TCurrentWatchValue(Result).SnapShot := R;
end;
{$IFDEF DBG_DATA_MONITORS} finally DebugLnExit(['DebugDataMonitor: <<EXIT: TCurrentWatchValueList.CreateEntry']); end; {$ENDIF}
finally DebugLnExit(DBG_DATA_MONITORS, ['DebugDataMonitor: <<EXIT: TCurrentWatchValueList.CreateEntry']); end;
end;
{ TWatchValueList }
@ -4773,7 +4773,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}
DebugLn(DBG_DATA_MONITORS, ['DebugDataMonitor: TWatchValue.SetValidity: FThreadId=', FThreadId, ' FStackFrame=',FStackFrame, ' Expr=', FWatch.Expression, ' AValidity=',dbgs(AValue)]);
FValidity := AValue;
ValidityChanged;
end;
@ -5238,7 +5238,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}
DebugLn(DBG_DATA_MONITORS, ['DebugDataMonitor: TCurrentCallStack.SetCountValidity: FThreadId=', FThreadId, ' AValidity=',dbgs(AValidity)]);
FCountValidity := AValidity;
FMonitor.NotifyChange;
end;
@ -5246,7 +5246,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}
DebugLn(DBG_DATA_MONITORS, ['DebugDataMonitor: TCurrentCallStack.SetCurrentValidity: FThreadId=', FThreadId, ' AValidity=',dbgs(AValidity)]);
FCurrentValidity := AValidity;
if FCountValidity =ddsValid then
FMonitor.NotifyChange;
@ -5292,7 +5292,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}
try DebugLnEnter(DBG_DATA_MONITORS, ['DebugDataMonitor: >>ENTER: TCurrentCallStackList.GetEntryForThread: ThreadId=', AThreadId]);
Result := TCurrentCallStack.Create(FMonitor);
Result.ThreadId := AThreadId;
Add(Result);
@ -5302,7 +5302,7 @@ begin
FSnapShot.Add(R);
TCurrentCallStack(Result).SnapShot := R;
end;
{$IFDEF DBG_DATA_MONITORS} finally DebugLnExit(['DebugDataMonitor: <<EXIT: TCurrentCallStackList.GetEntryForThread' ]) end; {$ENDIF}
finally DebugLnExit(DBG_DATA_MONITORS, ['DebugDataMonitor: <<EXIT: TCurrentCallStackList.GetEntryForThread' ]) end;
end;
end;
@ -5421,7 +5421,7 @@ begin
if (Debugger = nil) then Exit;
FNotifiedState := Debugger.State;
FOldState := AOldState;
{$IFDEF DBG_DATA_MONITORS} DebugLnEnter(['DebugDataMonitor: >>ENTER: ', ClassName, '.DoStateChange New-State=', DBGStateNames[FNotifiedState]]); {$ENDIF}
DebugLnEnter(DBG_DATA_MONITORS, ['DebugDataMonitor: >>ENTER: ', ClassName, '.DoStateChange New-State=', DBGStateNames[FNotifiedState]]);
if FNotifiedState in [dsPause, dsInternalPause]
then begin
@ -5450,7 +5450,7 @@ begin
// stopped // typical: finalize snapshot and clear data.
DoStateLeavePauseClean;
end;
{$IFDEF DBG_DATA_MONITORS} DebugLnExit(['DebugDataMonitor: <<EXIT: ', ClassName, '.DoStateChange']); {$ENDIF}
DebugLnExit(DBG_DATA_MONITORS, ['DebugDataMonitor: <<EXIT: ', ClassName, '.DoStateChange']);
end;
constructor TDebuggerDataSupplier.Create(const ADebugger: TDebugger);
@ -5516,7 +5516,7 @@ end;
procedure TCurrentThreads.SetValidity(AValidity: TDebuggerDataState);
begin
if FDataValidity = AValidity then exit;
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCurrentThreads.SetValidity ', dbgs(AValidity)]); {$ENDIF}
DebugLn(DBG_DATA_MONITORS, ['DebugDataMonitor: TCurrentThreads.SetValidity ', dbgs(AValidity)]);
// Assign snapshot, if old data wasn't final
if (FDataValidity in [ddsUnknown, ddsEvaluating, ddsRequested]) and (FSnapShot <> nil)
@ -5531,7 +5531,7 @@ end;
procedure TCurrentThreads.SetCurrentThreadId(const AValue: Integer);
begin
if FCurrentThreadId = AValue then exit;
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCurrentThreads.SetCurrentThreadId ', AValue]); {$ENDIF}
DebugLn(DBG_DATA_MONITORS, ['DebugDataMonitor: TCurrentThreads.SetCurrentThreadId ', AValue]);
inherited SetCurrentThreadId(AValue);
FMonitor.CurrentChanged; // TODO ChangedSelection
end;
@ -5687,7 +5687,7 @@ end;
procedure TThreadsMonitor.Clear;
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TThreadsMonitor.Clear']); {$ENDIF}
DebugLn(DBG_DATA_MONITORS, ['DebugDataMonitor: TThreadsMonitor.Clear']);
FCurrentThreads.Clear;
Changed;
end;
@ -9423,7 +9423,7 @@ end;
procedure TCallStackMonitor.UpdateCurrentIndex;
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCallStackMonitor.UpdateCurrentIndex']); {$ENDIF}
DebugLn(DBG_DATA_MONITORS, ['DebugDataMonitor: TCallStackMonitor.UpdateCurrentIndex']);
if Supplier <> nil then Supplier.UpdateCurrentIndex;
NotifyCurrent;
end;
@ -9436,7 +9436,7 @@ end;
procedure TCallStackMonitor.CallStackClear(Sender: TObject);
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCallStackMonitor.CallStackClear']); {$ENDIF}
DebugLn(DBG_DATA_MONITORS, ['DebugDataMonitor: TCallStackMonitor.CallStackClear']);
// Don't clear, set it to 0 so there are no entries shown
//SetCount(0);
NotifyChange;
@ -9481,7 +9481,7 @@ end;
procedure TCallStackSupplier.Changed;
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCallStackSupplier.Changed']); {$ENDIF}
DebugLn(DBG_DATA_MONITORS, ['DebugDataMonitor: TCallStackSupplier.Changed']);
Monitor.NotifyChange;
end;
@ -9538,7 +9538,7 @@ var
e: TCallStackEntry;
It: TMapIterator;
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCallStackSupplier.RequestEntries']); {$ENDIF}
DebugLn(DBG_DATA_MONITORS, ['DebugDataMonitor: TCallStackSupplier.RequestEntries']);
It := TMapIterator.Create(ACallstack.FEntries);
if not It.Locate(ACallstack.LowestUnknown )
@ -9559,7 +9559,7 @@ end;
procedure TCallStackSupplier.CurrentChanged;
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TCallStackSupplier.CurrentChanged']); {$ENDIF}
DebugLn(DBG_DATA_MONITORS, ['DebugDataMonitor: TCallStackSupplier.CurrentChanged']);
if Monitor <> nil
then Monitor.NotifyCurrent;
end;
@ -11046,7 +11046,7 @@ initialization
DBG_STATE := DebugLogger.RegisterLogGroup('DBG_STATE' {$IFDEF DBG_STATE} , True {$ENDIF} );
DBG_EVENTS := DebugLogger.RegisterLogGroup('DBG_EVENTS' {$IFDEF DBG_EVENTS} , True {$ENDIF} );
DBG_STATE_EVENT := DebugLogger.RegisterLogGroup('DBG_STATE_EVENT' {$IFDEF DBG_STATE_EVENT} , True {$ENDIF} );
DBG_DATA_MONITORS := DebugLogger.FindOrRegisterLogGroup('DBG_DATA_MONITORS' {$IFDEF DBG_DATA_MONITORS} , True {$ENDIF} );
finalization
DoFinalization;

View File

@ -36,7 +36,7 @@ unit LocalsDlg;
interface
uses
SysUtils, Classes, Forms, ClipBrd, LCLProc,
SysUtils, Classes, Forms, ClipBrd, LCLProc, LazLogger,
IDEWindowIntf, DebuggerStrConst,
ComCtrls, ActnList, Menus, BaseDebugManager, Debugger, DebuggerDlg;
@ -94,6 +94,7 @@ uses
LazarusIDEStrConsts;
var
DBG_DATA_MONITORS: PLazLoggerLogGroup;
LocalsDlgWindowCreator: TIDEWindowCreator;
const
@ -191,12 +192,12 @@ begin
end;
if IsUpdating then begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataWindow: TLocalsDlg.LocalsChanged in IsUpdating']); {$ENDIF}
DebugLn(DBG_DATA_MONITORS, ['DebugDataWindow: TLocalsDlg.LocalsChanged in IsUpdating']);
Include(FUpdateFlags, ufNeedUpdating);
exit;
end;
Exclude(FUpdateFlags, ufNeedUpdating);
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataMonitor: TLocalsDlg.LocalsChanged']); {$ENDIF}
DebugLn(DBG_DATA_MONITORS, ['DebugDataMonitor: TLocalsDlg.LocalsChanged']);
if GetStackframe < 0 then begin // TODO need dedicated validity property
lvLocals.Items.Clear;
@ -362,5 +363,7 @@ initialization
LocalsDlgWindowCreator.DividerTemplate.Add('LocalsValue', COL_LOCALS_VALUE, drsColWidthValue);
LocalsDlgWindowCreator.CreateSimpleLayout;
DBG_DATA_MONITORS := DebugLogger.FindOrRegisterLogGroup('DBG_DATA_MONITORS' {$IFDEF DBG_DATA_MONITORS} , True {$ENDIF} );
end.

View File

@ -5,7 +5,7 @@ unit ThreadDlg;
interface
uses
Classes, SysUtils, ComCtrls, LCLProc,
Classes, SysUtils, ComCtrls, LCLProc, LazLogger,
Debugger, DebuggerDlg, Forms, LazarusIDEStrConsts, IDEWindowIntf, DebuggerStrConst,
BaseDebugManager, IDEImagesIntf;
@ -43,6 +43,7 @@ implementation
{$R *.lfm}
var
DBG_DATA_MONITORS: PLazLoggerLogGroup;
ThreadDlgWindowCreator: TIDEWindowCreator;
const
@ -78,12 +79,12 @@ var
Snap: TSnapshot;
begin
if IsUpdating then begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataWindow: TThreadsDlg.ThreadsChanged from ', DbgSName(Sender), ' in IsUpdating']); {$ENDIF}
DebugLn(DBG_DATA_MONITORS, ['DebugDataWindow: TThreadsDlg.ThreadsChanged from ', DbgSName(Sender), ' in IsUpdating']);
Include(FUpdateFlags, ufThreadChanged);
exit;
end;
{$IFDEF DBG_DATA_MONITORS} try DebugLnEnter(['DebugDataMonitor: >>ENTER: TThreadsDlg.ThreadsChanged from ', DbgSName(Sender)]); {$ENDIF}
try DebugLnEnter(DBG_DATA_MONITORS, ['DebugDataMonitor: >>ENTER: TThreadsDlg.ThreadsChanged from ', DbgSName(Sender)]);
Exclude(FUpdateFlags, ufThreadChanged);
BeginUpdate;
@ -147,7 +148,7 @@ begin
lvThreads.EndUpdate;
EndUpdate;
end;
{$IFDEF DBG_DATA_MONITORS} finally DebugLnExit(['DebugDataMonitor: <<EXIT: TThreadsDlg.ThreadsChanged']); end; {$ENDIF}
finally DebugLnExit(DBG_DATA_MONITORS, ['DebugDataMonitor: <<EXIT: TThreadsDlg.ThreadsChanged']); end;
end;
function TThreadsDlg.ColSizeGetter(AColId: Integer; var ASize: Integer): Boolean;
@ -271,5 +272,7 @@ initialization
ThreadDlgWindowCreator.DividerTemplate.Add('ColumnThreadFunc', COL_THREAD_FUNC, drsColWidthFunc);
ThreadDlgWindowCreator.CreateSimpleLayout;
DBG_DATA_MONITORS := DebugLogger.FindOrRegisterLogGroup('DBG_DATA_MONITORS' {$IFDEF DBG_DATA_MONITORS} , True {$ENDIF} );
end.

View File

@ -38,7 +38,7 @@ unit WatchesDlg;
interface
uses
Classes, Forms, Controls, math, LCLProc,
Classes, Forms, Controls, math, LCLProc, LazLogger,
IDEWindowIntf, Menus, ComCtrls, ActnList, IDEImagesIntf, LazarusIDEStrConsts, DebuggerStrConst,
Debugger, DebuggerDlg, BaseDebugManager;
@ -148,6 +148,7 @@ implementation
{$R *.lfm}
var
DBG_DATA_MONITORS: PLazLoggerLogGroup;
WatchWindowCreator: TIDEWindowCreator;
const
COL_WATCH_EXPR = 1;
@ -389,7 +390,7 @@ end;
procedure TWatchesDlg.ContextChanged(Sender: TObject);
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataWindow: TWatchesDlg.ContextChanged ', DbgSName(Sender), ' Upd:', IsUpdating]); {$ENDIF}
DebugLn(DBG_DATA_MONITORS, ['DebugDataWindow: TWatchesDlg.ContextChanged ', DbgSName(Sender), ' Upd:', IsUpdating]);
UpdateAll;
end;
@ -471,7 +472,7 @@ procedure TWatchesDlg.SnapshotChanged(Sender: TObject);
var
NewWatches: TWatches;
begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataWindow: TWatchesDlg.SnapshotChanged ', DbgSName(Sender), ' Upd:', IsUpdating]); {$ENDIF}
DebugLn(DBG_DATA_MONITORS, ['DebugDataWindow: TWatchesDlg.SnapshotChanged ', DbgSName(Sender), ' Upd:', IsUpdating]);
lvWatches.BeginUpdate;
try
NewWatches := Watches;
@ -672,11 +673,11 @@ var
begin
if Watches = nil then exit;
if IsUpdating then begin
{$IFDEF DBG_DATA_MONITORS} DebugLn(['DebugDataWindow: TWatchesDlg.UpdateAll: TWatchesDlg.UpdateAll in IsUpdating:']); {$ENDIF}
DebugLn(DBG_DATA_MONITORS, ['DebugDataWindow: TWatchesDlg.UpdateAll: TWatchesDlg.UpdateAll in IsUpdating:']);
FUpdateAllNeeded := True;
exit;
end;
{$IFDEF DBG_DATA_MONITORS} try DebugLnEnter(['DebugDataWindow: TWatchesDlg.UpdateAll: >>ENTER: TWatchesDlg.UpdateAll ']); {$ENDIF}
try DebugLnEnter(DBG_DATA_MONITORS, ['DebugDataWindow: TWatchesDlg.UpdateAll: >>ENTER: TWatchesDlg.UpdateAll ']);
Snap := GetSelectedSnapshot;
if Snap <> nil
@ -701,7 +702,7 @@ begin
lvWatches.EndUpdate;
lvWatchesSelectItem(nil, nil, False);
end;
{$IFDEF DBG_DATA_MONITORS} finally DebugLnExit(['DebugDataWindow: TWatchesDlg.UpdateAll: <<EXIT: TWatchesDlg.UpdateAll ']); end; {$ENDIF}
finally DebugLnExit(DBG_DATA_MONITORS, ['DebugDataWindow: TWatchesDlg.UpdateAll: <<EXIT: TWatchesDlg.UpdateAll ']); end;
end;
procedure TWatchesDlg.DisableAllActions;
@ -742,7 +743,7 @@ var
begin
if AWatch = nil then Exit; // TODO: update all
if AWatch.Collection <> FWatchesInView then exit;
{$IFDEF DBG_DATA_MONITORS} try DebugLnEnter(['DebugDataWindow: TWatchesDlg.WatchUpdate Upd:', IsUpdating, ' Watch=',AWatch.Expression]); {$ENDIF}
try DebugLnEnter(DBG_DATA_MONITORS, ['DebugDataWindow: TWatchesDlg.WatchUpdate Upd:', IsUpdating, ' Watch=',AWatch.Expression]);
Item := lvWatches.Items.FindData(AWatch);
if Item = nil
@ -751,7 +752,7 @@ begin
if not FUpdatingAll
then lvWatchesSelectItem(nil, nil, False);
{$IFDEF DBG_DATA_MONITORS} finally DebugLnExit(['DebugDataWindow: TWatchesDlg.WatchUpdate']); end; {$ENDIF}
finally DebugLnExit(DBG_DATA_MONITORS, ['DebugDataWindow: TWatchesDlg.WatchUpdate']); end;
end;
procedure TWatchesDlg.WatchRemove(const ASender: TWatches; const AWatch: TWatch);
@ -770,5 +771,7 @@ initialization
WatchWindowCreator.DividerTemplate.Add('ColumnWatchValue', COL_WATCH_VALUE, drsColWidthValue);
WatchWindowCreator.CreateSimpleLayout;
DBG_DATA_MONITORS := DebugLogger.FindOrRegisterLogGroup('DBG_DATA_MONITORS' {$IFDEF DBG_DATA_MONITORS} , True {$ENDIF} );
end.