FpDebug: fix tests

git-svn-id: trunk@44535 -
This commit is contained in:
martin 2014-03-28 01:55:43 +00:00
parent bc1c825688
commit ebcc3ca021
2 changed files with 23 additions and 16 deletions

View File

@ -49,7 +49,7 @@ type
function AddSimpleInt(AnExpr: string; AMtch: Int64; ATpNm: string): PWatchExpectation; function AddSimpleInt(AnExpr: string; AMtch: Int64; ATpNm: string): PWatchExpectation;
function AddSimpleUInt(AnExpr: string; AMtch: QWord; ATpNm: string): PWatchExpectation; function AddSimpleUInt(AnExpr: string; AMtch: QWord; ATpNm: string): PWatchExpectation;
procedure AdjustExpectToAddress(AWatchExp: PWatchExpectation); procedure AdjustExpectToAddress(AWatchExp: PWatchExpectation); // only ExpectBreakSimple_1
procedure AddExpectSimple_1; procedure AddExpectSimple_1;
procedure AddExpectSimple_2; procedure AddExpectSimple_2;
@ -110,13 +110,12 @@ end;
procedure TTestWatches.AdjustExpectToAddress(AWatchExp: PWatchExpectation); procedure TTestWatches.AdjustExpectToAddress(AWatchExp: PWatchExpectation);
var var
OtherWatchExp: PWatchExpectation; OtherWatchExp: TWatchExpectation;
s: String; s: String;
st: TSymbolType; st: TSymbolType;
begin begin
OtherWatchExp := PWatchExpectation(AWatchExp^.UserData); OtherWatchExp := ExpectBreakSimple_1[PtrUInt(AWatchExp^.UserData)];
if OtherWatchExp = nil then exit;; s := OtherWatchExp.TheWatch.Values[1,0].Value;
s := OtherWatchExp^.TheWatch.Values[1,0].Value;
delete(s, 1, pos('$', s) - 1); delete(s, pos(')', s), 99); delete(s, 1, pos('$', s) - 1); delete(s, pos(')', s), 99);
for st := low(TSymbolType) to high(TSymbolType) do for st := low(TSymbolType) to high(TSymbolType) do
AWatchExp^.Result[st].ExpMatch := '\'+s; AWatchExp^.Result[st].ExpMatch := '\'+s;
@ -137,12 +136,11 @@ end;
function TTestWatches.HasTestArraysData: Boolean; function TTestWatches.HasTestArraysData: Boolean;
begin begin
//Result := (Length(ExpectBreakFooGdb) > 0) or Result :=
// (Length(ExpectBreakSubFoo) > 0) or (Length(ExpectBreakSimple_1) > 0) or
// (Length(ExpectBreakFoo) > 0) or (Length(ExpectBreakSimple_2) > 0) or
// (Length(ExpectBreakFooArray) >0 ); (Length(ExpectBreakSimple_3) > 0) or
// (Length(ExpectBreakArray_1) > 0);
end; end;
function TTestWatches.Add(AnExpr: string; AFmt: TWatchDisplayFormat; AMtch: string; function TTestWatches.Add(AnExpr: string; AFmt: TWatchDisplayFormat; AMtch: string;
@ -362,20 +360,24 @@ begin
//SimplePArg_Int1, SimplePVArg_Int1, SimplePLocal_Int1, SimplePGlob_Int1: PLongInt; //SimplePArg_Int1, SimplePVArg_Int1, SimplePLocal_Int1, SimplePGlob_Int1: PLongInt;
r := AddFmtDef('@SimpleArg_Int1', 'replaceme', skPointer, ''); r := AddFmtDef('@SimpleArg_Int1', 'replaceme', skPointer, '');
r^.OnBeforeTest := @AdjustExpectToAddress; r^.OnBeforeTest := @AdjustExpectToAddress;
r^.UserData := AddFmtDef('SimplePArg_Int1', '\$[0-9A-F]', skPointer, ''); r^.UserData := pointer(ptruint(Length(FCurrentExpect^)));
AddFmtDef('SimplePArg_Int1', '\$[0-9A-F]', skPointer, '');
r := AddFmtDef('@SimpleVArg_Int1', 'replaceme', skPointer, ''); r := AddFmtDef('@SimpleVArg_Int1', 'replaceme', skPointer, '');
r^.OnBeforeTest := @AdjustExpectToAddress;
r^.UserData := AddFmtDef('SimplePVArg_Int1', '\$[0-9A-F]', skPointer, '');
UpdResMinFpc(r, stSymAll, 020600); UpdResMinFpc(r, stSymAll, 020600);
r^.OnBeforeTest := @AdjustExpectToAddress;
r^.UserData := pointer(PtrUInt(Length(FCurrentExpect^)));
AddFmtDef('SimplePVArg_Int1', '\$[0-9A-F]', skPointer, '');
r := AddFmtDef('@SimpleLocal_Int1', 'replaceme', skPointer, ''); r := AddFmtDef('@SimpleLocal_Int1', 'replaceme', skPointer, '');
r^.OnBeforeTest := @AdjustExpectToAddress; r^.OnBeforeTest := @AdjustExpectToAddress;
r^.UserData := AddFmtDef('SimplePLocal_Int1', '\$[0-9A-F]', skPointer, ''); r^.UserData := pointer(PtrUInt(Length(FCurrentExpect^)));
AddFmtDef('SimplePLocal_Int1', '\$[0-9A-F]', skPointer, '');
r := AddFmtDef('@SimpleGlob_Int1', 'replaceme', skPointer, ''); r := AddFmtDef('@SimpleGlob_Int1', 'replaceme', skPointer, '');
r^.OnBeforeTest := @AdjustExpectToAddress; r^.OnBeforeTest := @AdjustExpectToAddress;
r^.UserData := AddFmtDef('SimplePGlob_Int1', '\$[0-9A-F]', skPointer, ''); r^.UserData := pointer(PtrUInt(Length(FCurrentExpect^)));
AddFmtDef('SimplePGlob_Int1', '\$[0-9A-F]', skPointer, '');
{%region} {%region}

View File

@ -237,6 +237,9 @@ begin
Expression := AnExpr; Expression := AnExpr;
DspFormat := AFmt; DspFormat := AFmt;
EvaluateFlags := AEvaluateFlags; EvaluateFlags := AEvaluateFlags;
TheWatch := nil;
OnBeforeTest := nil;
UserData := nil;
for i := low(TSymbolType) to high(TSymbolType) do begin for i := low(TSymbolType) to high(TSymbolType) do begin
Result[i].ExpMatch := AMtch; Result[i].ExpMatch := AMtch;
Result[i].ExpKind := AKind; Result[i].ExpKind := AKind;
@ -539,6 +542,7 @@ var
i: Integer; i: Integer;
begin begin
for i := low(ExpectList) to high(ExpectList) do begin for i := low(ExpectList) to high(ExpectList) do begin
ExpectList[i].TheWatch := nil;
if not MatchOnly(ExpectList[i], i) then continue; if not MatchOnly(ExpectList[i], i) then continue;
if not SkipTest(ExpectList[i]) then begin if not SkipTest(ExpectList[i]) then begin
ExpectList[i].TheWatch := TTestWatch.Create(AWatches); ExpectList[i].TheWatch := TTestWatch.Create(AWatches);
@ -574,6 +578,7 @@ var
begin begin
for i := low(ExpectList) to high(ExpectList) do begin for i := low(ExpectList) to high(ExpectList) do begin
if not MatchOnly(ExpectList[i], i) then continue; if not MatchOnly(ExpectList[i], i) then continue;
if ExpectList[i].TheWatch = nil then continue;
if not SkipTest(ExpectList[i]) then if not SkipTest(ExpectList[i]) then
TestWatch(AName + ' '+IntToStr(i)+' ', ADbg, ExpectList[i].TheWatch, ExpectList[i]); TestWatch(AName + ' '+IntToStr(i)+' ', ADbg, ExpectList[i].TheWatch, ExpectList[i]);
end; end;