From 1328b8a1ab1b861eb47b8a3025f0c0a3f0d624a7 Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 12 Jun 2022 00:11:33 +0200 Subject: [PATCH] FpDebug: tests --- .../lazdebuggerfp/test/testwatches.pas | 14 ++++++++++---- .../lazdebuggers/lazdebugtestbase/sources.res | Bin 108908 -> 109352 bytes .../testapps/WatchesValuePrg.pas | 9 ++++++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/components/lazdebuggers/lazdebuggerfp/test/testwatches.pas b/components/lazdebuggers/lazdebuggerfp/test/testwatches.pas index 400fd063a7..52d3f0095e 100644 --- a/components/lazdebuggers/lazdebuggerfp/test/testwatches.pas +++ b/components/lazdebuggers/lazdebuggerfp/test/testwatches.pas @@ -986,7 +986,7 @@ StartIdxClassConst := t.Count; t.Add(AName, p+'Enum16A'+e, weEnum('ExValX5', 'TEnum16')); t.Add(AName, p+'Set'+e, weSet(['EnVal2', 'EnVal4'], 'TSet')).Skip([stDwarf]); - t.Add(AName, p+'Set2'+e, weSet(['EnVal1', 'EnVal4'], '{set}')).Skip([stDwarf]) + t.Add(AName, p+'Set2'+e, weSet(['EnVal1', 'EnVal4'])).Skip([stDwarf]) .SkipIf(ALoc = tlParam).SkipIf(ALoc = tlPointer); t.Add(AName, p+'Set4'+e, weSet(['E4Val02', 'E4Val0A'], 'TSet4')).Skip([stDwarf]); @@ -997,7 +997,7 @@ StartIdxClassConst := t.Count; t.Add(AName, p+'SmallSet'+e, weSet(['22', '24', '25'], 'TSmallRangeSet')).Skip([stDwarf]) .SkipIf(ALoc = tlParam).SkipIf(ALoc = tlPointer); - t.Add(AName, p+'SmallSet2'+e, weSet(['21', '24', '25'], '{set}')).Skip([stDwarf]) + t.Add(AName, p+'SmallSet2'+e, weSet(['21', '24', '25'])).Skip([stDwarf]) .SkipIf(ALoc = tlParam).SkipIf(ALoc = tlPointer); @@ -1212,8 +1212,8 @@ begin t.Add('SomeFunc1', weMatch('^function *\(SOMEVALUE, Foo: LONGINT; Bar: Word; x: Byte\): *BOOLEAN *AT *\$[0-9A-F]+', skFunction) ); t.Add('SomeProc1', weMatch('^procedure *\(\) *AT *\$[0-9A-F]+', skProcedure) ); - t.Add('@SomeFunc1', weMatch('^\^function.*\(\$[0-9A-F]+\)'{' = SomeFunc1'}, skPointer {skFunctionRef}) ); - t.Add('@SomeProc1', weMatch('^\^procedure.*\(\$[0-9A-F]+\)'{' = SomeFunc1'}, skPointer {skProcedureRef}) ); + t.Add('@SomeFunc1', weMatch('\^.*function.*\$[0-9A-F]+'{' = SomeFunc1'}, skPointer {skFunctionRef}) ); + t.Add('@SomeProc1', weMatch('\^.*procedure.*\$[0-9A-F]+'{' = SomeFunc1'}, skPointer {skProcedureRef}) ); // TODO: TClass1 must not contain "" // ' _vptr$TOBJECT: Pointer' @@ -1352,6 +1352,12 @@ if Compiler.Version < 030300 then t.EvaluateWatches; t.CheckResults; + // Pointer(1) + // Do not check values. // Just ensure no crash occurs + AddWatches(t, 'glop bad pointer - no crash', 'gvpX_', 001, 'B'); + AddWatches(t, 'glob MyClassBadMemc - no crash', 'MyClassBadMem.mc', 001, 'c'); + t.EvaluateWatches; + RunToPause(BrkFooBegin); t.Clear; diff --git a/components/lazdebuggers/lazdebugtestbase/sources.res b/components/lazdebuggers/lazdebugtestbase/sources.res index 33e8f9a1470fe8fbb04603aa566c036cbb1e6fe9..3a2fa9ae8fb618dd205bef5952d795d4d265d26b 100644 GIT binary patch delta 240 zcmaEJiEYI-whay{tfzJ`Ft|)^loFl1?zX_@ER{H4ejNqhO6Q!!;$o-76yMa`%_j<9 za!%I0BBrOHps%k`npc#Xn39;3ld6!Ln#;=t7ECWIh=_NpEJ?LeP%(f2!^weF=8O@O z@3sbQo>qO;TLsBT1uI*H5U3>@0r{DEC8(@OCLMXAQ|wg`>ZK!+(!zSAK+dBYWj&6!uV*jPKxGB5;y{Iz-A?R{qf D2bxu1 delta 57 zcmV-90LK5Q)&}g-2CzUR1r4_V07R348WpozByLT!*Kz3ylf1twlg@qyv)O!#OS6y2 P{tdGx*D40HPu diff --git a/components/lazdebuggers/lazdebugtestbase/testapps/WatchesValuePrg.pas b/components/lazdebuggers/lazdebugtestbase/testapps/WatchesValuePrg.pas index a5aabbf22a..5c92ec19be 100644 --- a/components/lazdebuggers/lazdebugtestbase/testapps/WatchesValuePrg.pas +++ b/components/lazdebuggers/lazdebugtestbase/testapps/WatchesValuePrg.pas @@ -447,7 +447,7 @@ type PMyTestRec = ^TMyTestRec; var - MyClass1: TMyClass; + MyClass1, MyClassBadMem: TMyClass; MyNilClass1: TMyClass; MyClass2: TMyBaseClass; (* LOCATION: field, requires typecast of containing class *) MyPClass1: PMyClass; @@ -503,6 +503,10 @@ var // gvp2_Byte: ^Byte; // gvp2_Byte := @gvaByte[1]; TEST_PREPOCESS(WatchesValuePrgIdent.inc, pre__=gvp2_, "_OP_=: ^", (=;//, "_O2_=: ^", _EQ_=, _BLOCK_=TestVar, _BLOCK2_=TestPointer ) +(* LOCATION: global var pointer *) // unreadable mem + // gvpX_Byte: $00000001; + TEST_PREPOCESS(WatchesValuePrgIdent.inc, pre__=gvpX_, "_OP_=: ^", (=;//, "_O2_=: ^", _EQ_=, _BLOCK_=TestVar, _BLOCK2_=TestPointer ) + (* LOCATION: global var TYPE alias // NO PRE-ASSIGNED VALUE *) // gvp_Byte: PxByte; TEST_PREPOCESS(WatchesValuePrgIdent.inc, pre__=gvpt_, "_OP_={", "_O2_={", "//@@=} :", _pre3_=Px, _BLOCK_=TestVar, _BLOCK2_=TestPointer ) // } @@ -964,6 +968,8 @@ begin TEST_PREPOCESS(WatchesValuePrgIdent.inc,pre__=MyClass1.mbc, ADD=3, CHR1='D', _OP_=:=, _O2_={, _EQ_=}:=, _pre2_=gc, _BLOCK_=TestAssign) TEST_PREPOCESS(WatchesValuePrgIdent.inc,pre__=MyClass1.mc, ADD=2, CHR1='C', _OP_=:=, _O2_={, _EQ_=}:=, _pre2_=gc, _BLOCK_=TestAssign) + MyClassBadMem := TMyClass(Pointer(1)); + MyNilClass1 := nil; (* INIT: field in class / baseclass // typecast *) @@ -1018,6 +1024,7 @@ begin TEST_PREPOCESS(WatchesValuePrgIdent.inc,pre__=gvp_, _OP_={, _O2_={, _pre3_=@gv, "//@@=} :=", _BLOCK_=TestVar, _BLOCK2_=TestPointer) //} TEST_PREPOCESS(WatchesValuePrgIdent.inc,pre__=gvp2_, _OP_={, _O2_={, _pre3_=@gva, "//@@=} :=", {e3}=[1], _BLOCK_=TestVar, _BLOCK2_=TestPointer) //} + TEST_PREPOCESS(WatchesValuePrgIdent.inc,pre__=gvpX_, _OP_={, _O2_={, "_pre3_=Pointer(1); //", "//@@=} :=", _BLOCK_=TestVar, _BLOCK2_=TestPointer) //} RecursePtrA1 := @RecursePtrA2; RecursePtrA2 := @RecursePtrA1;