From b593ba42f31410081ca9cb14089bbad86b1fbfe3 Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 19 May 2024 12:30:25 +0200 Subject: [PATCH] Debugger: test-base, handle calls to event logger --- .../lazdebugtestbase/ttestdbgexecuteables.pas | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/components/lazdebuggers/lazdebugtestbase/ttestdbgexecuteables.pas b/components/lazdebuggers/lazdebugtestbase/ttestdbgexecuteables.pas index 2860e20da3..eefa04c1f9 100644 --- a/components/lazdebuggers/lazdebugtestbase/ttestdbgexecuteables.pas +++ b/components/lazdebuggers/lazdebugtestbase/ttestdbgexecuteables.pas @@ -75,6 +75,19 @@ type end; + { TTestDebugEventLogManager } + + TTestDebugEventLogManager = class(TObject, TDebuggerEventLogInterface) + public + procedure LogCustomEvent(const ACategory: TDBGEventCategory; + const AEventType: TDBGEventType; const AText: String); + procedure LogEventBreakPointHit(const ABreakpoint: TDBGBreakPoint; const ALocation: TDBGLocationRec); + procedure LogEventWatchPointTriggered(const ABreakpoint: TDBGBreakPoint; + const ALocation: TDBGLocationRec; const AOldWatchedVal, ANewWatchedVal: String); + procedure LogEventWatchPointScope(const ABreakpoint: TDBGBreakPoint; + const ALocation: TDBGLocationRec); + end; + TTestDbgCompilerClass = class of TTestDbgCompiler; { TTestDbgDebugger } @@ -95,6 +108,7 @@ type FTestBreakPoints: TStringList; FDebuggerStateCounts: array[TDBGState] of integer; FCurLocation: TDBGLocationRec; + FTestDebugEventLogManager: TTestDebugEventLogManager; function GetCpuBitTypes: TCpuBitTypes; function GetCurLocation: TDBGLocationRec; inline; @@ -407,6 +421,9 @@ begin ADebugger.Exceptions := FExceptions; ADebugger.OnState := @DoDebuggerState; + + FTestDebugEventLogManager := TTestDebugEventLogManager.Create; + ADebugger.EventLogHandler := FTestDebugEventLogManager; end; procedure TTestDbgDebugger.ClearDebuggerMonitors; @@ -451,6 +468,7 @@ begin end; ClearDebuggerMonitors; FreeAndNil(FLazDebugger); + FreeAndNil(FTestDebugEventLogManager); end; procedure TTestDbgDebugger.ClearDbgStateCounts; @@ -547,6 +565,32 @@ begin // end; +{ TTestDebugEventLogManager } + +procedure TTestDebugEventLogManager.LogCustomEvent(const ACategory: TDBGEventCategory; + const AEventType: TDBGEventType; const AText: String); +begin + debugln(['{{Log-Event*Custom}}:', dbgs(ACategory), ' - ', ord(AEventType), ' - ', AText, ' {{<<<}}']); +end; + +procedure TTestDebugEventLogManager.LogEventBreakPointHit(const ABreakpoint: TDBGBreakPoint; + const ALocation: TDBGLocationRec); +begin +// +end; + +procedure TTestDebugEventLogManager.LogEventWatchPointTriggered(const ABreakpoint: TDBGBreakPoint; + const ALocation: TDBGLocationRec; const AOldWatchedVal, ANewWatchedVal: String); +begin +// +end; + +procedure TTestDebugEventLogManager.LogEventWatchPointScope(const ABreakpoint: TDBGBreakPoint; + const ALocation: TDBGLocationRec); +begin +// +end; + procedure CreateCompilerList(ACompilerConfigsList: TBaseList; ACompilerClass: TTestDbgCompilerClass); var