mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 01:55:54 +02:00
FpDebug: Implemented watch for "SomeString[index]"
git-svn-id: trunk@59861 -
This commit is contained in:
parent
c3e01c7dc4
commit
53ff21a2b4
@ -241,6 +241,21 @@ type
|
||||
constructor Create(AValue: QWord; ASigned: Boolean = True);
|
||||
end;
|
||||
|
||||
{ TFpDbgValueConstChar }
|
||||
|
||||
TFpDbgValueConstChar = class(TFpDbgValue) // skChar / Not for strings
|
||||
private
|
||||
FValue: String;
|
||||
FSigned: Boolean;
|
||||
protected
|
||||
property Value: String read FValue write FValue;
|
||||
function GetKind: TDbgSymbolKind; override;
|
||||
function GetFieldFlags: TFpDbgValueFieldFlags; override;
|
||||
function GetAsString: AnsiString; override;
|
||||
public
|
||||
constructor Create(AValue: AnsiString);
|
||||
end;
|
||||
|
||||
{ TFpDbgValueConstFloat }
|
||||
|
||||
TFpDbgValueConstFloat = class(TFpDbgValue)
|
||||
@ -500,6 +515,29 @@ begin
|
||||
WriteStr(Result, ADbgSymbolKind);
|
||||
end;
|
||||
|
||||
{ TFpDbgValueConstChar }
|
||||
|
||||
function TFpDbgValueConstChar.GetKind: TDbgSymbolKind;
|
||||
begin
|
||||
Result := skChar;
|
||||
end;
|
||||
|
||||
function TFpDbgValueConstChar.GetFieldFlags: TFpDbgValueFieldFlags;
|
||||
begin
|
||||
Result := [svfString]
|
||||
end;
|
||||
|
||||
function TFpDbgValueConstChar.GetAsString: AnsiString;
|
||||
begin
|
||||
Result := Value;
|
||||
end;
|
||||
|
||||
constructor TFpDbgValueConstChar.Create(AValue: AnsiString);
|
||||
begin
|
||||
inherited Create;
|
||||
FValue := AValue;
|
||||
end;
|
||||
|
||||
{ TFpDbgCircularRefCountedObject }
|
||||
|
||||
procedure TFpDbgCircularRefCountedObject.DoPlainReferenceAdded;
|
||||
|
@ -71,6 +71,7 @@ type
|
||||
destructor Destroy; override;
|
||||
function DebugDump(AWithResults: Boolean = False): String;
|
||||
procedure ResetEvaluation;
|
||||
property TextExpression: String read FTextExpression;
|
||||
property Error: TFpError read FError;
|
||||
property Valid: Boolean read GetValid;
|
||||
// Set by GetResultValue
|
||||
@ -1024,6 +1025,7 @@ var
|
||||
Offs: Int64;
|
||||
ti: TFpDbgSymbol;
|
||||
IsPChar: Boolean;
|
||||
v: String;
|
||||
begin
|
||||
Result := nil;
|
||||
assert(Count >= 2, 'TFpPascalExpressionPartBracketIndex.DoGetResultValue: Count >= 2');
|
||||
@ -1087,11 +1089,29 @@ begin
|
||||
SetError('Error dereferencing'); // TODO: set correct error
|
||||
if TmpVal2 <> nil then TmpVal2.AddReference;
|
||||
end;
|
||||
skString: begin
|
||||
//TODO
|
||||
SetError('Not implemented');
|
||||
TmpVal.ReleaseReference;
|
||||
exit;
|
||||
skString, skAnsiString: begin
|
||||
//TODO: move to FpDwarfValue.member ??
|
||||
if (svfInteger in TmpIndex.FieldFlags) then
|
||||
Offs := TmpIndex.AsInteger
|
||||
else
|
||||
if (svfOrdinal in TmpIndex.FieldFlags) and (TmpIndex.AsCardinal <= high(Int64))
|
||||
then
|
||||
Offs := Int64(TmpIndex.AsCardinal)
|
||||
else
|
||||
begin
|
||||
SetError('Can not calculate Index');
|
||||
TmpVal.ReleaseReference;
|
||||
exit;
|
||||
end;
|
||||
|
||||
v := TmpVal.AsString;
|
||||
if (Offs < 1) or (Offs > Length(v)) then begin
|
||||
SetError('Index out of range');
|
||||
TmpVal.ReleaseReference;
|
||||
exit;
|
||||
end;
|
||||
|
||||
TmpVal2 := TFpDbgValueConstChar.Create(v[Offs]);
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user