mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 02:19:32 +02:00
DebuggerIntf, FpDebug: add boolean
This commit is contained in:
parent
19e0cbf641
commit
01a6b1dd5f
@ -31,6 +31,7 @@ type
|
|||||||
function StringToResData(AnFpValue: TFpValue; AnResData: TLzDbgWatchDataIntf): Boolean;
|
function StringToResData(AnFpValue: TFpValue; AnResData: TLzDbgWatchDataIntf): Boolean;
|
||||||
function WideStringToResData(AnFpValue: TFpValue; AnResData: TLzDbgWatchDataIntf): Boolean;
|
function WideStringToResData(AnFpValue: TFpValue; AnResData: TLzDbgWatchDataIntf): Boolean;
|
||||||
|
|
||||||
|
function BoolToResData(AnFpValue: TFpValue; AnResData: TLzDbgWatchDataIntf): Boolean;
|
||||||
function EnumToResData(AnFpValue: TFpValue; AnResData: TLzDbgWatchDataIntf): Boolean;
|
function EnumToResData(AnFpValue: TFpValue; AnResData: TLzDbgWatchDataIntf): Boolean;
|
||||||
function SetToResData(AnFpValue: TFpValue; AnResData: TLzDbgWatchDataIntf): Boolean;
|
function SetToResData(AnFpValue: TFpValue; AnResData: TLzDbgWatchDataIntf): Boolean;
|
||||||
|
|
||||||
@ -206,6 +207,14 @@ begin
|
|||||||
AddTypeNameToResData(AnFpValue, AnResData);
|
AddTypeNameToResData(AnFpValue, AnResData);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TFpWatchResultConvertor.BoolToResData(AnFpValue: TFpValue;
|
||||||
|
AnResData: TLzDbgWatchDataIntf): Boolean;
|
||||||
|
begin
|
||||||
|
Result := True;
|
||||||
|
AnResData.CreateBoolValue(AnFpValue.AsCardinal, SizeToFullBytes(AnFpValue.DataSize));
|
||||||
|
AddTypeNameToResData(AnFpValue, AnResData);
|
||||||
|
end;
|
||||||
|
|
||||||
function TFpWatchResultConvertor.EnumToResData(AnFpValue: TFpValue;
|
function TFpWatchResultConvertor.EnumToResData(AnFpValue: TFpValue;
|
||||||
AnResData: TLzDbgWatchDataIntf): Boolean;
|
AnResData: TLzDbgWatchDataIntf): Boolean;
|
||||||
var
|
var
|
||||||
@ -307,7 +316,7 @@ begin
|
|||||||
skProcedureRef: ;
|
skProcedureRef: ;
|
||||||
skFunctionRef: ;
|
skFunctionRef: ;
|
||||||
skSimple: ;
|
skSimple: ;
|
||||||
skBoolean: ;
|
skBoolean: Result := BoolToResData(AnFpValue, AnResData);
|
||||||
skCurrency: ;
|
skCurrency: ;
|
||||||
skVariant: ;
|
skVariant: ;
|
||||||
skEnum,
|
skEnum,
|
||||||
|
@ -122,6 +122,7 @@ type
|
|||||||
procedure CreateNumValue(ANumValue: QWord; ASigned: Boolean; AByteSize: Integer = 0);
|
procedure CreateNumValue(ANumValue: QWord; ASigned: Boolean; AByteSize: Integer = 0);
|
||||||
procedure CreatePointerValue(AnAddrValue: TDbgPtr);
|
procedure CreatePointerValue(AnAddrValue: TDbgPtr);
|
||||||
procedure CreateFloatValue(AFloatValue: Extended; APrecission: TLzDbgFloatPrecission);
|
procedure CreateFloatValue(AFloatValue: Extended; APrecission: TLzDbgFloatPrecission);
|
||||||
|
procedure CreateBoolValue(AnOrdBoolValue: QWord; AByteSize: Integer = 0);
|
||||||
procedure CreateEnumValue(ANumValue: QWord; AName: String; AByteSize: Integer = 0; AnIsEnumIdent: Boolean = False);
|
procedure CreateEnumValue(ANumValue: QWord; AName: String; AByteSize: Integer = 0; AnIsEnumIdent: Boolean = False);
|
||||||
procedure CreateSetValue(const ANames: TStringDynArray); //; const AOrdValues: array of Integer);
|
procedure CreateSetValue(const ANames: TStringDynArray); //; const AOrdValues: array of Integer);
|
||||||
|
|
||||||
|
@ -663,6 +663,7 @@ type
|
|||||||
procedure CreateNumValue(ANumValue: QWord; ASigned: Boolean; AByteSize: Integer = 0);
|
procedure CreateNumValue(ANumValue: QWord; ASigned: Boolean; AByteSize: Integer = 0);
|
||||||
procedure CreatePointerValue(AnAddrValue: TDbgPtr);
|
procedure CreatePointerValue(AnAddrValue: TDbgPtr);
|
||||||
procedure CreateFloatValue(AFloatValue: Extended; APrecission: TLzDbgFloatPrecission);
|
procedure CreateFloatValue(AFloatValue: Extended; APrecission: TLzDbgFloatPrecission);
|
||||||
|
procedure CreateBoolValue(AnOrdBoolValue: QWord; AByteSize: Integer = 0);
|
||||||
procedure CreateEnumValue(ANumValue: QWord; AName: String; AByteSize: Integer = 0; AnIsEnumIdent: Boolean = False);
|
procedure CreateEnumValue(ANumValue: QWord; AName: String; AByteSize: Integer = 0; AnIsEnumIdent: Boolean = False);
|
||||||
procedure CreateSetValue(const ANames: TStringDynArray);
|
procedure CreateSetValue(const ANames: TStringDynArray);
|
||||||
|
|
||||||
@ -3232,6 +3233,14 @@ begin
|
|||||||
AfterDataCreated;
|
AfterDataCreated;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCurrentResData.CreateBoolValue(AnOrdBoolValue: QWord;
|
||||||
|
AByteSize: Integer);
|
||||||
|
begin
|
||||||
|
assert(FNewResultData=nil, 'TCurrentResData.CreateBoolValue: FNewResultData=nil');
|
||||||
|
FNewResultData := TWatchResultDataBoolean.Create(AnOrdBoolValue, AByteSize);
|
||||||
|
AfterDataCreated;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCurrentResData.CreateEnumValue(ANumValue: QWord; AName: String;
|
procedure TCurrentResData.CreateEnumValue(ANumValue: QWord; AName: String;
|
||||||
AByteSize: Integer; AnIsEnumIdent: Boolean);
|
AByteSize: Integer; AnIsEnumIdent: Boolean);
|
||||||
begin
|
begin
|
||||||
|
@ -16,7 +16,7 @@ type
|
|||||||
rdkError, rdkPrePrinted,
|
rdkError, rdkPrePrinted,
|
||||||
rdkString, rdkWideString, rdkChar,
|
rdkString, rdkWideString, rdkChar,
|
||||||
rdkSignedNumVal, rdkUnsignedNumVal, rdkPointerVal, rdkFloatVal,
|
rdkSignedNumVal, rdkUnsignedNumVal, rdkPointerVal, rdkFloatVal,
|
||||||
rdkEnum, rdkEnumVal, rdkSet
|
rdkBool, rdkEnum, rdkEnumVal, rdkSet
|
||||||
);
|
);
|
||||||
|
|
||||||
TWatchResultData = class;
|
TWatchResultData = class;
|
||||||
@ -173,6 +173,15 @@ type
|
|||||||
procedure SaveDataToXMLConfig(const AConfig: TXMLConfig; const APath: string);
|
procedure SaveDataToXMLConfig(const AConfig: TXMLConfig; const APath: string);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TWatchResultValueBoolean }
|
||||||
|
|
||||||
|
TWatchResultValueBoolean = object(TWatchResultValueOrdNumBase)
|
||||||
|
protected const
|
||||||
|
VKind = rdkBool;
|
||||||
|
protected
|
||||||
|
function GetAsString: String; inline;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TWatchResultValueEnumBase }
|
{ TWatchResultValueEnumBase }
|
||||||
|
|
||||||
TWatchResultValueEnumBase = object(TWatchResultValueOrdNumBase)
|
TWatchResultValueEnumBase = object(TWatchResultValueOrdNumBase)
|
||||||
@ -228,6 +237,7 @@ type
|
|||||||
wdUNum, // TWatchResultDataUnSignedNum
|
wdUNum, // TWatchResultDataUnSignedNum
|
||||||
wdPtr, // TWatchResultDataPointer
|
wdPtr, // TWatchResultDataPointer
|
||||||
wdFloat, // TWatchResultDataFloat
|
wdFloat, // TWatchResultDataFloat
|
||||||
|
wdBool, // TWatchResultDataBoolean
|
||||||
wdEnum, // TWatchResultDataEnum
|
wdEnum, // TWatchResultDataEnum
|
||||||
wdEnumVal, // TWatchResultDataEnumVal
|
wdEnumVal, // TWatchResultDataEnumVal
|
||||||
wdSet, // TWatchResultDataSet
|
wdSet, // TWatchResultDataSet
|
||||||
@ -402,6 +412,16 @@ type
|
|||||||
constructor Create(AFloatValue: Extended; APrecission: TLzDbgFloatPrecission);
|
constructor Create(AFloatValue: Extended; APrecission: TLzDbgFloatPrecission);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TWatchResultDataBoolean }
|
||||||
|
|
||||||
|
TWatchResultDataBoolean = class(specialize TGenericWatchResultDataSizedNum<TWatchResultValueBoolean>)
|
||||||
|
private
|
||||||
|
function GetClassID: TWatchResultDataClassID; override;
|
||||||
|
public
|
||||||
|
constructor Create(AnOrdBoolValue: QWord; AByteSize: Integer = 0);
|
||||||
|
constructor Create(ABoolValue: Boolean);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TWatchResultDataEnum }
|
{ TWatchResultDataEnum }
|
||||||
|
|
||||||
TWatchResultDataEnum = class(specialize TGenericWatchResultDataSizedNum<TWatchResultValueEnum>)
|
TWatchResultDataEnum = class(specialize TGenericWatchResultDataSizedNum<TWatchResultValueEnum>)
|
||||||
@ -510,6 +530,23 @@ function PrintWatchValueEx(AResValue: TWatchResultData; ADispFormat: TWatchDispl
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function PrintBool: String;
|
||||||
|
var
|
||||||
|
c: QWord;
|
||||||
|
begin
|
||||||
|
c := AResValue.GetAsQWord;
|
||||||
|
if c = 0 then
|
||||||
|
Result := 'False'
|
||||||
|
else
|
||||||
|
Result := 'True';
|
||||||
|
|
||||||
|
if (ADispFormat in [wdfDecimal, wdfUnsigned, wdfHex, wdfBinary]) then
|
||||||
|
Result := Result + '(' + PrintNumber(AResValue, False, ADispFormat) + ')'
|
||||||
|
else
|
||||||
|
if (c > 1) then
|
||||||
|
Result := Result + '(' + PrintNumber(AResValue, False, wdfDecimal) + ')';
|
||||||
|
end;
|
||||||
|
|
||||||
function PrintEnum: String;
|
function PrintEnum: String;
|
||||||
begin
|
begin
|
||||||
if (ADispFormat = wdfDefault) and (AResValue.ValueKind = rdkEnumVal) then
|
if (ADispFormat = wdfDefault) and (AResValue.ValueKind = rdkEnumVal) then
|
||||||
@ -618,6 +655,7 @@ begin
|
|||||||
rdkChar: Result := PrintChar;
|
rdkChar: Result := PrintChar;
|
||||||
rdkString: Result := QuoteText(AResValue.AsString);
|
rdkString: Result := QuoteText(AResValue.AsString);
|
||||||
rdkWideString: Result := QuoteWideText(AResValue.AsWideString);
|
rdkWideString: Result := QuoteWideText(AResValue.AsWideString);
|
||||||
|
rdkBool: Result := PrintBool;
|
||||||
rdkEnum, rdkEnumVal:
|
rdkEnum, rdkEnumVal:
|
||||||
Result := PrintEnum;
|
Result := PrintEnum;
|
||||||
rdkSet: Result := PrintSet;
|
rdkSet: Result := PrintSet;
|
||||||
@ -639,6 +677,7 @@ const
|
|||||||
TWatchResultDataUnSignedNum, // wdUNum
|
TWatchResultDataUnSignedNum, // wdUNum
|
||||||
TWatchResultDataPointer, // wdPtr
|
TWatchResultDataPointer, // wdPtr
|
||||||
TWatchResultDataFloat, // wdFloat
|
TWatchResultDataFloat, // wdFloat
|
||||||
|
TWatchResultDataBoolean, // wdBool
|
||||||
TWatchResultDataEnum, // wdEnum
|
TWatchResultDataEnum, // wdEnum
|
||||||
TWatchResultDataEnumVal, // wdEnumVal
|
TWatchResultDataEnumVal, // wdEnumVal
|
||||||
TWatchResultDataSet, // wdSet
|
TWatchResultDataSet, // wdSet
|
||||||
@ -892,6 +931,16 @@ begin
|
|||||||
AConfig.SetDeleteValue(APath + 'Prec', FFloatPrecission, ord(dfpSingle), TypeInfo(TLzDbgFloatPrecission));
|
AConfig.SetDeleteValue(APath + 'Prec', FFloatPrecission, ord(dfpSingle), TypeInfo(TLzDbgFloatPrecission));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TWatchResultValueBoolean }
|
||||||
|
|
||||||
|
function TWatchResultValueBoolean.GetAsString: String;
|
||||||
|
begin
|
||||||
|
if FNumValue <> 0 then
|
||||||
|
Result := 'True'
|
||||||
|
else
|
||||||
|
Result := 'False';
|
||||||
|
end;
|
||||||
|
|
||||||
{ TWatchResultValueEnumBase }
|
{ TWatchResultValueEnumBase }
|
||||||
|
|
||||||
procedure TWatchResultValueEnumBase.LoadDataFromXMLConfig(
|
procedure TWatchResultValueEnumBase.LoadDataFromXMLConfig(
|
||||||
@ -1260,6 +1309,31 @@ begin
|
|||||||
FType.FFloatPrecission := APrecission;
|
FType.FFloatPrecission := APrecission;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TWatchResultDataBoolean }
|
||||||
|
|
||||||
|
function TWatchResultDataBoolean.GetClassID: TWatchResultDataClassID;
|
||||||
|
begin
|
||||||
|
Result := wdBool;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TWatchResultDataBoolean.Create(AnOrdBoolValue: QWord;
|
||||||
|
AByteSize: Integer);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
FData.FNumValue := AnOrdBoolValue;
|
||||||
|
FType.FNumByteSize := AByteSize;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TWatchResultDataBoolean.Create(ABoolValue: Boolean);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
if ABoolValue then
|
||||||
|
FData.FNumValue := 1
|
||||||
|
else
|
||||||
|
FData.FNumValue := 0;
|
||||||
|
FType.FNumByteSize := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TWatchResultDataEnum }
|
{ TWatchResultDataEnum }
|
||||||
|
|
||||||
function TWatchResultDataEnum.GetClassID: TWatchResultDataClassID;
|
function TWatchResultDataEnum.GetClassID: TWatchResultDataClassID;
|
||||||
|
Loading…
Reference in New Issue
Block a user