mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-24 07:31:09 +02:00
FpDebug: Fixed Array of String for dwarf-3
git-svn-id: trunk@59872 -
This commit is contained in:
parent
4d4aa06706
commit
78ffec8934
@ -592,6 +592,19 @@ DECL = DW_AT_decl_column, DW_AT_decl_file, DW_AT_decl_line
|
|||||||
function TypeCastValue(AValue: TFpDbgValue): TFpDbgValue; override;
|
function TypeCastValue(AValue: TFpDbgValue): TFpDbgValue; override;
|
||||||
// TODO: flag bounds as cardinal if needed
|
// TODO: flag bounds as cardinal if needed
|
||||||
function GetValueBounds({%H-}AValueObj: TFpDwarfValue; out ALowBound, AHighBound: Int64): Boolean; virtual;
|
function GetValueBounds({%H-}AValueObj: TFpDwarfValue; out ALowBound, AHighBound: Int64): Boolean; virtual;
|
||||||
|
|
||||||
|
(*TODO: workaround / quickfix // only partly implemented
|
||||||
|
When reading several elements of an array (dyn or stat), the typeinfo is always the same instance (type of array entry)
|
||||||
|
But once that instance has read data (like bounds / dwarf3 bounds are read from app mem), this is cached.
|
||||||
|
So all consecutive entries get the same info...
|
||||||
|
array of string
|
||||||
|
array of shortstring
|
||||||
|
array of {dyn} array
|
||||||
|
This works similar to "Init", but should only clear data that is not static / depends on memory reads
|
||||||
|
|
||||||
|
Bounds (and maybe all such data) should be stored on the value object)
|
||||||
|
*)
|
||||||
|
procedure ResetValueBounds; virtual;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFpDwarfSymbolTypeBasic }
|
{ TFpDwarfSymbolTypeBasic }
|
||||||
@ -670,6 +683,7 @@ DECL = DW_AT_decl_column, DW_AT_decl_file, DW_AT_decl_line
|
|||||||
public
|
public
|
||||||
function GetValueBounds(AValueObj: TFpDwarfValue; out ALowBound,
|
function GetValueBounds(AValueObj: TFpDwarfValue; out ALowBound,
|
||||||
AHighBound: Int64): Boolean; override;
|
AHighBound: Int64): Boolean; override;
|
||||||
|
procedure ResetValueBounds; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFpDwarfSymbolTypePointer }
|
{ TFpDwarfSymbolTypePointer }
|
||||||
@ -3307,6 +3321,11 @@ begin
|
|||||||
AHighBound := OrdHighBound;
|
AHighBound := OrdHighBound;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TFpDwarfSymbolType.ResetValueBounds;
|
||||||
|
begin
|
||||||
|
//
|
||||||
|
end;
|
||||||
|
|
||||||
class function TFpDwarfSymbolType.CreateTypeSubClass(AName: String;
|
class function TFpDwarfSymbolType.CreateTypeSubClass(AName: String;
|
||||||
AnInformationEntry: TDwarfInformationEntry): TFpDwarfSymbolType;
|
AnInformationEntry: TDwarfInformationEntry): TFpDwarfSymbolType;
|
||||||
var
|
var
|
||||||
@ -3741,6 +3760,14 @@ begin
|
|||||||
Result := inherited GetValueBounds(AValueObj, ALowBound, AHighBound);
|
Result := inherited GetValueBounds(AValueObj, ALowBound, AHighBound);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TFpDwarfSymbolTypeSubRange.ResetValueBounds;
|
||||||
|
begin
|
||||||
|
inherited ResetValueBounds;
|
||||||
|
FLowBoundState := rfNotRead;
|
||||||
|
FHighBoundState := rfNotRead;
|
||||||
|
FCountState := rfNotRead;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TFpDwarfSymbolTypeSubRange.Init;
|
procedure TFpDwarfSymbolTypeSubRange.Init;
|
||||||
begin
|
begin
|
||||||
FLowBoundState := rfNotRead;
|
FLowBoundState := rfNotRead;
|
||||||
|
@ -138,6 +138,8 @@ type
|
|||||||
FValue: String;
|
FValue: String;
|
||||||
FValueDone: Boolean;
|
FValueDone: Boolean;
|
||||||
protected
|
protected
|
||||||
|
function IsValidTypeCast: Boolean; override;
|
||||||
|
procedure Reset; override;
|
||||||
function GetFieldFlags: TFpDbgValueFieldFlags; override;
|
function GetFieldFlags: TFpDbgValueFieldFlags; override;
|
||||||
function GetAsString: AnsiString; override;
|
function GetAsString: AnsiString; override;
|
||||||
function GetAsWideString: WideString; override;
|
function GetAsWideString: WideString; override;
|
||||||
@ -629,6 +631,47 @@ end;
|
|||||||
|
|
||||||
{ TFpDwarfV3ValueFreePascalString }
|
{ TFpDwarfV3ValueFreePascalString }
|
||||||
|
|
||||||
|
function TFpDwarfV3ValueFreePascalString.IsValidTypeCast: Boolean;
|
||||||
|
var
|
||||||
|
f: TFpDbgValueFieldFlags;
|
||||||
|
begin
|
||||||
|
Result := HasTypeCastInfo;
|
||||||
|
If not Result then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
assert(TypeCastTargetType.Kind = skString, 'TFpDwarfValueArray.IsValidTypeCast: TypeCastTargetType.Kind = skArray');
|
||||||
|
|
||||||
|
f := TypeCastSourceValue.FieldFlags;
|
||||||
|
if (f * [svfAddress, svfSize, svfSizeOfPointer] = [svfAddress]) then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
//if sfDynArray in TypeCastTargetType.Flags then begin
|
||||||
|
// // dyn array
|
||||||
|
// if (svfOrdinal in f)then
|
||||||
|
// exit;
|
||||||
|
// if (f * [svfAddress, svfSize] = [svfAddress, svfSize]) and
|
||||||
|
// (TypeCastSourceValue.Size = FOwner.CompilationUnit.AddressSize)
|
||||||
|
// then
|
||||||
|
// exit;
|
||||||
|
// if (f * [svfAddress, svfSizeOfPointer] = [svfAddress, svfSizeOfPointer]) then
|
||||||
|
// exit;
|
||||||
|
//end
|
||||||
|
//else begin
|
||||||
|
// // stat array
|
||||||
|
// if (f * [svfAddress, svfSize] = [svfAddress, svfSize]) and
|
||||||
|
// (TypeCastSourceValue.Size = TypeCastTargetType.Size)
|
||||||
|
// then
|
||||||
|
// exit;
|
||||||
|
//end;
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TFpDwarfV3ValueFreePascalString.Reset;
|
||||||
|
begin
|
||||||
|
inherited Reset;
|
||||||
|
FValueDone := False;
|
||||||
|
end;
|
||||||
|
|
||||||
function TFpDwarfV3ValueFreePascalString.GetFieldFlags: TFpDbgValueFieldFlags;
|
function TFpDwarfV3ValueFreePascalString.GetFieldFlags: TFpDbgValueFieldFlags;
|
||||||
begin
|
begin
|
||||||
Result := inherited GetFieldFlags;
|
Result := inherited GetFieldFlags;
|
||||||
@ -644,11 +687,6 @@ begin
|
|||||||
if FValueDone then
|
if FValueDone then
|
||||||
exit(FValue);
|
exit(FValue);
|
||||||
|
|
||||||
if HasTypeCastInfo then begin
|
|
||||||
FLastError := CreateError(fpErrAnyError);
|
|
||||||
exit('');
|
|
||||||
end;
|
|
||||||
|
|
||||||
// TODO: error handling
|
// TODO: error handling
|
||||||
FValue := '';
|
FValue := '';
|
||||||
Result := '';
|
Result := '';
|
||||||
@ -658,7 +696,10 @@ begin
|
|||||||
t := TypeInfo;
|
t := TypeInfo;
|
||||||
if t.MemberCount < 1 then // subrange type
|
if t.MemberCount < 1 then // subrange type
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
t2 := t.Member[0]; // subrange type
|
t2 := t.Member[0]; // subrange type
|
||||||
|
if HasTypeCastInfo then
|
||||||
|
TFpDwarfSymbolType(t2).ResetValueBounds;
|
||||||
if not( (t2 is TFpDwarfSymbolType) and TFpDwarfSymbolType(t2).GetValueBounds(self, LowBound, HighBound) )
|
if not( (t2 is TFpDwarfSymbolType) and TFpDwarfSymbolType(t2).GetValueBounds(self, LowBound, HighBound) )
|
||||||
then
|
then
|
||||||
exit;
|
exit;
|
||||||
|
Loading…
Reference in New Issue
Block a user