mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 21:41:35 +02:00
FpDebug: fix nested array bounds in dwarf3
git-svn-id: trunk@59962 -
This commit is contained in:
parent
40e565832d
commit
c19567f879
@ -838,6 +838,7 @@ DECL = DW_AT_decl_column, DW_AT_decl_file, DW_AT_decl_line
|
|||||||
function GetMemberAddress(AValObject: TFpDwarfValue; const AIndex: Array of Int64): TFpDbgMemLocation;
|
function GetMemberAddress(AValObject: TFpDwarfValue; const AIndex: Array of Int64): TFpDbgMemLocation;
|
||||||
public
|
public
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
procedure ResetValueBounds; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFpDwarfSymbolValueProc }
|
{ TFpDwarfSymbolValueProc }
|
||||||
@ -1693,6 +1694,7 @@ function TFpDwarfValue.SetTypeCastInfo(AStructure: TFpDwarfSymbolType;
|
|||||||
ASource: TFpDbgValue): Boolean;
|
ASource: TFpDbgValue): Boolean;
|
||||||
begin
|
begin
|
||||||
Reset;
|
Reset;
|
||||||
|
AStructure.ResetValueBounds;
|
||||||
|
|
||||||
if FTypeCastSourceValue <> ASource then begin
|
if FTypeCastSourceValue <> ASource then begin
|
||||||
if FTypeCastSourceValue <> nil then
|
if FTypeCastSourceValue <> nil then
|
||||||
@ -2647,6 +2649,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
assert((FOwner is TFpDwarfSymbolTypeArray) and (FOwner.Kind = skArray));
|
assert((FOwner is TFpDwarfSymbolTypeArray) and (FOwner.Kind = skArray));
|
||||||
|
|
||||||
Addr := TFpDwarfSymbolTypeArray(FOwner).GetMemberAddress(Self, AIndex);
|
Addr := TFpDwarfSymbolTypeArray(FOwner).GetMemberAddress(Self, AIndex);
|
||||||
if not IsReadableLoc(Addr) then exit;
|
if not IsReadableLoc(Addr) then exit;
|
||||||
|
|
||||||
@ -2939,6 +2942,11 @@ begin
|
|||||||
// DW_AT_data_member_location in members [ block or const]
|
// DW_AT_data_member_location in members [ block or const]
|
||||||
// DW_AT_location [block or reference] todo: const
|
// DW_AT_location [block or reference] todo: const
|
||||||
if not AnInformationEntry.ReadValue(ATag, Val) then begin
|
if not AnInformationEntry.ReadValue(ATag, Val) then begin
|
||||||
|
(* if ASucessOnMissingTag = true AND tag does not exist
|
||||||
|
then AnAddress will NOT be modified
|
||||||
|
this can be used for DW_AT_data_member_location, if it does not exist members are on input location
|
||||||
|
TODO: review - better use temp var in caller
|
||||||
|
*)
|
||||||
Result := ASucessOnMissingTag;
|
Result := ASucessOnMissingTag;
|
||||||
if not Result then
|
if not Result then
|
||||||
AnAddress := InvalidLoc;
|
AnAddress := InvalidLoc;
|
||||||
@ -3332,8 +3340,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFpDwarfSymbolType.ResetValueBounds;
|
procedure TFpDwarfSymbolType.ResetValueBounds;
|
||||||
|
var
|
||||||
|
ti: TFpDwarfSymbolType;
|
||||||
begin
|
begin
|
||||||
//
|
ti := NestedTypeInfo;
|
||||||
|
if (ti <> nil) then
|
||||||
|
ti.ResetValueBounds;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TFpDwarfSymbolType.CreateTypeSubClass(AName: String;
|
class function TFpDwarfSymbolType.CreateTypeSubClass(AName: String;
|
||||||
@ -3563,9 +3575,11 @@ var
|
|||||||
AnAddress: TFpDbgMemLocation;
|
AnAddress: TFpDbgMemLocation;
|
||||||
InitLocParserData: TInitLocParserData;
|
InitLocParserData: TInitLocParserData;
|
||||||
begin
|
begin
|
||||||
|
// TODO: assert(AValueObj <> nil, 'TFpDwarfSymbolTypeSubRange.ReadBounds: AValueObj <> nil');
|
||||||
if FLowBoundState <> rfNotRead then exit;
|
if FLowBoundState <> rfNotRead then exit;
|
||||||
|
|
||||||
// Todo: search attrib-IDX only once
|
// Todo: search attrib-IDX only once
|
||||||
|
// Todo: LocationFromTag()
|
||||||
if InformationEntry.ReadReference(DW_AT_lower_bound, FwdInfoPtr, FwdCompUint) then begin
|
if InformationEntry.ReadReference(DW_AT_lower_bound, FwdInfoPtr, FwdCompUint) then begin
|
||||||
NewInfo := TDwarfInformationEntry.Create(FwdCompUint, FwdInfoPtr);
|
NewInfo := TDwarfInformationEntry.Create(FwdCompUint, FwdInfoPtr);
|
||||||
FLowBoundValue := TFpDwarfSymbolValue.CreateValueSubClass('', NewInfo);
|
FLowBoundValue := TFpDwarfSymbolValue.CreateValueSubClass('', NewInfo);
|
||||||
@ -3610,7 +3624,7 @@ begin
|
|||||||
if assigned(AValueObj) then
|
if assigned(AValueObj) then
|
||||||
InitLocParserData.ObjectDataAddress := AValueObj.Address;
|
InitLocParserData.ObjectDataAddress := AValueObj.Address;
|
||||||
InitLocParserData.ObjectDataAddrPush := False;
|
InitLocParserData.ObjectDataAddrPush := False;
|
||||||
if assigned(AValueObj) and LocationFromTag(DW_AT_upper_bound, AValueObj, AnAddress, @InitLocParserData, InformationEntry, True) then begin
|
if assigned(AValueObj) and LocationFromTag(DW_AT_upper_bound, AValueObj, AnAddress, @InitLocParserData, InformationEntry) then begin
|
||||||
FHighBoundState := rfConst;
|
FHighBoundState := rfConst;
|
||||||
FHighBoundConst := Int64(AnAddress.Address);
|
FHighBoundConst := Int64(AnAddress.Address);
|
||||||
end
|
end
|
||||||
@ -4504,6 +4518,20 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TFpDwarfSymbolTypeArray.ResetValueBounds;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
debuglnEnter(['TFpDwarfSymbolTypeArray.ResetValueBounds ' , Self.ClassName, dbgs(self)]); try
|
||||||
|
inherited ResetValueBounds;
|
||||||
|
FDwarfArrayReadFlags := [];
|
||||||
|
if FMembers <> nil then
|
||||||
|
for i := 0 to FMembers.Count - 1 do
|
||||||
|
if TObject(FMembers[i]) is TFpDwarfSymbolType then
|
||||||
|
TFpDwarfSymbolType(FMembers[i]).ResetValueBounds;
|
||||||
|
finally debuglnExit(['TFpDwarfSymbolTypeArray.ResetValueBounds ' ]); end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TDbgDwarfSymbol }
|
{ TDbgDwarfSymbol }
|
||||||
|
|
||||||
constructor TFpDwarfSymbolValueProc.Create(ACompilationUnit: TDwarfCompilationUnit;
|
constructor TFpDwarfSymbolValueProc.Create(ACompilationUnit: TDwarfCompilationUnit;
|
||||||
|
Loading…
Reference in New Issue
Block a user