mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 01:19:37 +02:00
FPDebug: fix finding parentclass data address
git-svn-id: trunk@44408 -
This commit is contained in:
parent
2ffd578010
commit
e3b1d7060b
@ -1219,8 +1219,8 @@ DECL = DW_AT_decl_column, DW_AT_decl_file, DW_AT_decl_line
|
||||
procedure CreateMembers;
|
||||
procedure InitInheritanceInfo; inline;
|
||||
protected
|
||||
function DoGetNestedTypeInfo: TDbgDwarfTypeIdentifier; override;
|
||||
procedure KindNeeded; override;
|
||||
procedure TypeInfoNeeded; override; // nil or inherited
|
||||
function GetTypedValueObject(ATypeCast: Boolean): TFpDbgDwarfValue; override;
|
||||
|
||||
// GetMember, if AIndex > Count then parent
|
||||
@ -2886,18 +2886,11 @@ function TFpDbgDwarfValue.GetDwarfDataAddress(out AnAddress: TFpDbgMemLocation;
|
||||
var
|
||||
fields: TFpDbgValueFieldFlags;
|
||||
begin
|
||||
// TODO: also cache none valid address
|
||||
//Result := IsValidLoc(ATargetType.FCachedDataAddress);
|
||||
//if Result then begin
|
||||
// AnAddress := ATargetType.FCachedDataAddress;
|
||||
// exit;
|
||||
//end;
|
||||
|
||||
if FValueSymbol <> nil then begin
|
||||
Assert(FValueSymbol is TDbgDwarfValueIdentifier, 'TDbgDwarfSymbolValue.GetDwarfDataAddress FValueSymbol');
|
||||
Assert(TypeInfo is TDbgDwarfTypeIdentifier, 'TDbgDwarfSymbolValue.GetDwarfDataAddress TypeInfo');
|
||||
Assert(not HasTypeCastInfo, 'TDbgDwarfSymbolValue.GetDwarfDataAddress not HasTypeCastInfo');
|
||||
Result := FValueSymbol.GetValueDataAddress(Self, AnAddress, TDbgDwarfTypeIdentifier(FOwner));
|
||||
Result := FValueSymbol.GetValueDataAddress(Self, AnAddress, ATargetType);
|
||||
if IsError(FValueSymbol.LastError) then
|
||||
FLastError := FValueSymbol.LastError;
|
||||
end
|
||||
@ -2925,8 +2918,6 @@ begin
|
||||
if IsError(FTypeCastTargetType.LastError) then
|
||||
FLastError := FTypeCastTargetType.LastError;
|
||||
end;
|
||||
|
||||
//ATargetType.FCachedDataAddress := AnAddress;
|
||||
end;
|
||||
|
||||
function TFpDbgDwarfValue.GetStructureDwarfDataAddress(out AnAddress: TFpDbgMemLocation;
|
||||
@ -6349,6 +6340,24 @@ begin
|
||||
FInheritanceInfo := FInformationEntry.FindChildByTag(DW_TAG_inheritance);
|
||||
end;
|
||||
|
||||
function TDbgDwarfIdentifierStructure.DoGetNestedTypeInfo: TDbgDwarfTypeIdentifier;
|
||||
var
|
||||
FwdInfoPtr: Pointer;
|
||||
FwdCompUint: TDwarfCompilationUnit;
|
||||
ParentInfo: TDwarfInformationEntry;
|
||||
begin
|
||||
Result:= nil;
|
||||
InitInheritanceInfo;
|
||||
if (FInheritanceInfo <> nil) and
|
||||
FInheritanceInfo.ReadReference(DW_AT_type, FwdInfoPtr, FwdCompUint)
|
||||
then begin
|
||||
ParentInfo := TDwarfInformationEntry.Create(FwdCompUint, FwdInfoPtr);
|
||||
//DebugLn(FPDBG_DWARF_SEARCH, ['Inherited from ', dbgs(ParentInfo.FInformationEntry, FwdCompUint) ]);
|
||||
Result := TDbgDwarfTypeIdentifier.CreateTypeSubClass('', ParentInfo);
|
||||
ParentInfo.ReleaseReference;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDbgDwarfIdentifierStructure.KindNeeded;
|
||||
begin
|
||||
if (FInformationEntry.AbbrevTag = DW_TAG_class_type) then
|
||||
@ -6368,27 +6377,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDbgDwarfIdentifierStructure.TypeInfoNeeded;
|
||||
var
|
||||
FwdInfoPtr: Pointer;
|
||||
FwdCompUint: TDwarfCompilationUnit;
|
||||
ti: TDbgDwarfIdentifier;
|
||||
ParentInfo: TDwarfInformationEntry;
|
||||
begin
|
||||
ti:= nil;
|
||||
InitInheritanceInfo;
|
||||
if (FInheritanceInfo <> nil) and
|
||||
FInheritanceInfo.ReadReference(DW_AT_type, FwdInfoPtr, FwdCompUint)
|
||||
then begin
|
||||
ParentInfo := TDwarfInformationEntry.Create(FwdCompUint, FwdInfoPtr);
|
||||
//DebugLn(FPDBG_DWARF_SEARCH, ['Inherited from ', dbgs(ParentInfo.FInformationEntry, FwdCompUint) ]);
|
||||
ti := TDbgDwarfIdentifier.CreateSubClass('', ParentInfo);
|
||||
ParentInfo.ReleaseReference;
|
||||
end;
|
||||
SetTypeInfo(ti);
|
||||
ti.ReleaseReference;
|
||||
end;
|
||||
|
||||
function TDbgDwarfIdentifierStructure.GetTypedValueObject(ATypeCast: Boolean): TFpDbgDwarfValue;
|
||||
begin
|
||||
if ATypeCast then
|
||||
@ -6734,7 +6722,7 @@ begin
|
||||
if ti <> nil then
|
||||
Result := ti.GetDataAddress(AValueObj, AnAddress, ATargetType, ATargetCacheIndex+1)
|
||||
else
|
||||
Result := True; // TODO: False; // Result := ATargetType = nil; // end of type chain
|
||||
Result := False; // Result := ATargetType = nil; // end of type chain
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -864,6 +864,7 @@ begin
|
||||
// Class/Object // typecast, and inherhited
|
||||
obj1c := TTestSetup1ClassChild.Create;
|
||||
ImgLoader.GlobTestSetup1.VarClass := Obj1c;
|
||||
ImgLoader.GlobTestSetup1.VarClassChild := Obj1c;
|
||||
Obj1c.FWord := 1019;
|
||||
Obj1c.FBool := Boolean($9aa99aa9); // Make sure there is data, if other fields read to much
|
||||
Obj1c.FWordL := QWord($9aa99aa97bb7b77b); // Make sure there is data, if other fields read to much
|
||||
@ -871,10 +872,11 @@ begin
|
||||
StartTest('GlobTestSetup1Class.FWord', skCardinal, [ttHasType]);
|
||||
ExpResult(svfCardinal, 1019);
|
||||
|
||||
StartTest('TTestSetup1ClassChild(GlobTestSetup1Class).FWord', skCardinal, [ttHasType]);
|
||||
StartTest('GlobTestSetup1ClassChild.FWord', skCardinal, [ttHasType]);
|
||||
ExpResult(svfCardinal, 1019);
|
||||
|
||||
///////////////////-------------
|
||||
StartTest('TTestSetup1ClassChild(GlobTestSetup1Class).FWord', skCardinal, [ttHasType]);
|
||||
ExpResult(svfCardinal, 1019);
|
||||
|
||||
// Record
|
||||
// VParamTestRecord mis-named
|
||||
|
Loading…
Reference in New Issue
Block a user