mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-21 22:59:27 +02:00
FpGdbmiDebugger: fixes for nested proc / tests
git-svn-id: trunk@44709 -
This commit is contained in:
parent
78869bf7b8
commit
99beb437a1
@ -89,6 +89,7 @@ type
|
||||
property ThreadId: Integer read FThreadId write FThreadId;
|
||||
property StackFrame: Integer read FStackFrame write FStackFrame;
|
||||
|
||||
function ApplyContext(AVal: TFpDbgValue): TFpDbgValue; inline;
|
||||
function SymbolToValue(ASym: TFpDbgSymbol): TFpDbgValue; inline;
|
||||
procedure AddRefToVal(AVal: TFpDbgValue); inline;
|
||||
function GetSelfParameter: TFpDbgValue; virtual;
|
||||
@ -966,6 +967,12 @@ begin
|
||||
Result := FDwarf.MemManager;
|
||||
end;
|
||||
|
||||
function TFpDwarfInfoAddressContext.ApplyContext(AVal: TFpDbgValue): TFpDbgValue;
|
||||
begin
|
||||
if (AVal <> nil) and (TFpDwarfValueBase(AVal).FContext = nil) then
|
||||
TFpDwarfValueBase(AVal).FContext := Self;
|
||||
end;
|
||||
|
||||
function TFpDwarfInfoAddressContext.SymbolToValue(ASym: TFpDbgSymbol): TFpDbgValue;
|
||||
begin
|
||||
if ASym = nil then begin
|
||||
@ -992,7 +999,7 @@ end;
|
||||
function TFpDwarfInfoAddressContext.GetSelfParameter: TFpDbgValue;
|
||||
begin
|
||||
Result := TFpDwarfSymbolValueProc(FSymbol).GetSelfParameter(FAddress);
|
||||
if TFpDwarfValueBase(Result).FContext = nil then
|
||||
if (Result <> nil) and (TFpDwarfValueBase(Result).FContext = nil) then
|
||||
TFpDwarfValueBase(Result).FContext := Self;
|
||||
end;
|
||||
|
||||
@ -1235,8 +1242,7 @@ begin
|
||||
FlastResult := Result;
|
||||
|
||||
assert((Result = nil) or (Result is TFpDwarfValueBase), 'TDbgDwarfInfoAddressContext.FindSymbol: (Result = nil) or (Result is TFpDwarfValueBase)');
|
||||
if (Result <> nil) and (TFpDwarfValueBase(Result).FContext = nil) then
|
||||
TFpDwarfValueBase(Result).FContext := Self;
|
||||
ApplyContext(Result);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -112,6 +112,7 @@ begin
|
||||
|
||||
ParentFpSym := TFpDwarfSymbol.CreateSubClass(AName, InfoEntry);
|
||||
ParentFpVal := ParentFpSym.Value;
|
||||
ApplyContext(ParentFpVal);
|
||||
//TFpDwarfSymbol(ADbgValue.DbgSymbol).ParentTypeInfo := TFpDwarfSymbolValueProc(FSymbol);
|
||||
if not (svfOrdinal in ParentFpVal.FieldFlags) then begin
|
||||
DebugLn('no ordinal for parentfp');
|
||||
|
@ -115,10 +115,11 @@ type
|
||||
Result: Array [TSymbolType] of TWatchExpectationResult;
|
||||
|
||||
TheWatch: TTestWatch;
|
||||
UserData: Pointer;
|
||||
UserData, UserData2: Pointer;
|
||||
OnBeforeTest: TWatchExpectOnBeforeTest;
|
||||
end;
|
||||
TWatchExpectationArray = array of TWatchExpectation;
|
||||
PWatchExpectationArray = ^TWatchExpectationArray;
|
||||
|
||||
{ TTestWatchesBase }
|
||||
|
||||
@ -418,9 +419,9 @@ begin
|
||||
|
||||
// Get Value
|
||||
n := Data.TestName;
|
||||
LogToFile('###### ' + n + '######' +LineEnding);
|
||||
LogToFile('###### ' + n + '###### '+adbg.GetLocation.SrcFile+' '+IntToStr(ADbg.GetLocation.SrcLine) +LineEnding);
|
||||
if n = '' then n := Data.Expression + ' (' + TWatchDisplayFormatNames[Data.DspFormat] + ', ' + dbgs(Data.EvaluateFlags) + ')';
|
||||
Name := Name + ' ' + n;
|
||||
Name := Name + ' ' + n + ' ::: '+adbg.GetLocation.SrcFile+' '+IntToStr(ADbg.GetLocation.SrcLine);
|
||||
flag := AWatch <> nil; // test for typeinfo/kind // Awatch=nil > direct gdb command
|
||||
IsValid := True;
|
||||
HasTpInfo := True;
|
||||
|
@ -19,10 +19,18 @@ type
|
||||
PSimpleEnum1 = ^TSimpleEnum1;
|
||||
PSimpleSet1 = ^TSimpleSet1;
|
||||
|
||||
{ TSimpleClass0 }
|
||||
|
||||
TSimpleClass0 = class
|
||||
// NO fields // NO param
|
||||
procedure Test0Method;
|
||||
end;
|
||||
|
||||
{ TSimpleClass1 }
|
||||
|
||||
TSimpleClass1 = class
|
||||
TSimpleClass1 = class(TSimpleClass0)
|
||||
public
|
||||
{%region Fields}
|
||||
Field_Short1: ShortInt;
|
||||
Field_Small1: Smallint;
|
||||
Field_Int1: LongInt;
|
||||
@ -61,9 +69,11 @@ type
|
||||
Field_PBool1, Field_PBool2: PBoolean;
|
||||
Field_PEnum1, Field_PEnum2: PSimpleEnum1;
|
||||
Field_PSet1, Field_PSet2: PSimpleSet1;
|
||||
{%endregion Fields}
|
||||
|
||||
procedure InitFields;
|
||||
procedure Test1Method(
|
||||
{%region Param}
|
||||
Arg_Short1: ShortInt;
|
||||
Arg_Small1: Smallint;
|
||||
Arg_Int1: LongInt;
|
||||
@ -142,6 +152,7 @@ type
|
||||
var VArg_PBool1, VArg_PBool2: PBoolean;
|
||||
var VArg_PEnum1, VArg_PEnum2: PSimpleEnum1;
|
||||
var VArg_PSet1, VArg_PSet2: PSimpleSet1
|
||||
{%endregion Param}
|
||||
);
|
||||
end;
|
||||
|
||||
@ -152,6 +163,7 @@ type
|
||||
end;
|
||||
|
||||
var
|
||||
{%region Global}
|
||||
SimpleGlob_Short1: ShortInt;
|
||||
SimpleGlob_Small1: Smallint;
|
||||
SimpleGlob_Int1: LongInt;
|
||||
@ -210,6 +222,7 @@ var
|
||||
SimpleGlob_P2Bool1, SimpleGlob_P2Bool2: PBoolean;
|
||||
SimpleGlob_P2Enum1, SimpleGlob_P2Enum2: PSimpleEnum1;
|
||||
SimpleGlob_P2Set1, SimpleGlob_P2Set2: PSimpleSet1;
|
||||
{%endregion Global}
|
||||
|
||||
|
||||
// Additional Globals
|
||||
@ -229,10 +242,14 @@ var
|
||||
|
||||
SimpleGlob_Comp2, SimpleGlob_Comp3: Comp;
|
||||
|
||||
SimpleGlob_Class0: TSimpleClass0;
|
||||
SimpleGlob_Class1: TSimpleClass1;
|
||||
SimpleGlob_Class2: TSimpleClass2;
|
||||
|
||||
SimpleGlob_Dummy: Integer;
|
||||
|
||||
procedure Test1Sub(
|
||||
{%region Param}
|
||||
SimpleArg_Short1: ShortInt;
|
||||
SimpleArg_Small1: Smallint;
|
||||
SimpleArg_Int1: LongInt;
|
||||
@ -265,9 +282,10 @@ procedure Test1Sub(
|
||||
SimpleArg_Class2: TSimpleClass2;
|
||||
var SimpleVArg_Class1: TSimpleClass1;
|
||||
var SimpleVArg_Class2: TSimpleClass2
|
||||
|
||||
{%endregion Param}
|
||||
);
|
||||
var
|
||||
{%region Local}
|
||||
Local_Short1: ShortInt;
|
||||
Local_Small1: Smallint;
|
||||
Local_Int1 : LongInt;
|
||||
@ -283,7 +301,7 @@ var
|
||||
Local_Ext1: Extended;
|
||||
|
||||
SimplePArg_Int1, SimplePVArg_Int1, SimplePLocal_Int1, SimplePGlob_Int1: PLongInt;
|
||||
|
||||
{%endregion Local}
|
||||
begin
|
||||
Local_Short1 := 39;
|
||||
SimpleGlob_Short1 := 29;
|
||||
@ -352,7 +370,24 @@ begin
|
||||
SimplePLocal_Int1 := @Local_Int1;
|
||||
SimplePGlob_Int1 := @SimpleGlob_Int1;
|
||||
|
||||
inc(SimpleVArg_Int1); // BREAK Single 1
|
||||
inc(SimpleGlob_Dummy); // BREAK Single 1
|
||||
end;
|
||||
|
||||
procedure Simple_NoneNested;
|
||||
begin
|
||||
inc(SimpleGlob_Dummy); // BREAK Single 2
|
||||
end;
|
||||
|
||||
{ TSimpleClass0 }
|
||||
|
||||
procedure TSimpleClass0.Test0Method;
|
||||
procedure Nested0;
|
||||
begin
|
||||
inc(SimpleGlob_Dummy); // BREAK Single 10
|
||||
end;
|
||||
begin
|
||||
inc(SimpleGlob_Dummy); // BREAK Single 9
|
||||
Nested0;
|
||||
end;
|
||||
|
||||
{ TSimpleClass1 }
|
||||
@ -466,6 +501,12 @@ var
|
||||
Local_PBool1, Local_PBool2: PBoolean;
|
||||
Local_PEnum1, Local_PEnum2: PSimpleEnum1;
|
||||
Local_PSet1, Local_PSet2: PSimpleSet1;
|
||||
|
||||
procedure Nested1;
|
||||
begin
|
||||
inc(SimpleGlob_Dummy); // BREAK Single 4
|
||||
Simple_NoneNested;
|
||||
end;
|
||||
begin
|
||||
InitFields;
|
||||
|
||||
@ -567,15 +608,39 @@ begin
|
||||
{%endregion VARG}
|
||||
|
||||
|
||||
inc(SimpleGlob_Byte2); // BREAK Single 2
|
||||
inc(SimpleGlob_Dummy); // BREAK Single 3
|
||||
Nested1;
|
||||
Simple_NoneNested;
|
||||
Test0Method;
|
||||
end;
|
||||
|
||||
{ TSimpleClass2 }
|
||||
|
||||
procedure TSimpleClass2.Test2Method;
|
||||
procedure Nested2a;
|
||||
begin
|
||||
inc(SimpleGlob_Dummy); // BREAK Single 6
|
||||
end;
|
||||
|
||||
procedure Nested2b(x: Boolean = False);
|
||||
procedure Nested2c;
|
||||
begin
|
||||
inc(SimpleGlob_Dummy); // BREAK Single 7
|
||||
Nested2a;
|
||||
end;
|
||||
begin
|
||||
inc(SimpleGlob_Dummy); // BREAK Single 8
|
||||
if x then
|
||||
Nested2c
|
||||
else
|
||||
Nested2b(True);
|
||||
end;
|
||||
|
||||
begin
|
||||
InitFields;
|
||||
inc(SimpleGlob_Byte1); // BREAK Single 3
|
||||
inc(SimpleGlob_Dummy); // BREAK Single 5
|
||||
Nested2a;
|
||||
Nested2b;
|
||||
end;
|
||||
|
||||
procedure Test1;
|
||||
@ -604,6 +669,7 @@ begin
|
||||
d2 := -2345;
|
||||
d3 := -3456;
|
||||
|
||||
SimpleGlob_Class0 := TSimpleClass0.Create;
|
||||
SimpleGlob_Class1 := TSimpleClass1.Create;
|
||||
SimpleGlob_Class2 := TSimpleClass2.Create;
|
||||
|
||||
@ -649,7 +715,6 @@ begin
|
||||
SimpleGlob_Class1, SimpleGlob_Class2, SimpleGlob_Class1, SimpleGlob_Class2
|
||||
);
|
||||
|
||||
|
||||
{%region global }
|
||||
SimpleGlob_Short1 := 11;
|
||||
SimpleGlob_Small1 := 112;
|
||||
@ -720,9 +785,6 @@ begin
|
||||
SimpleGlob_P2Set1 := @SimpleGlob_Set1;
|
||||
SimpleGlob_P2Set2 := @SimpleGlob_Set2;
|
||||
|
||||
|
||||
|
||||
|
||||
SimpleGlob_Class1.Test1Method(
|
||||
SimpleGlob_Short1,
|
||||
SimpleGlob_Small1,
|
||||
@ -804,7 +866,12 @@ begin
|
||||
SimpleGlob_P2Set1, SimpleGlob_P2Set2
|
||||
|
||||
);
|
||||
|
||||
SimpleGlob_Class2.Test2Method;
|
||||
SimpleGlob_Class2.Test0Method;
|
||||
|
||||
SimpleGlob_Class0.Test0Method;
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -10,9 +10,37 @@ uses
|
||||
TestWatchUtils, GDBMIDebugger;
|
||||
|
||||
const
|
||||
BREAK_LINE_TestWatchesUnitSimple_1 = 355;
|
||||
BREAK_LINE_TestWatchesUnitSimple_2 = 570;
|
||||
BREAK_LINE_TestWatchesUnitSimple_3 = 578;
|
||||
BREAK_COUNT_TestWatchesUnitSimple = 17;
|
||||
BL_TW1 = 373; // Test1Sub
|
||||
BL_TW2 = 378; // Simple_NoneNested
|
||||
BL_TW3 = 611; // Test1Method
|
||||
BL_TW4 = 507; // Test1Method Nested1
|
||||
BL_TW5 = 641; // Test2Method
|
||||
BL_TW6 = 622; // Test2Method Nested2a
|
||||
BL_TW7 = 628; // Test2Method Nested2b
|
||||
BL_TW8 = 632; // Test2Method Nested2c
|
||||
BL_TW9 = 389; // Test0Method
|
||||
BL_TW10 = 386; // Test0Method Nested0
|
||||
BREAK_LINE_TestWatchesUnitSimple: array [1..BREAK_COUNT_TestWatchesUnitSimple] of Integer =
|
||||
( BL_TW1, // 1: Test1Sub
|
||||
BL_TW3, // 2: Class1.Test1Method
|
||||
BL_TW4, // 3: Class1.Test1Method > Nested1
|
||||
BL_TW2, // 4: Class1.Test1Method > Nested1 > Simple_NoneNested
|
||||
BL_TW2, // 5: Class1.Test1Method > Simple_NoneNested
|
||||
BL_TW9, // 6: Class1.Test1Method > Test0Method
|
||||
BL_TW10, // 7: Class1.Test1Method > Test0Method > Nested0
|
||||
BL_TW5, // 8: Class2.Test2Method
|
||||
BL_TW6, // 9: Class2.Test2Method > Nested2a
|
||||
BL_TW7, // 10: Class2.Test2Method > Nested2b
|
||||
BL_TW7, // 11: Class2.Test2Method > Nested2b > Nested2b
|
||||
BL_TW8, // 12: Class2.Test2Method > Nested2b > Nested2b > Nested2c
|
||||
BL_TW6, // 13: Class2.Test2Method > Nested2b > Nested2b > Nested2c > Nested2a
|
||||
BL_TW9, // 14: Class2.Test0Method
|
||||
|
||||
BL_TW10, // 15: Class2.Test0Method > Nested0
|
||||
BL_TW9, // 16: Class0.Test0Method
|
||||
BL_TW10 // 17: Class0.Test0Method > Nested0
|
||||
);
|
||||
|
||||
BREAK_LINE_TestWatchesUnitArray = 842;
|
||||
|
||||
@ -24,13 +52,11 @@ type
|
||||
private
|
||||
FWatches: TWatches;
|
||||
|
||||
ExpectBreakSimple_1: TWatchExpectationArray;
|
||||
ExpectBreakSimple_2: TWatchExpectationArray;
|
||||
ExpectBreakSimple_3: TWatchExpectationArray;
|
||||
ExpectBreakSimple: array [1..BREAK_COUNT_TestWatchesUnitSimple] of TWatchExpectationArray;
|
||||
|
||||
ExpectBreakArray_1: TWatchExpectationArray;
|
||||
|
||||
FCurrentExpect: ^TWatchExpectationArray; // currently added to
|
||||
FCurrentExpect: PWatchExpectationArray; // currently added to
|
||||
|
||||
FDbgOutPut: String;
|
||||
FDbgOutPutEnable: Boolean;
|
||||
@ -52,9 +78,7 @@ type
|
||||
procedure AdjustExpectToAddress(AWatchExp: PWatchExpectation); // only ExpectBreakSimple_1
|
||||
procedure AdjustArrayExpectToAddress(AWatchExp: PWatchExpectation); // only ExpectBreakSimple_1
|
||||
|
||||
procedure AddExpectSimple_1;
|
||||
procedure AddExpectSimple_2(DoAddExp_3: Boolean = False);
|
||||
procedure AddExpectSimple_3;
|
||||
procedure AddExpectSimple;
|
||||
procedure AddExpectArray_1;
|
||||
procedure RunTestWatches(NamePreFix: String;
|
||||
TestExeName, ExtraOpts: String;
|
||||
@ -114,8 +138,10 @@ var
|
||||
OtherWatchExp: TWatchExpectation;
|
||||
s: String;
|
||||
st: TSymbolType;
|
||||
OtherList: PWatchExpectationArray;
|
||||
begin
|
||||
OtherWatchExp := ExpectBreakSimple_1[PtrUInt(AWatchExp^.UserData)];
|
||||
OtherList := PWatchExpectationArray(AWatchExp^.UserData2);
|
||||
OtherWatchExp := OtherList^[PtrUInt(AWatchExp^.UserData)];
|
||||
if OtherWatchExp.TheWatch = nil then begin
|
||||
debugln(['SKIPPING watch update']);
|
||||
exit;
|
||||
@ -131,7 +157,10 @@ var
|
||||
OtherWatchExp: TWatchExpectation;
|
||||
s: String;
|
||||
st: TSymbolType;
|
||||
OtherList: PWatchExpectationArray;
|
||||
begin
|
||||
OtherList := PWatchExpectationArray(AWatchExp^.UserData2);
|
||||
//OtherWatchExp := OtherList^[PtrUInt(AWatchExp^.UserData)];
|
||||
OtherWatchExp := ExpectBreakArray_1[PtrUInt(AWatchExp^.UserData)];
|
||||
if OtherWatchExp.TheWatch = nil then begin
|
||||
debugln(['SKIPPING watch update']);
|
||||
@ -155,18 +184,22 @@ begin
|
||||
end;
|
||||
|
||||
procedure TTestWatches.ClearAllTestArrays;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
//SetLength(ExpectBreakFooGdb, 0);
|
||||
//SetLength(ExpectBreakSubFoo, 0);
|
||||
for i := 1 to BREAK_COUNT_TestWatchesUnitSimple do
|
||||
SetLength(ExpectBreakSimple[i], 0);
|
||||
SetLength(ExpectBreakArray_1, 0);
|
||||
end;
|
||||
|
||||
function TTestWatches.HasTestArraysData: Boolean;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Result :=
|
||||
(Length(ExpectBreakSimple_1) > 0) or
|
||||
(Length(ExpectBreakSimple_2) > 0) or
|
||||
(Length(ExpectBreakSimple_3) > 0) or
|
||||
(Length(ExpectBreakArray_1) > 0);
|
||||
for i := 1 to BREAK_COUNT_TestWatchesUnitSimple do
|
||||
Result := Result or (Length(ExpectBreakSimple[i]) > 0);
|
||||
end;
|
||||
|
||||
function TTestWatches.Add(AnExpr: string; AFmt: TWatchDisplayFormat; AMtch: string;
|
||||
@ -206,286 +239,298 @@ begin
|
||||
Result := AddFmtDef(AnExpr, '^'+IntToStr(AMtch), skSimple, ATpNm, [fTpMtch]);
|
||||
end;
|
||||
|
||||
procedure TTestWatches.AddExpectSimple_1;
|
||||
var
|
||||
i: Integer;
|
||||
s, s2, s2def: String;
|
||||
j: Integer;
|
||||
r: PWatchExpectation;
|
||||
begin
|
||||
FCurrentExpect := @ExpectBreakSimple_1;
|
||||
|
||||
{%region Int?Cardinal types}
|
||||
for i := 0 to 3 do begin
|
||||
s2def := '';
|
||||
case i of
|
||||
0: s := '%s';
|
||||
1: s := '(@%s)^';
|
||||
2: s := 'Int64(%s)';
|
||||
3: s := 'QWord(%s)';
|
||||
end;
|
||||
case i of
|
||||
2: s2def := 'Int64';
|
||||
3: s2def := 'QWord';
|
||||
end;
|
||||
|
||||
|
||||
s2 := s2def;
|
||||
if s2 = '' then s2 := 'ShortInt';
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleArg_Short1']), -92, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleVArg_Short1']), -91, s2);
|
||||
end else begin
|
||||
AddSimpleUInt(Format(s, ['SimpleArg_Short1']), QWord(-92), s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleVArg_Short1']), QWord(-91), s2);
|
||||
end;
|
||||
AddSimpleInt(Format(s, ['Local_Short1']), 39, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Short1 ']), 29, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Short2']), 0, s2);
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Short3']), -1, s2);
|
||||
end;
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Short4']), high(ShortInt), s2);
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Short5']), low(ShortInt), s2);
|
||||
end;
|
||||
|
||||
s2 := s2def;
|
||||
if s2 = '' then s2 := 'SmallInt';
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleArg_Small1']), -192, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleVArg_Small1']), -191, s2);
|
||||
end;
|
||||
AddSimpleInt(Format(s, ['Local_Small1']), 391, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Small1 ']), 291, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Small2']), 0, s2);
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Small3']), -1, s2);
|
||||
end;
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Small4']), high(SmallInt), s2);
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Small5']), low(SmallInt), s2);
|
||||
end;
|
||||
|
||||
s2 := s2def;
|
||||
if s2 = '' then s2 := M_Int;
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleArg_Int1']), -1902, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleVArg_Int1']), -1901, s2);
|
||||
end;
|
||||
AddSimpleInt(Format(s, ['Local_Int1']), 3901, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int1']), 2901, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int2']), 0, s2);
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int3']), -1, s2);
|
||||
end;
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int4']), 2147483647, s2);
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int5']), -2147483648, s2);
|
||||
end;
|
||||
|
||||
s2 := s2def;
|
||||
if s2 = '' then s2 := 'Int64';
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleArg_QInt1']), -190000000000002, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleVArg_QInt1']), -190000000000001, s2);
|
||||
end;
|
||||
AddSimpleInt(Format(s, ['Local_QInt1']), 39001, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_QInt1 ']), 29001, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_QInt2']), 0, s2);
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_QInt3']), -1, s2);
|
||||
end;
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_QInt4']), high(Int64), s2);
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_QInt5']), low(Int64), s2);
|
||||
end;
|
||||
|
||||
s2 := s2def;
|
||||
if s2 = '' then s2 := 'Byte';
|
||||
AddSimpleUInt(Format(s, ['Local_Byte1']), 59, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Byte1 ']), 49, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Byte2']), $7f, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Byte3']), $80, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Byte4']), high(Byte), s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Byte5']), low(Byte), s2);
|
||||
|
||||
s2 := s2def;
|
||||
if s2 = '' then s2 := 'Word';
|
||||
AddSimpleUInt(Format(s, ['Local_Word1']), 591, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Word1 ']), 491, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Word2']), $7fff, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Word3']), $8000, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Word4']), high(Word), s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Word5']), low(Word), s2);
|
||||
|
||||
s2 := s2def;
|
||||
if s2 = '' then s2 := 'LongWord';
|
||||
AddSimpleUInt(Format(s, ['Local_DWord1']), 5901, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_DWord1 ']), 4901, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_DWord2']), $7fffffff, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_DWord3']), $80000000, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_DWord4']), high(LongWord), s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_DWord5']), low(LongWord), s2);
|
||||
|
||||
s2 := s2def;
|
||||
if s2 = '' then s2 := 'QWord';
|
||||
if not(i in [2]) then begin
|
||||
AddSimpleUInt(Format(s, ['Local_QWord1']), 59001, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_QWord1 ']), 49001, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_QWord2']), $7fffffffffffffff, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_QWord3']), qword($8000000000000000), s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_QWord4']), high(QWord), s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_QWord5']), low(QWord), s2);
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
s2 := 'Byte';
|
||||
s := 'Byte(%s)';
|
||||
AddSimpleInt(Format(s, ['SimpleArg_Int1']), Byte(-1902), s2);
|
||||
AddSimpleInt(Format(s, ['SimpleVArg_Int1']), Byte(-1901), s2);
|
||||
AddSimpleInt(Format(s, ['Local_Int1']), Byte(3901), s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int1']), Byte(2901), s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int2']), Byte(0), s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int3']), Byte(-1), s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int4']), Byte(2147483647), s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int5']), Byte(-2147483648), s2);
|
||||
|
||||
|
||||
for i := 0 to 3 do begin
|
||||
case i of
|
||||
0: s := 'SimpleArg_Class1.%s';
|
||||
1: s := 'SimpleVArg_Class1.%s';
|
||||
2: s := 'SimpleArg_Class2.%s';
|
||||
3: s := 'SimpleVArg_Class2.%s';
|
||||
end;
|
||||
j := 0;
|
||||
if i in [2,3] then j := 100;
|
||||
|
||||
AddSimpleInt(Format(s, ['Field_Short1']), j+11, 'ShortInt');
|
||||
AddSimpleInt(Format(s, ['Field_Small1']), j+12, 'SmallInt');
|
||||
AddSimpleInt(Format(s, ['Field_Int1']), j+13, 'LongInt');
|
||||
AddSimpleInt(Format(s, ['Field_QInt1']), j+14, 'Int64');
|
||||
|
||||
AddSimpleInt(Format(s, ['Field_Byte1']), j+15, 'Byte');
|
||||
AddSimpleInt(Format(s, ['Field_Word1']), j+16, 'Word');
|
||||
AddSimpleInt(Format(s, ['Field_DWord1']), j+17, 'LongWord');
|
||||
AddSimpleInt(Format(s, ['Field_QWord1']), j+18, 'QWord');
|
||||
end;
|
||||
{%region}
|
||||
|
||||
s := '%s';
|
||||
AddFmtDef(Format(s, ['SimpleGlob_Single1']), '^99\.(2|19)', skSimple, '', [fTpMtch]);
|
||||
AddFmtDef(Format(s, ['SimpleGlob_Double1']), '^199\.(3|29)', skSimple, '', [fTpMtch]);
|
||||
AddFmtDef(Format(s, ['SimpleGlob_Ext1']), '^299\.(4|39)', skSimple, '', [fTpMtch]);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Comp1']), -2, '');
|
||||
|
||||
{%region AddressOf / Var param, hidden pointer}
|
||||
//SimplePArg_Int1, SimplePVArg_Int1, SimplePLocal_Int1, SimplePGlob_Int1: PLongInt;
|
||||
r := AddFmtDef('@SimpleArg_Int1', 'replaceme', skPointer, '');
|
||||
r^.OnBeforeTest := @AdjustExpectToAddress;
|
||||
r^.UserData := pointer(ptruint(Length(FCurrentExpect^)));
|
||||
AddFmtDef('SimplePArg_Int1', '\$[0-9A-F]', skPointer, '');
|
||||
|
||||
r := AddFmtDef('@SimpleVArg_Int1', 'replaceme', skPointer, '');
|
||||
UpdResMinFpc(r, stSymAll, 020600);
|
||||
r^.OnBeforeTest := @AdjustExpectToAddress;
|
||||
r^.UserData := pointer(PtrUInt(Length(FCurrentExpect^)));
|
||||
AddFmtDef('SimplePVArg_Int1', '\$[0-9A-F]', skPointer, '');
|
||||
|
||||
r := AddFmtDef('@Local_Int1', 'replaceme', skPointer, '');
|
||||
r^.OnBeforeTest := @AdjustExpectToAddress;
|
||||
r^.UserData := pointer(PtrUInt(Length(FCurrentExpect^)));
|
||||
AddFmtDef('SimplePLocal_Int1', '\$[0-9A-F]', skPointer, '');
|
||||
|
||||
r := AddFmtDef('@SimpleGlob_Int1', 'replaceme', skPointer, '');
|
||||
r^.OnBeforeTest := @AdjustExpectToAddress;
|
||||
r^.UserData := pointer(PtrUInt(Length(FCurrentExpect^)));
|
||||
AddFmtDef('SimplePGlob_Int1', '\$[0-9A-F]', skPointer, '');
|
||||
|
||||
{%region}
|
||||
|
||||
end;
|
||||
|
||||
procedure TTestWatches.AddExpectSimple_2(DoAddExp_3: Boolean);
|
||||
var
|
||||
i, i2: Integer;
|
||||
s,s2: String;
|
||||
r: PWatchExpectation;
|
||||
begin
|
||||
FCurrentExpect := @ExpectBreakSimple_2;
|
||||
if DoAddExp_3 then
|
||||
FCurrentExpect := @ExpectBreakSimple_3;
|
||||
|
||||
{%region Fields / Glob / ... }
|
||||
for i := 0 to 5 do begin
|
||||
if DoAddExp_3 and not(i in [1,5]) then continue;
|
||||
case i of
|
||||
0: s := 'Field_';
|
||||
1: s := 'SimpleGlob_';
|
||||
2: s := 'Arg_';
|
||||
3: s := 'VArg_';
|
||||
4: s := 'Local_';
|
||||
5: s := 'self.Field_';
|
||||
// 6: passed in object / var arg object
|
||||
// unit.glob
|
||||
end;
|
||||
|
||||
{%region address of }
|
||||
//r := AddFmtDef(Format('@%sDynInt1', [s]), '\REPLACEME', skPointer, '', [fTpMtch]);
|
||||
//if i = 3 then UpdResMinFpc(r, stSymAll, 020600);
|
||||
//r^.OnBeforeTest := @AdjustArrayExpectToAddress;
|
||||
//r^.UserData := pointer(ptruint(Length(FCurrentExpect^)));
|
||||
//AddFmtDef(Format('%sPDynInt1', [s]), '\$[0-9A-F]', skPointer, '', [fTpMtch]);
|
||||
|
||||
{%endregion address of }
|
||||
|
||||
|
||||
for i2 := 0 to 1 do begin
|
||||
s2 := '';
|
||||
if i2 = 1 then begin
|
||||
s := s + 'P';
|
||||
s2 := '^';
|
||||
procedure TTestWatches.AddExpectSimple;
|
||||
procedure AddExpectSimple_Test1Sub;
|
||||
var
|
||||
i, j: Integer;
|
||||
s, s2, s2def: String;
|
||||
r: PWatchExpectation;
|
||||
begin
|
||||
{%region Int/Cardinal types}
|
||||
for i := 0 to 3 do begin
|
||||
s2def := '';
|
||||
case i of
|
||||
0: s := '%s';
|
||||
1: s := '(@%s)^';
|
||||
2: s := 'Int64(%s)';
|
||||
3: s := 'QWord(%s)';
|
||||
end;
|
||||
case i of
|
||||
2: s2def := 'Int64';
|
||||
3: s2def := 'QWord';
|
||||
end;
|
||||
|
||||
AddSimpleInt(Format('%sShort1%1:s', [s,s2]), 11, 'ShortInt');
|
||||
AddSimpleInt(Format('%sSmall1%1:s', [s,s2]), 112, 'SmallInt');
|
||||
AddSimpleInt(Format('%sInt1%1:s', [s,s2]), 1123, 'LongInt');
|
||||
AddSimpleInt(Format('%sQInt1%1:s', [s,s2]), 11234, 'Int64');
|
||||
|
||||
AddSimpleInt(Format('%sByte1%1:s', [s,s2]), 22, 'Byte');
|
||||
AddSimpleInt(Format('%sWord1%1:s', [s,s2]), 223, 'Word');
|
||||
AddSimpleInt(Format('%sDWord1%1:s', [s,s2]), 2234, 'LongWord');
|
||||
AddSimpleInt(Format('%sQWord1%1:s', [s,s2]), 22345, 'QWord');
|
||||
s2 := s2def;
|
||||
if s2 = '' then s2 := 'ShortInt';
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleArg_Short1']), -92, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleVArg_Short1']), -91, s2);
|
||||
end else begin
|
||||
AddSimpleUInt(Format(s, ['SimpleArg_Short1']), QWord(-92), s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleVArg_Short1']), QWord(-91), s2);
|
||||
end;
|
||||
AddSimpleInt(Format(s, ['Local_Short1']), 39, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Short1 ']), 29, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Short2']), 0, s2);
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Short3']), -1, s2);
|
||||
end;
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Short4']), high(ShortInt), s2);
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Short5']), low(ShortInt), s2);
|
||||
end;
|
||||
|
||||
AddFmtDef(Format('%sSingle1%1:s', [s,s2]), '^0.(5|49)', skSimple, '', [fTpMtch]);
|
||||
AddFmtDef(Format('%sDouble1%1:s', [s,s2]), '^0.2(5|49)', skSimple, '', [fTpMtch]);
|
||||
AddFmtDef(Format('%sExt1%1:s', [s,s2]), '^0.7(5|49)', skSimple, '', [fTpMtch]);
|
||||
AddFmtDef(Format('%sComp1%1:s', [s,s2]), '^-9', skSimple, '', [fTpMtch]);
|
||||
s2 := s2def;
|
||||
if s2 = '' then s2 := 'SmallInt';
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleArg_Small1']), -192, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleVArg_Small1']), -191, s2);
|
||||
end;
|
||||
AddSimpleInt(Format(s, ['Local_Small1']), 391, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Small1 ']), 291, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Small2']), 0, s2);
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Small3']), -1, s2);
|
||||
end;
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Small4']), high(SmallInt), s2);
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Small5']), low(SmallInt), s2);
|
||||
end;
|
||||
|
||||
AddFmtDef(Format('%sBool1%1:s', [s,s2]), '^True', skSimple, '', [fTpMtch]);
|
||||
AddFmtDef(Format('%sBool2%1:s', [s,s2]), '^False', skSimple, '', [fTpMtch]);
|
||||
AddFmtDef(Format('%sEnum1%1:s', [s,s2]), '^eval2', skSimple, '', [fTpMtch]);
|
||||
AddFmtDef(Format('%sEnum2%1:s', [s,s2]), '^eval1', skSimple, '', [fTpMtch]);
|
||||
r := AddFmtDef(Format('%sSet1%1:s', [s,s2]), '^\[eval2\]', skSimple, '', [fTpMtch]);
|
||||
UpdExpRes(r, stDwarf, '', skSimple); // no sets in dwarf2
|
||||
r := AddFmtDef(Format('%sSet2%1:s', [s,s2]), '^\[\]', skSimple, '', [fTpMtch]);
|
||||
UpdExpRes(r, stDwarf, '', skSimple); // no sets in dwarf2
|
||||
s2 := s2def;
|
||||
if s2 = '' then s2 := M_Int;
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleArg_Int1']), -1902, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleVArg_Int1']), -1901, s2);
|
||||
end;
|
||||
AddSimpleInt(Format(s, ['Local_Int1']), 3901, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int1']), 2901, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int2']), 0, s2);
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int3']), -1, s2);
|
||||
end;
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int4']), 2147483647, s2);
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int5']), -2147483648, s2);
|
||||
end;
|
||||
|
||||
end; // i2
|
||||
s2 := s2def;
|
||||
if s2 = '' then s2 := 'Int64';
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleArg_QInt1']), -190000000000002, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleVArg_QInt1']), -190000000000001, s2);
|
||||
end;
|
||||
AddSimpleInt(Format(s, ['Local_QInt1']), 39001, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_QInt1 ']), 29001, s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_QInt2']), 0, s2);
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_QInt3']), -1, s2);
|
||||
end;
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_QInt4']), high(Int64), s2);
|
||||
if not(i in [3]) then begin
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_QInt5']), low(Int64), s2);
|
||||
end;
|
||||
|
||||
end; // i
|
||||
{%endregion Fields }
|
||||
end;
|
||||
s2 := s2def;
|
||||
if s2 = '' then s2 := 'Byte';
|
||||
AddSimpleUInt(Format(s, ['Local_Byte1']), 59, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Byte1 ']), 49, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Byte2']), $7f, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Byte3']), $80, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Byte4']), high(Byte), s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Byte5']), low(Byte), s2);
|
||||
|
||||
procedure TTestWatches.AddExpectSimple_3;
|
||||
s2 := s2def;
|
||||
if s2 = '' then s2 := 'Word';
|
||||
AddSimpleUInt(Format(s, ['Local_Word1']), 591, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Word1 ']), 491, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Word2']), $7fff, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Word3']), $8000, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Word4']), high(Word), s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_Word5']), low(Word), s2);
|
||||
|
||||
s2 := s2def;
|
||||
if s2 = '' then s2 := 'LongWord';
|
||||
AddSimpleUInt(Format(s, ['Local_DWord1']), 5901, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_DWord1 ']), 4901, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_DWord2']), $7fffffff, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_DWord3']), $80000000, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_DWord4']), high(LongWord), s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_DWord5']), low(LongWord), s2);
|
||||
|
||||
s2 := s2def;
|
||||
if s2 = '' then s2 := 'QWord';
|
||||
if not(i in [2]) then begin
|
||||
AddSimpleUInt(Format(s, ['Local_QWord1']), 59001, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_QWord1 ']), 49001, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_QWord2']), $7fffffffffffffff, s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_QWord3']), qword($8000000000000000), s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_QWord4']), high(QWord), s2);
|
||||
AddSimpleUInt(Format(s, ['SimpleGlob_QWord5']), low(QWord), s2);
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
s2 := 'Byte';
|
||||
s := 'Byte(%s)';
|
||||
AddSimpleInt(Format(s, ['SimpleArg_Int1']), Byte(-1902), s2);
|
||||
AddSimpleInt(Format(s, ['SimpleVArg_Int1']), Byte(-1901), s2);
|
||||
AddSimpleInt(Format(s, ['Local_Int1']), Byte(3901), s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int1']), Byte(2901), s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int2']), Byte(0), s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int3']), Byte(-1), s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int4']), Byte(2147483647), s2);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Int5']), Byte(-2147483648), s2);
|
||||
|
||||
|
||||
for i := 0 to 3 do begin
|
||||
case i of
|
||||
0: s := 'SimpleArg_Class1.%s';
|
||||
1: s := 'SimpleVArg_Class1.%s';
|
||||
2: s := 'SimpleArg_Class2.%s';
|
||||
3: s := 'SimpleVArg_Class2.%s';
|
||||
end;
|
||||
j := 0;
|
||||
if i in [2,3] then j := 100;
|
||||
|
||||
AddSimpleInt(Format(s, ['Field_Short1']), j+11, 'ShortInt');
|
||||
AddSimpleInt(Format(s, ['Field_Small1']), j+12, 'SmallInt');
|
||||
AddSimpleInt(Format(s, ['Field_Int1']), j+13, 'LongInt');
|
||||
AddSimpleInt(Format(s, ['Field_QInt1']), j+14, 'Int64');
|
||||
|
||||
AddSimpleInt(Format(s, ['Field_Byte1']), j+15, 'Byte');
|
||||
AddSimpleInt(Format(s, ['Field_Word1']), j+16, 'Word');
|
||||
AddSimpleInt(Format(s, ['Field_DWord1']), j+17, 'LongWord');
|
||||
AddSimpleInt(Format(s, ['Field_QWord1']), j+18, 'QWord');
|
||||
end;
|
||||
{%endregion}
|
||||
|
||||
s := '%s';
|
||||
AddFmtDef(Format(s, ['SimpleGlob_Single1']), '^99\.(2|19)', skSimple, '', [fTpMtch]);
|
||||
AddFmtDef(Format(s, ['SimpleGlob_Double1']), '^199\.(3|29)', skSimple, '', [fTpMtch]);
|
||||
AddFmtDef(Format(s, ['SimpleGlob_Ext1']), '^299\.(4|39)', skSimple, '', [fTpMtch]);
|
||||
AddSimpleInt(Format(s, ['SimpleGlob_Comp1']), -2, '');
|
||||
|
||||
{%region AddressOf / Var param, hidden pointer}
|
||||
//SimplePArg_Int1, SimplePVArg_Int1, SimplePLocal_Int1, SimplePGlob_Int1: PLongInt;
|
||||
r := AddFmtDef('@SimpleArg_Int1', 'replaceme', skPointer, '');
|
||||
r^.OnBeforeTest := @AdjustExpectToAddress;
|
||||
r^.UserData := pointer(ptruint(Length(FCurrentExpect^)));
|
||||
r^.UserData2 := FCurrentExpect;
|
||||
AddFmtDef('SimplePArg_Int1', '\$[0-9A-F]', skPointer, '');
|
||||
|
||||
r := AddFmtDef('@SimpleVArg_Int1', 'replaceme', skPointer, '');
|
||||
UpdResMinFpc(r, stSymAll, 020600);
|
||||
r^.OnBeforeTest := @AdjustExpectToAddress;
|
||||
r^.UserData := pointer(PtrUInt(Length(FCurrentExpect^)));
|
||||
r^.UserData2 := FCurrentExpect;
|
||||
AddFmtDef('SimplePVArg_Int1', '\$[0-9A-F]', skPointer, '');
|
||||
|
||||
r := AddFmtDef('@Local_Int1', 'replaceme', skPointer, '');
|
||||
r^.OnBeforeTest := @AdjustExpectToAddress;
|
||||
r^.UserData := pointer(PtrUInt(Length(FCurrentExpect^)));
|
||||
r^.UserData2 := FCurrentExpect;
|
||||
AddFmtDef('SimplePLocal_Int1', '\$[0-9A-F]', skPointer, '');
|
||||
|
||||
r := AddFmtDef('@SimpleGlob_Int1', 'replaceme', skPointer, '');
|
||||
r^.OnBeforeTest := @AdjustExpectToAddress;
|
||||
r^.UserData := pointer(PtrUInt(Length(FCurrentExpect^)));
|
||||
r^.UserData2 := FCurrentExpect;
|
||||
AddFmtDef('SimplePGlob_Int1', '\$[0-9A-F]', skPointer, '');
|
||||
|
||||
{%endregion}
|
||||
end;
|
||||
var
|
||||
s: String;
|
||||
BrkIdx, i, i2, j: Integer;
|
||||
s, s2, s2def: String;
|
||||
r: PWatchExpectation;
|
||||
begin
|
||||
FCurrentExpect := @ExpectBreakSimple_3;
|
||||
AddExpectSimple_2(True);
|
||||
for BrkIdx := 1 to BREAK_COUNT_TestWatchesUnitSimple do begin
|
||||
FCurrentExpect := @ExpectBreakSimple[BrkIdx];
|
||||
|
||||
if BrkIdx in [1] then begin // Test1Sub
|
||||
AddExpectSimple_Test1Sub;
|
||||
continue;
|
||||
end;
|
||||
|
||||
{%region Fields / Glob / ... }
|
||||
for i := 0 to 5 do begin
|
||||
case BrkIdx of
|
||||
// Simple_NoneNested
|
||||
4, 5: if not (i in [1]) then continue; // Only Global /// TODO: test for error
|
||||
// Test2Method
|
||||
8..13: if not (i in [0, 1, 5, 6]) then continue;
|
||||
// Class[12].Test0Method
|
||||
6..7, 14..15: if not (i in [1]) then continue; // Only Global /// TODO: test for error
|
||||
// Class0.Test0Method
|
||||
16..17: if not (i in [1]) then continue; // Only Global /// TODO: test for error
|
||||
end;
|
||||
|
||||
case i of
|
||||
0: s := 'Field_';
|
||||
1: s := 'SimpleGlob_';
|
||||
2: s := 'Arg_';
|
||||
3: s := 'VArg_';
|
||||
4: s := 'Local_';
|
||||
5: s := 'self.Field_';
|
||||
//6: s := 'TSimpleClass1(self).Field_';
|
||||
//7: s := 'TSimpleClass2(self).Field_';
|
||||
//8: s := 'TSimpleClass0(self).Field_';
|
||||
// 6: passed in object / var arg object
|
||||
// unit.glob
|
||||
end;
|
||||
|
||||
{%region address of }
|
||||
//r := AddFmtDef(Format('@%sDynInt1', [s]), '\REPLACEME', skPointer, '', [fTpMtch]);
|
||||
//if i = 3 then UpdResMinFpc(r, stSymAll, 020600);
|
||||
//r^.OnBeforeTest := @AdjustArrayExpectToAddress;
|
||||
//r^.UserData := pointer(ptruint(Length(FCurrentExpect^)));
|
||||
//r^.UserData2 := FCurrentExpect;
|
||||
//AddFmtDef(Format('%sPDynInt1', [s]), '\$[0-9A-F]', skPointer, '', [fTpMtch]);
|
||||
|
||||
{%endregion address of }
|
||||
|
||||
|
||||
for i2 := 0 to 1 do begin
|
||||
s2 := '';
|
||||
if i2 = 1 then begin
|
||||
s := s + 'P';
|
||||
s2 := '^';
|
||||
end;
|
||||
|
||||
AddSimpleInt(Format('%sShort1%1:s', [s,s2]), 11, 'ShortInt');
|
||||
AddSimpleInt(Format('%sSmall1%1:s', [s,s2]), 112, 'SmallInt');
|
||||
AddSimpleInt(Format('%sInt1%1:s', [s,s2]), 1123, 'LongInt');
|
||||
AddSimpleInt(Format('%sQInt1%1:s', [s,s2]), 11234, 'Int64');
|
||||
|
||||
AddSimpleInt(Format('%sByte1%1:s', [s,s2]), 22, 'Byte');
|
||||
AddSimpleInt(Format('%sWord1%1:s', [s,s2]), 223, 'Word');
|
||||
AddSimpleInt(Format('%sDWord1%1:s', [s,s2]), 2234, 'LongWord');
|
||||
AddSimpleInt(Format('%sQWord1%1:s', [s,s2]), 22345, 'QWord');
|
||||
|
||||
AddFmtDef(Format('%sSingle1%1:s', [s,s2]), '^0.(5|49)', skSimple, '', [fTpMtch]);
|
||||
AddFmtDef(Format('%sDouble1%1:s', [s,s2]), '^0.2(5|49)', skSimple, '', [fTpMtch]);
|
||||
AddFmtDef(Format('%sExt1%1:s', [s,s2]), '^0.7(5|49)', skSimple, '', [fTpMtch]);
|
||||
AddFmtDef(Format('%sComp1%1:s', [s,s2]), '^-9', skSimple, '', [fTpMtch]);
|
||||
|
||||
AddFmtDef(Format('%sBool1%1:s', [s,s2]), '^True', skSimple, '', [fTpMtch]);
|
||||
AddFmtDef(Format('%sBool2%1:s', [s,s2]), '^False', skSimple, '', [fTpMtch]);
|
||||
AddFmtDef(Format('%sEnum1%1:s', [s,s2]), '^eval2', skSimple, '', [fTpMtch]);
|
||||
AddFmtDef(Format('%sEnum2%1:s', [s,s2]), '^eval1', skSimple, '', [fTpMtch]);
|
||||
r := AddFmtDef(Format('%sSet1%1:s', [s,s2]), '^\[eval2\]', skSimple, '', [fTpMtch]);
|
||||
UpdExpRes(r, stDwarf, '', skSimple); // no sets in dwarf2
|
||||
r := AddFmtDef(Format('%sSet2%1:s', [s,s2]), '^\[\]', skSimple, '', [fTpMtch]);
|
||||
UpdExpRes(r, stDwarf, '', skSimple); // no sets in dwarf2
|
||||
|
||||
end; // i2
|
||||
|
||||
end; // i
|
||||
{%endregion Fields }
|
||||
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTestWatches.AddExpectArray_1;
|
||||
@ -514,12 +559,14 @@ begin
|
||||
if i = 3 then UpdResMinFpc(r, stSymAll, 020600);
|
||||
r^.OnBeforeTest := @AdjustArrayExpectToAddress;
|
||||
r^.UserData := pointer(ptruint(Length(FCurrentExpect^)));
|
||||
r^.UserData2 := FCurrentExpect;
|
||||
AddFmtDef(Format('%sPDynInt1', [s]), '\$[0-9A-F]', skPointer, '', [fTpMtch]);
|
||||
|
||||
r := AddFmtDef(Format('@%sStatInt1', [s]), '\REPLACEME', skPointer, '', [fTpMtch]);
|
||||
if i = 3 then UpdResMinFpc(r, stSymAll, 020600);
|
||||
r^.OnBeforeTest := @AdjustArrayExpectToAddress;
|
||||
r^.UserData := pointer(ptruint(Length(FCurrentExpect^)));
|
||||
r^.UserData2 := FCurrentExpect;
|
||||
AddFmtDef(Format('%sPStatInt1', [s]), '\$[0-9A-F]', skPointer, '', [fTpMtch]);
|
||||
{%endregion address of }
|
||||
|
||||
@ -584,11 +631,13 @@ end;
|
||||
// if i in [3] then UpdResMinFpc(r, stSymAll, 020600);
|
||||
r^.OnBeforeTest := @AdjustArrayExpectToAddress;
|
||||
r^.UserData := pointer(ptruint(Length(FCurrentExpect^)));
|
||||
r^.UserData2 := FCurrentExpect;
|
||||
AddFmtDef(Format('Pointer(%sDynInt1%1:s)', [s,s2]), '\$[0-9A-F]', skPointer, '', [fTpMtch]);
|
||||
r := AddSimpleInt(Format('TArrayDynInt(REPLACEME)[0]', [s,s2]), 5511, M_Int);
|
||||
//if i in [3] then UpdResMinFpc(r, stSymAll, 020600);
|
||||
r^.OnBeforeTest := @AdjustArrayExpectToAddress;
|
||||
r^.UserData := pointer(ptruint(Length(FCurrentExpect^)));
|
||||
r^.UserData2 := FCurrentExpect;
|
||||
AddFmtDef(Format('Pointer(%sDynInt1%1:s)', [s,s2]), '\$[0-9A-F]', skPointer, '', [fTpMtch]);
|
||||
end;
|
||||
|
||||
@ -723,62 +772,48 @@ begin
|
||||
dbg := StartGDB(AppDir, TestExeName);
|
||||
FWatches := Watches.Watches;
|
||||
|
||||
SetBreak('TestWatchesUnitSimple.pas', BREAK_LINE_TestWatchesUnitSimple_1);
|
||||
SetBreak('TestWatchesUnitSimple.pas', BREAK_LINE_TestWatchesUnitSimple_2);
|
||||
SetBreak('TestWatchesUnitSimple.pas', BREAK_LINE_TestWatchesUnitSimple_3);
|
||||
for i := 1 to BREAK_COUNT_TestWatchesUnitSimple do
|
||||
SetBreak('TestWatchesUnitSimple.pas', BREAK_LINE_TestWatchesUnitSimple[i]);
|
||||
SetBreak('TestWatchesUnitArray.pas', BREAK_LINE_TestWatchesUnitArray);
|
||||
|
||||
if dbg.State = dsError then
|
||||
Fail(' Failed Init');
|
||||
|
||||
AddWatches(ExpectBreakSimple_1, FWatches, Only, OnlyName, OnlyNamePart);
|
||||
AddWatches(ExpectBreakSimple_2, FWatches, Only, OnlyName, OnlyNamePart);
|
||||
AddWatches(ExpectBreakSimple_3, FWatches, Only, OnlyName, OnlyNamePart);
|
||||
for i := 1 to BREAK_COUNT_TestWatchesUnitSimple do
|
||||
AddWatches(ExpectBreakSimple[i], FWatches, Only, OnlyName, OnlyNamePart);
|
||||
AddWatches(ExpectBreakArray_1, FWatches, Only, OnlyName, OnlyNamePart);
|
||||
|
||||
(* Start debugging *)
|
||||
dbg.ShowConsole := True;
|
||||
|
||||
|
||||
dbg.Run;
|
||||
if not TestTrue('State=Pause', dbg.State = dsPause) then begin
|
||||
TestTrue('Hit BREAK_LINE_TestWatchesUnitSimple_1', False);
|
||||
exit;
|
||||
end;
|
||||
(* Hit first breakpoint: *)
|
||||
TestWatchList('Simple1',ExpectBreakSimple_1, dbg, Only, OnlyName, OnlyNamePart);
|
||||
|
||||
|
||||
dbg.Run;
|
||||
if not TestTrue('State=Pause', dbg.State = dsPause) then begin
|
||||
TestTrue('Hit BREAK_LINE_TestWatchesUnitSimple', False);
|
||||
exit;
|
||||
end;
|
||||
(* Hit 2nd Simple breakpoint: *)
|
||||
TestWatchList('Simple2',ExpectBreakSimple_2, dbg, Only, OnlyName, OnlyNamePart);
|
||||
for i := 1 to BREAK_COUNT_TestWatchesUnitSimple do begin
|
||||
if not TestTrue('State=Pause', dbg.State = dsPause) then begin
|
||||
TestTrue('Hit BREAK_LINE_TestWatchesUnitSimple_'+IntToStr(i), False);
|
||||
exit;
|
||||
end;
|
||||
AssertTrue('in simple', pos('simple', LowerCase(dbg.GetLocation.SrcFile)) > 0);
|
||||
(* Hit first breakpoint: *)
|
||||
TestWatchList('Simple'+IntToStr(i), ExpectBreakSimple[i], dbg, Only, OnlyName, OnlyNamePart);
|
||||
|
||||
dbg.Run;
|
||||
if not TestTrue('State=Pause', dbg.State = dsPause) then begin
|
||||
TestTrue('Hit BREAK_LINE_TestWatchesUnitSimple', False);
|
||||
exit;
|
||||
dbg.Run;
|
||||
end;
|
||||
(* Hit 3rd Simlpe breakpoint: *)
|
||||
TestWatchList('Simple3',ExpectBreakSimple_3, dbg, Only, OnlyName, OnlyNamePart);
|
||||
|
||||
|
||||
// array
|
||||
|
||||
|
||||
dbg.Run;
|
||||
if not TestTrue('State=Pause', dbg.State = dsPause) then begin
|
||||
TestTrue('Hit BREAK_LINE_TestWatchesUnitArray', False);
|
||||
exit;
|
||||
end;
|
||||
AssertTrue('reached array', pos('array', LowerCase(dbg.GetLocation.SrcFile)) > 0);
|
||||
|
||||
(* Hit 11st Array breakpoint: *)
|
||||
TestWatchList('Array1',ExpectBreakArray_1, dbg, Only, OnlyName, OnlyNamePart);
|
||||
|
||||
dbg.Run;
|
||||
// dbg.Run;
|
||||
|
||||
|
||||
|
||||
@ -806,9 +841,7 @@ begin
|
||||
ClearTestErrors;
|
||||
|
||||
ClearAllTestArrays;
|
||||
AddExpectSimple_1;
|
||||
AddExpectSimple_2;
|
||||
AddExpectSimple_3;
|
||||
AddExpectSimple;
|
||||
AddExpectArray_1;
|
||||
|
||||
RunTestWatches('', TestExeName, '', []);
|
||||
|
Loading…
Reference in New Issue
Block a user