mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 03:20:38 +02:00
FpDebug: Improve char/widechar from expression/const - implement size and ord-value
This commit is contained in:
parent
2991d62a16
commit
3ea0e03d3b
@ -246,22 +246,29 @@ type
|
|||||||
function GetKind: TDbgSymbolKind; override;
|
function GetKind: TDbgSymbolKind; override;
|
||||||
function GetFieldFlags: TFpValueFieldFlags; override;
|
function GetFieldFlags: TFpValueFieldFlags; override;
|
||||||
function GetAsString: AnsiString; override;
|
function GetAsString: AnsiString; override;
|
||||||
|
function GetAsCardinal: QWord; override;
|
||||||
|
function DoGetSize(out ASize: TFpDbgValueSize): Boolean; override;
|
||||||
public
|
public
|
||||||
constructor Create(const AValue: AnsiString);
|
constructor Create(const AValue: Char);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFpValueConstWideChar }
|
{ TFpValueConstWideChar }
|
||||||
|
|
||||||
TFpValueConstWideChar = class(TFpValue) // skChar / Not for strings
|
TFpValueConstWideChar = class(TFpValue) // skChar / Not for strings
|
||||||
private
|
private
|
||||||
FValue: String;
|
FValue: WideChar;
|
||||||
|
function GetValue: String;
|
||||||
|
procedure SetValue(AValue: String);
|
||||||
protected
|
protected
|
||||||
property Value: String read FValue write FValue;
|
property Value: String read GetValue write SetValue;
|
||||||
function GetKind: TDbgSymbolKind; override;
|
function GetKind: TDbgSymbolKind; override;
|
||||||
function GetFieldFlags: TFpValueFieldFlags; override;
|
function GetFieldFlags: TFpValueFieldFlags; override;
|
||||||
function GetAsString: AnsiString; override;
|
function GetAsString: AnsiString; override;
|
||||||
|
function GetAsWideString: WideString; override;
|
||||||
|
function GetAsCardinal: QWord; override;
|
||||||
|
function DoGetSize(out ASize: TFpDbgValueSize): Boolean; override;
|
||||||
public
|
public
|
||||||
constructor Create(const AValue: AnsiString);
|
constructor Create(const AValue: WideChar);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFpValueConstString }
|
{ TFpValueConstString }
|
||||||
@ -776,7 +783,9 @@ end;
|
|||||||
|
|
||||||
function TFpValueConstChar.GetFieldFlags: TFpValueFieldFlags;
|
function TFpValueConstChar.GetFieldFlags: TFpValueFieldFlags;
|
||||||
begin
|
begin
|
||||||
Result := [svfString]
|
Result := [svfString, svfSize];
|
||||||
|
if Length(FValue) = 1 then
|
||||||
|
Result := Result + [svfOrdinal];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFpValueConstChar.GetAsString: AnsiString;
|
function TFpValueConstChar.GetAsString: AnsiString;
|
||||||
@ -784,7 +793,21 @@ begin
|
|||||||
Result := Value;
|
Result := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TFpValueConstChar.Create(const AValue: AnsiString);
|
function TFpValueConstChar.GetAsCardinal: QWord;
|
||||||
|
begin
|
||||||
|
if Length(FValue) = 1 then
|
||||||
|
Result := ord(FValue[1])
|
||||||
|
else
|
||||||
|
Result := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TFpValueConstChar.DoGetSize(out ASize: TFpDbgValueSize): Boolean;
|
||||||
|
begin
|
||||||
|
ASize := SizeVal(1);
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TFpValueConstChar.Create(const AValue: Char);
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
FValue := AValue;
|
FValue := AValue;
|
||||||
@ -792,6 +815,22 @@ end;
|
|||||||
|
|
||||||
{ TFpValueConstWideChar }
|
{ TFpValueConstWideChar }
|
||||||
|
|
||||||
|
function TFpValueConstWideChar.GetValue: String;
|
||||||
|
begin
|
||||||
|
Result := FValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TFpValueConstWideChar.SetValue(AValue: String);
|
||||||
|
var
|
||||||
|
w: WideString;
|
||||||
|
begin
|
||||||
|
w := AValue;
|
||||||
|
if w <> '' then
|
||||||
|
FValue := w[1]
|
||||||
|
else
|
||||||
|
FValue := #0;
|
||||||
|
end;
|
||||||
|
|
||||||
function TFpValueConstWideChar.GetKind: TDbgSymbolKind;
|
function TFpValueConstWideChar.GetKind: TDbgSymbolKind;
|
||||||
begin
|
begin
|
||||||
Result := skChar;
|
Result := skChar;
|
||||||
@ -799,7 +838,7 @@ end;
|
|||||||
|
|
||||||
function TFpValueConstWideChar.GetFieldFlags: TFpValueFieldFlags;
|
function TFpValueConstWideChar.GetFieldFlags: TFpValueFieldFlags;
|
||||||
begin
|
begin
|
||||||
Result := [svfWideString]
|
Result := [svfWideString, svfSize, svfOrdinal];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFpValueConstWideChar.GetAsString: AnsiString;
|
function TFpValueConstWideChar.GetAsString: AnsiString;
|
||||||
@ -807,7 +846,23 @@ begin
|
|||||||
Result := Value;
|
Result := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TFpValueConstWideChar.Create(const AValue: AnsiString);
|
function TFpValueConstWideChar.GetAsWideString: WideString;
|
||||||
|
begin
|
||||||
|
Result := FValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TFpValueConstWideChar.GetAsCardinal: QWord;
|
||||||
|
begin
|
||||||
|
Result := ord(FValue);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TFpValueConstWideChar.DoGetSize(out ASize: TFpDbgValueSize): Boolean;
|
||||||
|
begin
|
||||||
|
ASize := SizeVal(2);
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TFpValueConstWideChar.Create(const AValue: WideChar);
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
FValue := AValue;
|
FValue := AValue;
|
||||||
@ -872,7 +927,7 @@ end;
|
|||||||
|
|
||||||
function TFpValue.GetIndexType(AIndex: Integer): TFpSymbol;
|
function TFpValue.GetIndexType(AIndex: Integer): TFpSymbol;
|
||||||
begin
|
begin
|
||||||
Result := nil;;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFpValue.GetIndexTypeCount: Integer;
|
function TFpValue.GetIndexTypeCount: Integer;
|
||||||
|
@ -1295,7 +1295,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TmpVal2 := TFpValueConstChar.Create(w[Offs]);
|
TmpVal2 := TFpValueConstWideChar.Create(w[Offs]);
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user