mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 13:29:37 +02:00
FpDebug: Watch-Function-Eval, support QWord parameters on 32 bit targets
This commit is contained in:
parent
c0fbe886a0
commit
9e813a6a78
@ -43,6 +43,7 @@ type
|
|||||||
constructor Create(const AName: String;
|
constructor Create(const AName: String;
|
||||||
const AAddress: TFpDbgMemLocation;
|
const AAddress: TFpDbgMemLocation;
|
||||||
ATypeSymbol: TFpSymbol); overload;
|
ATypeSymbol: TFpSymbol); overload;
|
||||||
|
property NewAddress: TFpDbgMemLocation write SetAddress;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFpDbgInfoCallContext }
|
{ TFpDbgInfoCallContext }
|
||||||
@ -63,6 +64,7 @@ type
|
|||||||
|
|
||||||
function AllocStack(ASize: Integer): TDbgPtr;
|
function AllocStack(ASize: Integer): TDbgPtr;
|
||||||
function CreatePreparedStackLocation(ASize: Integer): TFpDbgMemLocation;
|
function CreatePreparedStackLocation(ASize: Integer): TFpDbgMemLocation;
|
||||||
|
function InternalGetLocation(AParamIndex: Integer; ASize: Integer = 0): TFpDbgMemLocation;
|
||||||
function InternalCreateParamSymbol(ParameterMemLocation: TFpDbgMemLocation; ASymbolType: TFpSymbol; AName: String): TFpValue;
|
function InternalCreateParamSymbol(ParameterMemLocation: TFpDbgMemLocation; ASymbolType: TFpSymbol; AName: String): TFpValue;
|
||||||
function InternalCreateParamSymbol(AParamIndex: Integer; ASymbolType: TFpSymbol; AName: String): TFpValue; inline;
|
function InternalCreateParamSymbol(AParamIndex: Integer; ASymbolType: TFpSymbol; AName: String): TFpValue; inline;
|
||||||
function AddRecordParam(AParamSymbolType: TFpSymbol; AValue: TFpValue): Boolean;
|
function AddRecordParam(AParamSymbolType: TFpSymbol; AValue: TFpValue): Boolean;
|
||||||
@ -203,6 +205,23 @@ begin
|
|||||||
Result := SelfLoc(@FPreparedStack[l]);
|
Result := SelfLoc(@FPreparedStack[l]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TFpDbgInfoCallContext.InternalGetLocation(AParamIndex: Integer;
|
||||||
|
ASize: Integer): TFpDbgMemLocation;
|
||||||
|
begin
|
||||||
|
if (FDbgProcess.Mode = dm32) and (ASize = 8) then begin
|
||||||
|
Result := CreatePreparedStackLocation(ASize);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Result := FDbgProcess.CallParamDefaultLocation(AParamIndex);
|
||||||
|
if IsValidLoc(Result) then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
if ASize = 0 then
|
||||||
|
ASize := SizeOfAddress;
|
||||||
|
Result := CreatePreparedStackLocation(ASize);
|
||||||
|
end;
|
||||||
|
|
||||||
function TFpDbgInfoCallContext.InternalCreateParamSymbol(
|
function TFpDbgInfoCallContext.InternalCreateParamSymbol(
|
||||||
ParameterMemLocation: TFpDbgMemLocation; ASymbolType: TFpSymbol; AName: String
|
ParameterMemLocation: TFpDbgMemLocation; ASymbolType: TFpSymbol; AName: String
|
||||||
): TFpValue;
|
): TFpValue;
|
||||||
@ -225,13 +244,8 @@ end;
|
|||||||
|
|
||||||
function TFpDbgInfoCallContext.InternalCreateParamSymbol(AParamIndex: Integer;
|
function TFpDbgInfoCallContext.InternalCreateParamSymbol(AParamIndex: Integer;
|
||||||
ASymbolType: TFpSymbol; AName: String): TFpValue;
|
ASymbolType: TFpSymbol; AName: String): TFpValue;
|
||||||
var
|
|
||||||
Loc: TFpDbgMemLocation;
|
|
||||||
begin
|
begin
|
||||||
Loc := FDbgProcess.CallParamDefaultLocation(AParamIndex);
|
Result := InternalCreateParamSymbol(InternalGetLocation(AParamIndex), ASymbolType, AName);
|
||||||
if not IsValidLoc(Loc) then
|
|
||||||
Loc := CreatePreparedStackLocation(SizeOfAddress);
|
|
||||||
Result := InternalCreateParamSymbol(Loc, ASymbolType, AName);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFpDbgInfoCallContext.AddRecordParam(AParamSymbolType: TFpSymbol;
|
function TFpDbgInfoCallContext.AddRecordParam(AParamSymbolType: TFpSymbol;
|
||||||
@ -486,7 +500,9 @@ end;
|
|||||||
|
|
||||||
function TFpDbgInfoCallContext.AddParam(AParamSymbolType: TFpSymbol; AValue: TFpValue): Boolean;
|
function TFpDbgInfoCallContext.AddParam(AParamSymbolType: TFpSymbol; AValue: TFpValue): Boolean;
|
||||||
var
|
var
|
||||||
ParamSymbol: TFpValue;
|
ParamSymbol: TFpSymbolDwarfFunctionResult;
|
||||||
|
ParamValue: TFpValue;
|
||||||
|
s: TFpDbgValueSize;
|
||||||
begin
|
begin
|
||||||
if AValue.Kind = skRecord then begin
|
if AValue.Kind = skRecord then begin
|
||||||
Result := AddRecordParam(AParamSymbolType, AValue);
|
Result := AddRecordParam(AParamSymbolType, AValue);
|
||||||
@ -494,18 +510,29 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Result := False;
|
Result := False;
|
||||||
ParamSymbol := InternalCreateParamSymbol(FNextParamRegister, AParamSymbolType, '');
|
|
||||||
Result := ParamSymbol <> nil;
|
// ParamValue := InternalCreateParamSymbol(FNextParamRegister, AParamSymbolType, '');
|
||||||
if not Result then
|
ParamValue := nil;
|
||||||
exit;
|
ParamSymbol := TFpSymbolDwarfFunctionResult.Create('', InvalidLoc, AParamSymbolType);
|
||||||
try
|
try
|
||||||
|
ParamValue := ParamSymbol.Value;
|
||||||
|
TFpValueDwarf(ParamValue).Context := Self;
|
||||||
|
if (FDbgProcess.Mode = dm32) and (ParamValue.GetSize(s)) and (SizeToFullBytes(s) = 8) then
|
||||||
|
ParamSymbol.NewAddress := InternalGetLocation(FNextParamRegister, SizeToFullBytes(s))
|
||||||
|
else
|
||||||
|
ParamSymbol.NewAddress := InternalGetLocation(FNextParamRegister);
|
||||||
|
|
||||||
|
Result := ParamValue <> nil;
|
||||||
|
if not Result then
|
||||||
|
exit;
|
||||||
if Length(FPreparedStack) > 0 then
|
if Length(FPreparedStack) > 0 then
|
||||||
MemManager.SetWritableSeflMem(TDBGPtr(@FPreparedStack[0]), Length(FPreparedStack));
|
MemManager.SetWritableSeflMem(TDBGPtr(@FPreparedStack[0]), Length(FPreparedStack));
|
||||||
ParamSymbol.AsCardinal := AValue.AsCardinal;
|
ParamValue.AsCardinal := AValue.AsCardinal;
|
||||||
Result := not IsError(ParamSymbol.LastError);
|
Result := not IsError(ParamValue.LastError);
|
||||||
FLastError := ParamSymbol.LastError;
|
FLastError := ParamValue.LastError;
|
||||||
finally
|
finally
|
||||||
ParamSymbol.ReleaseReference;
|
ParamSymbol.ReleaseReference;
|
||||||
|
ParamValue.ReleaseReference;
|
||||||
MemManager.ClearWritableSeflMem;
|
MemManager.ClearWritableSeflMem;
|
||||||
end;
|
end;
|
||||||
inc(FNextParamRegister);
|
inc(FNextParamRegister);
|
||||||
|
@ -121,6 +121,7 @@ begin
|
|||||||
FuncWord1(1);
|
FuncWord1(1);
|
||||||
FuncWord2(1,2);
|
FuncWord2(1,2);
|
||||||
FuncWord12(1,2,3,4,5,6,7,8,9,10,11,12);
|
FuncWord12(1,2,3,4,5,6,7,8,9,10,11,12);
|
||||||
|
FuncInt1(1);
|
||||||
FuncInt2(1,2);
|
FuncInt2(1,2);
|
||||||
FuncInt12(1,2,3,4,5,6,7,8,9,10,11,12);
|
FuncInt12(1,2,3,4,5,6,7,8,9,10,11,12);
|
||||||
FuncQWord1(1);
|
FuncQWord1(1);
|
||||||
|
@ -1758,6 +1758,19 @@ begin
|
|||||||
AddTest('FuncByte2(11,99)', '1199', weInteger(4, #1, 4));
|
AddTest('FuncByte2(11,99)', '1199', weInteger(4, #1, 4));
|
||||||
AddTest('FuncByte12(1,2,3,4,5,6,7,8,9,11,99,0)', '12345678911990', weInteger(14, #1, 4));
|
AddTest('FuncByte12(1,2,3,4,5,6,7,8,9,11,99,0)', '12345678911990', weInteger(14, #1, 4));
|
||||||
|
|
||||||
|
AddTest('FuncWord1(191)', '191', weInteger(3, #1, 4));
|
||||||
|
AddTest('FuncWord2(2211,99)', '221199', weInteger(6, #1, 4));
|
||||||
|
AddTest('FuncWord12(991,2,3,4,5,6,7,8,9,11,799,0)', '99123456789117990', weInteger(17, #1, 4));
|
||||||
|
|
||||||
|
AddTest('FuncInt1(191)', '191', weInteger(3, #1, 4));
|
||||||
|
AddTest('FuncInt2(11,99)', '1199', weInteger(4, #1, 4));
|
||||||
|
AddTest('FuncInt12(3000001,2,3,4,5,6,7,8,9,11,2000099,0)', '3000001234567891120000990', weInteger(25, #1, 4));
|
||||||
|
|
||||||
|
AddTest('FuncQWord1(191)', '191', weInteger(3, #1, 4));
|
||||||
|
AddTest('FuncQWord2(11,99)', '1199', weInteger(4, #1, 4));
|
||||||
|
AddTest('FuncQWord12(40000000000001,2,3,4,5,6,7,8,9,11,300000000000099,0)', '4000000000000123456789113000000000000990', weInteger(40, #1, 4));
|
||||||
|
|
||||||
|
|
||||||
AddTest('foo.FuncInt12(1,2,3,4,5,6,7,8,9,11,99,0)', '12345678911990201', weInteger(17, #1, 4));
|
AddTest('foo.FuncInt12(1,2,3,4,5,6,7,8,9,11,99,0)', '12345678911990201', weInteger(17, #1, 4));
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user