mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 12:20:38 +02:00
IdeDebugger: Fix Display-Format related conversion of numeric watches.
This commit is contained in:
parent
0426064e8f
commit
28ac5176a9
@ -337,9 +337,17 @@ type
|
|||||||
constructor Create(AStringVal: WideString);
|
constructor Create(AStringVal: WideString);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TGenericWatchResultDataSizedNum }
|
||||||
|
|
||||||
|
generic TGenericWatchResultDataSizedNum<_DATA> = class(specialize TGenericWatchResultDataWithType<_DATA, TWatchResultTypeOrdNum>)
|
||||||
|
protected
|
||||||
|
function GetAsQWord: QWord; override;
|
||||||
|
function GetAsInt64: Int64; override;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TWatchResultDataSignedNum }
|
{ TWatchResultDataSignedNum }
|
||||||
|
|
||||||
TWatchResultDataSignedNum = class(specialize TGenericWatchResultDataWithType<TWatchResultValueSignedNum, TWatchResultTypeOrdNum>)
|
TWatchResultDataSignedNum = class(specialize TGenericWatchResultDataSizedNum<TWatchResultValueSignedNum>)
|
||||||
private
|
private
|
||||||
function GetClassID: TWatchResultDataClassID; override;
|
function GetClassID: TWatchResultDataClassID; override;
|
||||||
public
|
public
|
||||||
@ -348,7 +356,7 @@ type
|
|||||||
|
|
||||||
{ TWatchResultDataUnSignedNum }
|
{ TWatchResultDataUnSignedNum }
|
||||||
|
|
||||||
TWatchResultDataUnSignedNum = class(specialize TGenericWatchResultDataWithType<TWatchResultValueUnsignedNum, TWatchResultTypeOrdNum>)
|
TWatchResultDataUnSignedNum = class(specialize TGenericWatchResultDataSizedNum<TWatchResultValueUnsignedNum>)
|
||||||
private
|
private
|
||||||
function GetClassID: TWatchResultDataClassID; override;
|
function GetClassID: TWatchResultDataClassID; override;
|
||||||
public
|
public
|
||||||
@ -377,7 +385,7 @@ type
|
|||||||
|
|
||||||
{ TWatchResultDataEnum }
|
{ TWatchResultDataEnum }
|
||||||
|
|
||||||
TWatchResultDataEnum = class(specialize TGenericWatchResultDataWithType<TWatchResultValueEnum, TWatchResultTypeOrdNum>)
|
TWatchResultDataEnum = class(specialize TGenericWatchResultDataSizedNum<TWatchResultValueEnum>)
|
||||||
private
|
private
|
||||||
function GetClassID: TWatchResultDataClassID; override;
|
function GetClassID: TWatchResultDataClassID; override;
|
||||||
public
|
public
|
||||||
@ -386,7 +394,7 @@ type
|
|||||||
|
|
||||||
{ TWatchResultDataEnumVal }
|
{ TWatchResultDataEnumVal }
|
||||||
|
|
||||||
TWatchResultDataEnumVal = class(specialize TGenericWatchResultDataWithType<TWatchResultValueEnumVal, TWatchResultTypeOrdNum>)
|
TWatchResultDataEnumVal = class(specialize TGenericWatchResultDataSizedNum<TWatchResultValueEnumVal>)
|
||||||
private
|
private
|
||||||
function GetClassID: TWatchResultDataClassID; override;
|
function GetClassID: TWatchResultDataClassID; override;
|
||||||
public
|
public
|
||||||
@ -457,7 +465,7 @@ function PrintWatchValueEx(AResValue: TWatchResultData; ADispFormat: TWatchDispl
|
|||||||
end;
|
end;
|
||||||
wdfBinary: begin
|
wdfBinary: begin
|
||||||
n := HexDigicCount(ANumValue.AsQWord, ANumValue.ByteSize, AnIsPointer);
|
n := HexDigicCount(ANumValue.AsQWord, ANumValue.ByteSize, AnIsPointer);
|
||||||
Result := '%'+IntToBin(ANumValue.AsInt64, n*4);
|
Result := '%'+IntToBin(Int64(ANumValue.AsQWord), n*4); // Don't get any extra leading 1
|
||||||
end;
|
end;
|
||||||
wdfPointer: begin
|
wdfPointer: begin
|
||||||
n := HexDigicCount(ANumValue.AsQWord, ANumValue.ByteSize, True);
|
n := HexDigicCount(ANumValue.AsQWord, ANumValue.ByteSize, True);
|
||||||
@ -1112,6 +1120,26 @@ begin
|
|||||||
FData.FWideText := AStringVal;
|
FData.FWideText := AStringVal;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TGenericWatchResultDataSizedNum }
|
||||||
|
|
||||||
|
function TGenericWatchResultDataSizedNum.GetAsQWord: QWord;
|
||||||
|
begin
|
||||||
|
Result := FData.GetAsQWord;
|
||||||
|
if (FType.GetByteSize > 0) and (FType.GetByteSize < 8) then
|
||||||
|
Result := Result and not(QWord(-1) << (FType.GetByteSize<<3));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TGenericWatchResultDataSizedNum.GetAsInt64: Int64;
|
||||||
|
begin
|
||||||
|
Result := FData.GetAsInt64;
|
||||||
|
if (FType.GetByteSize > 0) and (FType.GetByteSize < 8) then begin
|
||||||
|
if Result and (1 << ((FType.GetByteSize<<3) - 1)) <> 0 then
|
||||||
|
Result := Result or (Int64(-1) << (FType.GetByteSize<<3))
|
||||||
|
else
|
||||||
|
Result := Result and not(Int64(-1) << (FType.GetByteSize<<3));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TWatchResultDataSignedNum }
|
{ TWatchResultDataSignedNum }
|
||||||
|
|
||||||
function TWatchResultDataSignedNum.GetClassID: TWatchResultDataClassID;
|
function TWatchResultDataSignedNum.GetClassID: TWatchResultDataClassID;
|
||||||
|
Loading…
Reference in New Issue
Block a user