mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 12:59:16 +02:00
FpDebug: more range check exceptions / fixed missing begin/end
This commit is contained in:
parent
0045ad70a6
commit
f0ce562200
@ -2599,6 +2599,8 @@ var
|
|||||||
begin
|
begin
|
||||||
ASubStr := '';
|
ASubStr := '';
|
||||||
Result := True;
|
Result := True;
|
||||||
|
if ALen <= 0 then
|
||||||
|
exit;
|
||||||
|
|
||||||
t := TypeInfo;
|
t := TypeInfo;
|
||||||
if t = nil then
|
if t = nil then
|
||||||
@ -2629,7 +2631,7 @@ begin
|
|||||||
then
|
then
|
||||||
ALen := MemManager.MemLimits.MaxStringLen;
|
ALen := MemManager.MemLimits.MaxStringLen;
|
||||||
|
|
||||||
{$PUSH}{$Q-}
|
{$PUSH}{$Q-}{$R-}
|
||||||
Addr.Address := Addr.Address + AStartIndex - 1;
|
Addr.Address := Addr.Address + AStartIndex - 1;
|
||||||
{$POP}
|
{$POP}
|
||||||
if not ( (MemManager.SetLength(ASubStr, ALen)) and
|
if not ( (MemManager.SetLength(ASubStr, ALen)) and
|
||||||
@ -2702,7 +2704,7 @@ begin
|
|||||||
then
|
then
|
||||||
ALen := MemManager.MemLimits.MaxStringLen * 2;
|
ALen := MemManager.MemLimits.MaxStringLen * 2;
|
||||||
|
|
||||||
{$PUSH}{$Q-}
|
{$PUSH}{$Q-}{$R-}
|
||||||
Addr.Address := Addr.Address + (AStartIndex - 1) * 2;
|
Addr.Address := Addr.Address + (AStartIndex - 1) * 2;
|
||||||
{$POP}
|
{$POP}
|
||||||
if not ( (MemManager.SetLength(ASubStr, ALen)) and
|
if not ( (MemManager.SetLength(ASubStr, ALen)) and
|
||||||
@ -4093,6 +4095,8 @@ begin
|
|||||||
// TODO: if FValueDone, and covers selected range, then use FValue;
|
// TODO: if FValueDone, and covers selected range, then use FValue;
|
||||||
ASubStr := '';
|
ASubStr := '';
|
||||||
Result := True;
|
Result := True;
|
||||||
|
if ALen <= 0 then
|
||||||
|
exit;
|
||||||
|
|
||||||
dec(AStartIndex);
|
dec(AStartIndex);
|
||||||
if AStartIndex < 0 then begin // not supported, return partial
|
if AStartIndex < 0 then begin // not supported, return partial
|
||||||
|
@ -1113,7 +1113,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
|
|
||||||
while AParentClassIndex > 0 do begin
|
while AParentClassIndex > 0 do begin
|
||||||
{$PUSH}{$Q-}
|
{$PUSH}{$Q-}{$R-}
|
||||||
VmtAddr.Address := VmtAddr.Address + TDBGPtr(2 * ASizeOfAddr);
|
VmtAddr.Address := VmtAddr.Address + TDBGPtr(2 * ASizeOfAddr);
|
||||||
{$POP}
|
{$POP}
|
||||||
A := VmtAddr;
|
A := VmtAddr;
|
||||||
@ -1142,7 +1142,7 @@ begin
|
|||||||
dec(AParentClassIndex);
|
dec(AParentClassIndex);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$PUSH}{$Q-}
|
{$PUSH}{$Q-}{$R-}
|
||||||
VmtAddr.Address := VmtAddr.Address + TDBGPtr(3 * ASizeOfAddr);
|
VmtAddr.Address := VmtAddr.Address + TDBGPtr(3 * ASizeOfAddr);
|
||||||
{$POP}
|
{$POP}
|
||||||
|
|
||||||
@ -1179,7 +1179,7 @@ begin
|
|||||||
|
|
||||||
if AUnitName <> nil then begin
|
if AUnitName <> nil then begin
|
||||||
// get vTypeInfo
|
// get vTypeInfo
|
||||||
{$PUSH}{$Q-}
|
{$PUSH}{$Q-}{$R-}
|
||||||
VmtAddr.Address := VmtAddr.Address + TDBGPtr(4 * ASizeOfAddr);
|
VmtAddr.Address := VmtAddr.Address + TDBGPtr(4 * ASizeOfAddr);
|
||||||
{$POP}
|
{$POP}
|
||||||
|
|
||||||
@ -1193,7 +1193,7 @@ begin
|
|||||||
|
|
||||||
//inc(Pointer(classtypeinfo), PByte(Pointer(classtypeinfo)+1)^ + 2);
|
//inc(Pointer(classtypeinfo), PByte(Pointer(classtypeinfo)+1)^ + 2);
|
||||||
A := ClassNameAddr;
|
A := ClassNameAddr;
|
||||||
{$PUSH}{$Q-}
|
{$PUSH}{$Q-}{$R-}
|
||||||
A.Address := A.Address + 1;
|
A.Address := A.Address + 1;
|
||||||
{$POP}
|
{$POP}
|
||||||
if not AContext.ReadUnsignedInt(A, SizeVal(1), NameLen) then begin
|
if not AContext.ReadUnsignedInt(A, SizeVal(1), NameLen) then begin
|
||||||
@ -1201,7 +1201,7 @@ begin
|
|||||||
AContext.ClearLastMemError;
|
AContext.ClearLastMemError;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{$PUSH}{$Q-}
|
{$PUSH}{$Q-}{$R-}
|
||||||
ClassNameAddr.Address := ClassNameAddr.Address + TDBGPtr(NameLen + 2) + TDBGPtr(2 * ASizeOfAddr + 2);
|
ClassNameAddr.Address := ClassNameAddr.Address + TDBGPtr(NameLen + 2) + TDBGPtr(2 * ASizeOfAddr + 2);
|
||||||
if (ACompilerVersion >= $030300) then
|
if (ACompilerVersion >= $030300) then
|
||||||
ClassNameAddr.Address := ClassNameAddr.Address + TDBGPtr(ASizeOfAddr);
|
ClassNameAddr.Address := ClassNameAddr.Address + TDBGPtr(ASizeOfAddr);
|
||||||
@ -1674,7 +1674,7 @@ begin
|
|||||||
CalcBounds;
|
CalcBounds;
|
||||||
if FHighBound < FLowBound then
|
if FHighBound < FLowBound then
|
||||||
exit; // empty string
|
exit; // empty string
|
||||||
{$PUSH}{$Q-}
|
{$PUSH}{$Q-}{$R-}
|
||||||
FullLen := FHighBound-FLowBound+1;
|
FullLen := FHighBound-FLowBound+1;
|
||||||
{$POP}
|
{$POP}
|
||||||
|
|
||||||
@ -1705,10 +1705,12 @@ begin
|
|||||||
then
|
then
|
||||||
ALen := MemManager.MemLimits.MaxStringLen;
|
ALen := MemManager.MemLimits.MaxStringLen;
|
||||||
|
|
||||||
|
if ALen <= 0 then
|
||||||
|
exit;
|
||||||
|
|
||||||
t := TypeInfo;
|
t := TypeInfo;
|
||||||
if t.Kind = skWideString then begin
|
if t.Kind = skWideString then begin
|
||||||
{$PUSH}{$Q-}
|
{$PUSH}{$Q-}{$R-}
|
||||||
Addr.Address := Addr.Address + (AStartIndex - 1) * 2;
|
Addr.Address := Addr.Address + (AStartIndex - 1) * 2;
|
||||||
{$POP}
|
{$POP}
|
||||||
if not ( (MemManager.SetLength(WResult, ALen)) and
|
if not ( (MemManager.SetLength(WResult, ALen)) and
|
||||||
@ -1720,7 +1722,7 @@ begin
|
|||||||
end else
|
end else
|
||||||
if Addr.Address = Address.Address + 1 then begin
|
if Addr.Address = Address.Address + 1 then begin
|
||||||
// shortstring
|
// shortstring
|
||||||
{$PUSH}{$Q-}
|
{$PUSH}{$Q-}{$R-}
|
||||||
Addr.Address := Addr.Address + AStartIndex - 1;
|
Addr.Address := Addr.Address + AStartIndex - 1;
|
||||||
{$POP}
|
{$POP}
|
||||||
if not ( (MemManager.SetLength(ASubStr, ALen)) and
|
if not ( (MemManager.SetLength(ASubStr, ALen)) and
|
||||||
@ -1782,7 +1784,7 @@ begin
|
|||||||
CalcBounds;
|
CalcBounds;
|
||||||
if FHighBound < FLowBound then
|
if FHighBound < FLowBound then
|
||||||
exit; // empty string
|
exit; // empty string
|
||||||
{$PUSH}{$Q-}
|
{$PUSH}{$Q-}{$R-}
|
||||||
Len := FHighBound-FLowBound+1;
|
Len := FHighBound-FLowBound+1;
|
||||||
{$POP}
|
{$POP}
|
||||||
|
|
||||||
|
@ -4990,9 +4990,10 @@ function TFpPasParserValueSlicedArray.GetMember(AIndex: Int64): TFpValue;
|
|||||||
begin
|
begin
|
||||||
if SlicePart.FCurrentIndex = AIndex then begin
|
if SlicePart.FCurrentIndex = AIndex then begin
|
||||||
Result := FArraySlice.Items[0].ResultValue;
|
Result := FArraySlice.Items[0].ResultValue;
|
||||||
if Result <> nil then
|
if Result <> nil then begin
|
||||||
Result.AddReference;
|
Result.AddReference;
|
||||||
Result.Reset;
|
Result.Reset;
|
||||||
|
end;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user