FpDebug: fix reading extended and tests for fpc 3.2.2

(cherry picked from commit dd2ffad6b3)
This commit is contained in:
Martin 2024-11-18 18:20:11 +01:00
parent b7f5a8ff5d
commit e8a1aaf80d
3 changed files with 23 additions and 3 deletions

View File

@ -1318,13 +1318,21 @@ end;
function TFpDbgLocationContext.ReadExtended(const ALocation: TFpDbgMemLocation;
ASize: TFpDbgValueSize; out AValue: TDbgExtended): Boolean;
begin
{$IF DBG_HAS_EXTENDED}
Result := MemManager.ReadMemory(rdtfloat, ALocation, ASize, @AValue, Min(SizeOf(AValue), DBG_EXTENDED_SIZE), Self);
{$ELSE}
Result := MemManager.ReadMemory(rdtfloat, ALocation, ASize, @AValue, Min(SizeOf(AValue), SizeOf(TDbgExtended)), Self);
{$ENDIF}
end;
function TFpDbgLocationContext.ReadFloat(const ALocation: TFpDbgMemLocation;
ASize: TFpDbgValueSize; out AValue: TDbgExtended): Boolean;
begin
{$IF DBG_HAS_EXTENDED}
Result := MemManager.ReadMemory(rdtfloat, ALocation, ASize, @AValue, Min(SizeOf(AValue), DBG_EXTENDED_SIZE), Self);
{$ELSE}
Result := MemManager.ReadMemory(rdtfloat, ALocation, ASize, @AValue, Min(SizeOf(AValue), SizeOf(TDbgExtended)), Self);
{$ENDIF}
end;
function TFpDbgLocationContext.ReadString(const ALocation: TFpDbgMemLocation; ALen: Int64; out

View File

@ -254,7 +254,10 @@ begin
FCurrentTestName := 'Extended';
DataExt := 1.7722;
GotRes := FDummyContext.ReadFloat(TargetLoc(TDbgPtr(@DataExt)), SizeVal(DBG_EXTENDED_SIZE), GotExt);
if DBG_HAS_EXTENDED then
GotRes := FDummyContext.ReadFloat(TargetLoc(TDbgPtr(@DataExt)), SizeVal(DBG_EXTENDED_SIZE), GotExt)
else
GotRes := FDummyContext.ReadFloat(TargetLoc(TDbgPtr(@DataExt)), SizeVal(SizeOf(DataExt)), GotExt);
AssertTrue(FCurrentTestName + 'Read OK', GotRes);
AssertEquals(FCurrentTestName + 'target not changed', 1.7722, double(DataExt));
AssertEquals(FCurrentTestName + 'Val', double(DataExt), double(GotExt));

View File

@ -757,7 +757,8 @@ procedure TTestWatches.TestWatchesValue;
t.Add(AName, p+'Real'+e, weFloat(50.25+n, x+'Real' ));
t.Add(AName, p+'Single'+e, weSingle(100.125+n, x+'Single' ));
t.Add(AName, p+'Double'+e, weDouble(1000.125+n, x+'Double' ));
t.Add(AName, p+'Extended'+e, weFloat(10000.175+n, '' )); // Double ?
t.Add(AName, p+'Extended'+e, weFloat(10000.175+n, '' )) // Double ?
.IgnAll([], Compiler.Version <= 030202);
// {$IFDEF cpu64}
// if Compiler.CpuBitType = cpu32 then // a 64bit debugger does has no 10byte extended type // TODO: check for error
// t.Tests[-1]^.AddFlag(ehExpectError); // TODO: check error msg
@ -773,7 +774,8 @@ procedure TTestWatches.TestWatchesValue;
t.Add(AName, p+'Real_2'+e, weFloat(-50.25+n, x+'Real' ));
t.Add(AName, p+'Single_2'+e, weSingle(-100.125+n, x+'Single' ));
t.Add(AName, p+'Double_2'+e, weDouble(-1000.125+n, x+'Double' ));
t.Add(AName, p+'Extended_2'+e, weFloat(-10000.175+n, '' )); // Double ?
t.Add(AName, p+'Extended_2'+e, weFloat(-10000.175+n, '' )) // Double ?
.IgnAll([], Compiler.Version <= 030202);
// {$IFDEF cpu64}
// if Compiler.CpuBitType = cpu32 then // a 64bit debugger does has no 10byte extended type // TODO: check for error
// t.Tests[-1]^.AddFlag(ehExpectError); // TODO: check error msg
@ -1780,6 +1782,11 @@ begin
t.Clear;
(*
:ord
gvBitPackEnumArray
TEnumX1
*)
t.Add('refcnt', PREFIX+'refcnt(SRef0)', weInteger( 0, #1, 0)).IgnTypeName().IgnAll(stDwarf2);
t.Add('refcnt', PREFIX+'refcnt(SRef1)', weInteger(-1, #1, 0)).IgnTypeName().IgnAll(stDwarf2);
@ -4082,6 +4089,7 @@ procedure TTestWatches.TestWatchesExpression;
t.Add('Signed ENUM-Cmp: ', enx01+' < '+enx02, weBool((i and $FFFC) < (j and $FFFC)));
t.Add('Signed ENUM-Cmp: ', enx01+' <> '+enx02, weBool((i and $FFFC) <> (j and $FFFC)));
t.Add('Signed ENUM-Cmp: ', enx01+' = '+enx02, weBool((i and $FFFC) = (j and $FFFC)));
// t.Add('Signed ENUM-Cmp: ', enx01+' in ['+enx02+']', weBool((i and $FFFC) = (j and $FFFC)));
end;
for i := 0 to 39 do
@ -4116,6 +4124,7 @@ procedure TTestWatches.TestWatchesExpression;
t.Add('Signed ENUM-Cmp: ', enx01+' < '+enx02, weBool((i and $FFFC) < (j and $FFFC)));
t.Add('Signed ENUM-Cmp: ', enx01+' <> '+enx02, weBool((i and $FFFC) <> (j and $FFFC)));
t.Add('Signed ENUM-Cmp: ', enx01+' = '+enx02, weBool((i and $FFFC) = (j and $FFFC)));
// t.Add('Signed ENUM-Cmp: ', enx01+' in ['+enx02+']', weBool((i and $FFFC) = (j and $FFFC)));
end;
for i := 0 to t.Count-1 do