mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-23 00:39:22 +02:00
FpDebug: Safety checks for Value <> nil. (In case of broken dwarf info)
git-svn-id: trunk@63768 -
This commit is contained in:
parent
83816792fb
commit
ee5e720d74
@ -3373,6 +3373,8 @@ begin
|
|||||||
Result := RefSymbol <> nil;
|
Result := RefSymbol <> nil;
|
||||||
if Result then begin
|
if Result then begin
|
||||||
ValObj := RefSymbol.Value;
|
ValObj := RefSymbol.Value;
|
||||||
|
Result := ValObj <> nil;
|
||||||
|
if Result then begin
|
||||||
assert(ValObj is TFpValueDwarfBase, 'Result is TFpValueDwarfBase');
|
assert(ValObj is TFpValueDwarfBase, 'Result is TFpValueDwarfBase');
|
||||||
TFpValueDwarfBase(ValObj).Context := AValueObj.Context;
|
TFpValueDwarfBase(ValObj).Context := AValueObj.Context;
|
||||||
AValue := ValObj.AsInteger;
|
AValue := ValObj.AsInteger;
|
||||||
@ -3386,6 +3388,9 @@ begin
|
|||||||
ADataSymbol^ := RefSymbol
|
ADataSymbol^ := RefSymbol
|
||||||
else
|
else
|
||||||
RefSymbol.ReleaseReference;
|
RefSymbol.ReleaseReference;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
RefSymbol.ReleaseReference;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if (not Result) and (not HasError(AValueObj)) then
|
if (not Result) and (not HasError(AValueObj)) then
|
||||||
@ -3614,6 +3619,7 @@ begin
|
|||||||
if sym <> nil then begin
|
if sym <> nil then begin
|
||||||
assert(sym is TFpSymbolDwarfData, 'TFpSymbolDwarf.GetNestedValue: sym is TFpSymbolDwarfData');
|
assert(sym is TFpSymbolDwarfData, 'TFpSymbolDwarf.GetNestedValue: sym is TFpSymbolDwarfData');
|
||||||
Result := TFpValueDwarf(sym.Value);
|
Result := TFpValueDwarf(sym.Value);
|
||||||
|
if Result <> nil then
|
||||||
Result.FParentTypeSymbol := OuterSym;
|
Result.FParentTypeSymbol := OuterSym;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -3629,6 +3635,7 @@ begin
|
|||||||
if sym <> nil then begin
|
if sym <> nil then begin
|
||||||
assert(sym is TFpSymbolDwarfData, 'TFpSymbolDwarf.GetNestedValueByName: sym is TFpSymbolDwarfData');
|
assert(sym is TFpSymbolDwarfData, 'TFpSymbolDwarf.GetNestedValueByName: sym is TFpSymbolDwarfData');
|
||||||
Result := TFpValueDwarf(sym.Value);
|
Result := TFpValueDwarf(sym.Value);
|
||||||
|
if Result <> nil then
|
||||||
Result.FParentTypeSymbol := OuterSym;
|
Result.FParentTypeSymbol := OuterSym;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -5450,8 +5457,10 @@ begin
|
|||||||
InfoEntry.IsArtificial
|
InfoEntry.IsArtificial
|
||||||
then begin
|
then begin
|
||||||
Result := TFpValueDwarf(TFpSymbolDwarfData.CreateValueSubClass('self', InfoEntry).Value);
|
Result := TFpValueDwarf(TFpSymbolDwarfData.CreateValueSubClass('self', InfoEntry).Value);
|
||||||
|
if Result <> nil then begin
|
||||||
Result.FDataSymbol.ReleaseReference;
|
Result.FDataSymbol.ReleaseReference;
|
||||||
Result.FDataSymbol.LocalProcInfo := Self;
|
Result.FDataSymbol.LocalProcInfo := Self;
|
||||||
|
end;
|
||||||
debugln(FPDBG_DWARF_SEARCH, ['TFpSymbolDwarfDataProc.GetSelfParameter ', InfoEntry.ScopeDebugText, DbgSName(Result)]);
|
debugln(FPDBG_DWARF_SEARCH, ['TFpSymbolDwarfDataProc.GetSelfParameter ', InfoEntry.ScopeDebugText, DbgSName(Result)]);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -515,6 +515,10 @@ begin
|
|||||||
|
|
||||||
ParentFpSym := TFpSymbolDwarf.CreateSubClass(AName, InfoEntry);
|
ParentFpSym := TFpSymbolDwarf.CreateSubClass(AName, InfoEntry);
|
||||||
ParentFpVal := ParentFpSym.Value;
|
ParentFpVal := ParentFpSym.Value;
|
||||||
|
if ParentFpVal = nil then begin
|
||||||
|
Result := False;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
ApplyContext(ParentFpVal);
|
ApplyContext(ParentFpVal);
|
||||||
if not (svfOrdinal in ParentFpVal.FieldFlags) then begin
|
if not (svfOrdinal in ParentFpVal.FieldFlags) then begin
|
||||||
DebugLn(FPDBG_DWARF_VERBOSE, 'no ordinal for parentfp');
|
DebugLn(FPDBG_DWARF_VERBOSE, 'no ordinal for parentfp');
|
||||||
@ -1016,6 +1020,7 @@ begin
|
|||||||
UpperBoundSym := TFpSymbolDwarf.CreateSubClass('', Info);
|
UpperBoundSym := TFpSymbolDwarf.CreateSubClass('', Info);
|
||||||
if UpperBoundSym <> nil then begin
|
if UpperBoundSym <> nil then begin
|
||||||
val := UpperBoundSym.Value;
|
val := UpperBoundSym.Value;
|
||||||
|
if val <> nil then begin
|
||||||
TFpValueDwarf(val).Context := Context;
|
TFpValueDwarf(val).Context := Context;
|
||||||
h := Val.AsInteger;
|
h := Val.AsInteger;
|
||||||
val.ReleaseReference;
|
val.ReleaseReference;
|
||||||
@ -1024,13 +1029,14 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
Result := 0;
|
Result := 0;
|
||||||
// TODO h < -1 => Error
|
// TODO h < -1 => Error
|
||||||
Info.ReleaseReference;
|
Info.ReleaseReference;
|
||||||
UpperBoundSym.ReleaseReference;
|
UpperBoundSym.ReleaseReference;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
Info.ReleaseReference;
|
Info.ReleaseReference;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user