From f37ef1133015f09041b08e08a8fdd7ac224bb300 Mon Sep 17 00:00:00 2001 From: martin Date: Tue, 24 Sep 2019 23:36:32 +0000 Subject: [PATCH] FpDebug: Remove HasBounds (which did not have a ValueObject). Make SubRanges check for their own size too. git-svn-id: trunk@61915 - --- components/fpdebug/fpdbgdwarf.pas | 56 +++++++------------------------ components/fpdebug/fpdbginfo.pas | 20 ----------- 2 files changed, 12 insertions(+), 64 deletions(-) diff --git a/components/fpdebug/fpdbgdwarf.pas b/components/fpdebug/fpdbgdwarf.pas index 0b2b28f029..7630a42eeb 100644 --- a/components/fpdebug/fpdbgdwarf.pas +++ b/components/fpdebug/fpdbgdwarf.pas @@ -635,7 +635,6 @@ DECL = DW_AT_decl_column, DW_AT_decl_file, DW_AT_decl_line protected procedure KindNeeded; override; procedure TypeInfoNeeded; override; - function GetHasBounds: Boolean; override; public function GetTypedValueObject({%H-}ATypeCast: Boolean): TFpValueDwarf; override; function GetValueBounds(AValueObj: TFpValue; out ALowBound, @@ -689,7 +688,6 @@ DECL = DW_AT_decl_column, DW_AT_decl_file, DW_AT_decl_line procedure InitEnumIdx; protected function DoGetNestedTypeInfo: TFpSymbolDwarfType;override; - function GetHasBounds: Boolean; override; procedure NameNeeded; override; procedure KindNeeded; override; @@ -769,8 +767,6 @@ DECL = DW_AT_decl_column, DW_AT_decl_file, DW_AT_decl_line function GetNestedSymbol(AIndex: Int64): TFpSymbol; override; function GetNestedSymbolByName(AIndex: String): TFpSymbol; override; function GetNestedSymbolCount: Integer; override; - - function GetHasBounds: Boolean; override; public destructor Destroy; override; function GetTypedValueObject({%H-}ATypeCast: Boolean): TFpValueDwarf; override; @@ -3575,11 +3571,6 @@ begin end; end; -function TFpSymbolDwarfTypeBasic.GetHasBounds: Boolean; -begin - Result := (kind = skInteger) or (kind = skCardinal); -end; - function TFpSymbolDwarfTypeBasic.GetValueBounds(AValueObj: TFpValue; out ALowBound, AHighBound: Int64): Boolean; begin @@ -3719,24 +3710,6 @@ begin Result := FCountValue.TypeInfo as TFpSymbolDwarfType; end; -function TFpSymbolDwarfTypeSubRange.GetHasBounds: Boolean; -var - dummy: Int64; -begin - if FLowBoundState = rfNotRead then - GetValueLowBound(nil, dummy); - Result := (FLowBoundState in [rfConst, rfValue, rfNotRead]); - if not Result then - exit; - - if (FHighBoundState = rfNotRead) and (FCountState = rfNotRead) then - GetValueHighBound(nil, dummy); - if FHighBoundState = rfNotRead then - FCountState := rfNotFound; // dummy marker. HighBound depends on ValueObj - Result := (FHighBoundState in [rfConst, rfValue, rfNotRead]) or - (FCountState in [rfConst, rfValue, rfNotRead]); -end; - procedure TFpSymbolDwarfTypeSubRange.NameNeeded; var AName: String; @@ -3752,14 +3725,9 @@ var t: TFpSymbol; begin // TODO: limit to ordinal types - if not HasBounds then begin // does ReadBounds; - SetKind(skNone); // incomplete type - end; - t := NestedTypeInfo; if t = nil then begin SetKind(skInteger); - SetSize(CompilationUnit.AddressSize); end else SetKind(t.Kind); @@ -3767,15 +3735,20 @@ end; procedure TFpSymbolDwarfTypeSubRange.SizeNeeded; var + ByteSize: Integer; t: TFpSymbol; begin - t := NestedTypeInfo; - if t = nil then begin - SetKind(skInteger); - SetSize(CompilationUnit.AddressSize); - end - else - SetSize(t.Size); + if InformationEntry.ReadValue(DW_AT_byte_size, ByteSize) then + SetSize(ByteSize) + else begin + t := NestedTypeInfo; + if t = nil then begin + SetKind(skInteger); + SetSize(CompilationUnit.AddressSize); + end + else + SetSize(t.Size); + end; end; function TFpSymbolDwarfTypeSubRange.GetNestedSymbol(AIndex: Int64): TFpSymbol; @@ -4130,11 +4103,6 @@ begin Result := FMembers.Count; end; -function TFpSymbolDwarfTypeEnum.GetHasBounds: Boolean; -begin - Result := True; -end; - destructor TFpSymbolDwarfTypeEnum.Destroy; var i: Integer; diff --git a/components/fpdebug/fpdbginfo.pas b/components/fpdebug/fpdbginfo.pas index dcf6ec6a62..19745cb5fc 100644 --- a/components/fpdebug/fpdbginfo.pas +++ b/components/fpdebug/fpdbginfo.pas @@ -360,8 +360,6 @@ type function GetHasOrdinalValue: Boolean; virtual; function GetOrdinalValue: Int64; virtual; - function GetHasBounds: Boolean; virtual; - function GetNestedSymbol({%H-}AIndex: Int64): TFpSymbol; virtual; function GetNestedSymbolByName({%H-}AIndex: String): TFpSymbol; virtual; function GetNestedSymbolCount: Integer; virtual; @@ -432,7 +430,6 @@ type function GetValueBounds(AValueObj: TFpValue; out ALowBound, AHighBound: Int64): Boolean; virtual; function GetValueLowBound(AValueObj: TFpValue; out ALowBound: Int64): Boolean; virtual; function GetValueHighBound(AValueObj: TFpValue; out AHighBound: Int64): Boolean; virtual; - property HasBounds: Boolean read GetHasBounds; // Has declaration for BOTH bounds // VALUE property Value: TFpValue read GetValueObject; //deprecated 'rename / create'; @@ -468,7 +465,6 @@ type function GetValueObject: TFpValue; override; function GetHasOrdinalValue: Boolean; override; function GetOrdinalValue: Int64; override; - function GetHasBounds: Boolean; override; function GetNestedSymbol(AIndex: Int64): TFpSymbol; override; function GetNestedSymbolByName(AIndex: String): TFpSymbol; override; function GetNestedSymbolCount: Integer; override; @@ -1074,11 +1070,6 @@ begin FLastError := AnError; end; -function TFpSymbol.GetHasBounds: Boolean; -begin - Result := False; -end; - function TFpSymbol.GetHasOrdinalValue: Boolean; begin Result := False; @@ -1400,17 +1391,6 @@ begin Result := inherited GetValueHighBound(AValueObj, AHighBound); end; -function TFpSymbolForwarder.GetHasBounds: Boolean; -var - p: TFpSymbol; -begin - p := GetForwardToSymbol; - if p <> nil then - Result := p.HasBounds - else - Result := False; // Result := inherited GetHasBounds; -end; - function TFpSymbolForwarder.GetNestedSymbol(AIndex: Int64): TFpSymbol; var p: TFpSymbol;