mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 03:20:38 +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,17 +3373,22 @@ begin
|
||||
Result := RefSymbol <> nil;
|
||||
if Result then begin
|
||||
ValObj := RefSymbol.Value;
|
||||
assert(ValObj is TFpValueDwarfBase, 'Result is TFpValueDwarfBase');
|
||||
TFpValueDwarfBase(ValObj).Context := AValueObj.Context;
|
||||
AValue := ValObj.AsInteger;
|
||||
if IsError(ValObj.LastError) then begin
|
||||
Result := False;
|
||||
SetLastError(AValueObj, ValObj.LastError);
|
||||
end;
|
||||
ValObj.ReleaseReference;
|
||||
Result := ValObj <> nil;
|
||||
if Result then begin
|
||||
assert(ValObj is TFpValueDwarfBase, 'Result is TFpValueDwarfBase');
|
||||
TFpValueDwarfBase(ValObj).Context := AValueObj.Context;
|
||||
AValue := ValObj.AsInteger;
|
||||
if IsError(ValObj.LastError) then begin
|
||||
Result := False;
|
||||
SetLastError(AValueObj, ValObj.LastError);
|
||||
end;
|
||||
ValObj.ReleaseReference;
|
||||
|
||||
if ADataSymbol <> nil then
|
||||
ADataSymbol^ := RefSymbol
|
||||
if ADataSymbol <> nil then
|
||||
ADataSymbol^ := RefSymbol
|
||||
else
|
||||
RefSymbol.ReleaseReference;
|
||||
end
|
||||
else
|
||||
RefSymbol.ReleaseReference;
|
||||
end;
|
||||
@ -3614,7 +3619,8 @@ begin
|
||||
if sym <> nil then begin
|
||||
assert(sym is TFpSymbolDwarfData, 'TFpSymbolDwarf.GetNestedValue: sym is TFpSymbolDwarfData');
|
||||
Result := TFpValueDwarf(sym.Value);
|
||||
Result.FParentTypeSymbol := OuterSym;
|
||||
if Result <> nil then
|
||||
Result.FParentTypeSymbol := OuterSym;
|
||||
end
|
||||
else
|
||||
Result := nil;
|
||||
@ -3629,7 +3635,8 @@ begin
|
||||
if sym <> nil then begin
|
||||
assert(sym is TFpSymbolDwarfData, 'TFpSymbolDwarf.GetNestedValueByName: sym is TFpSymbolDwarfData');
|
||||
Result := TFpValueDwarf(sym.Value);
|
||||
Result.FParentTypeSymbol := OuterSym;
|
||||
if Result <> nil then
|
||||
Result.FParentTypeSymbol := OuterSym;
|
||||
end
|
||||
else
|
||||
Result := nil;
|
||||
@ -5450,8 +5457,10 @@ begin
|
||||
InfoEntry.IsArtificial
|
||||
then begin
|
||||
Result := TFpValueDwarf(TFpSymbolDwarfData.CreateValueSubClass('self', InfoEntry).Value);
|
||||
Result.FDataSymbol.ReleaseReference;
|
||||
Result.FDataSymbol.LocalProcInfo := Self;
|
||||
if Result <> nil then begin
|
||||
Result.FDataSymbol.ReleaseReference;
|
||||
Result.FDataSymbol.LocalProcInfo := Self;
|
||||
end;
|
||||
debugln(FPDBG_DWARF_SEARCH, ['TFpSymbolDwarfDataProc.GetSelfParameter ', InfoEntry.ScopeDebugText, DbgSName(Result)]);
|
||||
end;
|
||||
end;
|
||||
|
@ -515,6 +515,10 @@ begin
|
||||
|
||||
ParentFpSym := TFpSymbolDwarf.CreateSubClass(AName, InfoEntry);
|
||||
ParentFpVal := ParentFpSym.Value;
|
||||
if ParentFpVal = nil then begin
|
||||
Result := False;
|
||||
exit;
|
||||
end;
|
||||
ApplyContext(ParentFpVal);
|
||||
if not (svfOrdinal in ParentFpVal.FieldFlags) then begin
|
||||
DebugLn(FPDBG_DWARF_VERBOSE, 'no ordinal for parentfp');
|
||||
@ -1016,18 +1020,20 @@ begin
|
||||
UpperBoundSym := TFpSymbolDwarf.CreateSubClass('', Info);
|
||||
if UpperBoundSym <> nil then begin
|
||||
val := UpperBoundSym.Value;
|
||||
TFpValueDwarf(val).Context := Context;
|
||||
h := Val.AsInteger;
|
||||
val.ReleaseReference;
|
||||
if (h >= 0) and (h < maxLongint) then begin
|
||||
Result := h + 1;
|
||||
end
|
||||
else
|
||||
Result := 0;
|
||||
// TODO h < -1 => Error
|
||||
Info.ReleaseReference;
|
||||
UpperBoundSym.ReleaseReference;
|
||||
exit;
|
||||
if val <> nil then begin
|
||||
TFpValueDwarf(val).Context := Context;
|
||||
h := Val.AsInteger;
|
||||
val.ReleaseReference;
|
||||
if (h >= 0) and (h < maxLongint) then begin
|
||||
Result := h + 1;
|
||||
end
|
||||
else
|
||||
Result := 0;
|
||||
// TODO h < -1 => Error
|
||||
Info.ReleaseReference;
|
||||
UpperBoundSym.ReleaseReference;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user