mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-27 22:57:14 +01:00
LazDebuggerFp: fixed crash in callstack / dangling pointer
This commit is contained in:
parent
b95d4d491a
commit
dd89fc14e1
@ -836,15 +836,14 @@ begin
|
|||||||
FCallstackEntry.RemoveFreeNotification(@DoCallstackEntryFreed_DecRef);
|
FCallstackEntry.RemoveFreeNotification(@DoCallstackEntryFreed_DecRef);
|
||||||
|
|
||||||
if FCallstackEntry.Validity = ddsRequested then begin
|
if FCallstackEntry.Validity = ddsRequested then begin
|
||||||
if FDbgCallStack = nil then
|
if not FValid then
|
||||||
FCallstackEntry.Validity := ddsInvalid
|
FCallstackEntry.Validity := ddsInvalid
|
||||||
else begin
|
else begin
|
||||||
c := FDbgCallStack.SrcClassName;
|
c := FSrcClassName;
|
||||||
if c <> '' then
|
if c <> '' then
|
||||||
c := c + '.';
|
c := c + '.';
|
||||||
FCallstackEntry.Init(FDbgCallStack.AnAddress, nil,
|
FCallstackEntry.Init(FAnAddress, nil, c + FFunctionName + FParamAsString,
|
||||||
c + FDbgCallStack.FunctionName + FParamAsString,
|
FSourceFile, '', FLine, ddsValid);
|
||||||
FDbgCallStack.SourceFile, '', FDbgCallStack.Line, ddsValid);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@ -167,7 +167,10 @@ type
|
|||||||
TFpThreadWorkerCallEntry = class(TFpThreadWorkerPrepareCallStackEntryList)
|
TFpThreadWorkerCallEntry = class(TFpThreadWorkerPrepareCallStackEntryList)
|
||||||
protected
|
protected
|
||||||
FCallstackIndex: Integer;
|
FCallstackIndex: Integer;
|
||||||
FDbgCallStack: TDbgCallstackEntry;
|
FValid: Boolean;
|
||||||
|
FSrcClassName, FFunctionName, FSourceFile: String;
|
||||||
|
FAnAddress: TDBGPtr;
|
||||||
|
FLine: Integer;
|
||||||
FParamAsString: String;
|
FParamAsString: String;
|
||||||
procedure UpdateCallstackEntry_DecRef(Data: PtrInt = 0); virtual; abstract;
|
procedure UpdateCallstackEntry_DecRef(Data: PtrInt = 0); virtual; abstract;
|
||||||
procedure DoExecute; override;
|
procedure DoExecute; override;
|
||||||
@ -598,11 +601,13 @@ procedure TFpThreadWorkerCallEntry.DoExecute;
|
|||||||
var
|
var
|
||||||
PrettyPrinter: TFpPascalPrettyPrinter;
|
PrettyPrinter: TFpPascalPrettyPrinter;
|
||||||
Prop: TFpDebugDebuggerProperties;
|
Prop: TFpDebugDebuggerProperties;
|
||||||
|
DbgCallStack: TDbgCallstackEntry;
|
||||||
begin
|
begin
|
||||||
inherited DoExecute;
|
inherited DoExecute;
|
||||||
|
|
||||||
FDbgCallStack := FThread.CallStackEntryList[FCallstackIndex];
|
DbgCallStack := FThread.CallStackEntryList[FCallstackIndex];
|
||||||
if (FDbgCallStack <> nil) and (not StopRequested) then begin
|
FValid := (DbgCallStack <> nil) and (not StopRequested);
|
||||||
|
if FValid then begin
|
||||||
Prop := TFpDebugDebuggerProperties(FDebugger.GetProperties);
|
Prop := TFpDebugDebuggerProperties(FDebugger.GetProperties);
|
||||||
PrettyPrinter := TFpPascalPrettyPrinter.Create(DBGPTRSIZE[FDebugger.DbgController.CurrentProcess.Mode]);
|
PrettyPrinter := TFpPascalPrettyPrinter.Create(DBGPTRSIZE[FDebugger.DbgController.CurrentProcess.Mode]);
|
||||||
PrettyPrinter.Context := FDebugger.DbgController.DefaultContext;
|
PrettyPrinter.Context := FDebugger.DbgController.DefaultContext;
|
||||||
@ -611,7 +616,13 @@ begin
|
|||||||
FDebugger.MemManager.MemLimits.MaxStringLen := Prop.MemLimits.MaxStackStringLen;
|
FDebugger.MemManager.MemLimits.MaxStringLen := Prop.MemLimits.MaxStackStringLen;
|
||||||
FDebugger.MemManager.MemLimits.MaxNullStringSearchLen := Prop.MemLimits.MaxStackNullStringSearchLen;
|
FDebugger.MemManager.MemLimits.MaxNullStringSearchLen := Prop.MemLimits.MaxStackNullStringSearchLen;
|
||||||
|
|
||||||
FParamAsString := FDbgCallStack.GetParamsAsString(PrettyPrinter);
|
FSrcClassName := DbgCallStack.SrcClassName;
|
||||||
|
FAnAddress := DbgCallStack.AnAddress;
|
||||||
|
FFunctionName := DbgCallStack.FunctionName;
|
||||||
|
FSourceFile := DbgCallStack.SourceFile;
|
||||||
|
FLine := DbgCallStack.Line;
|
||||||
|
|
||||||
|
FParamAsString := DbgCallStack.GetParamsAsString(PrettyPrinter);
|
||||||
PrettyPrinter.Free;
|
PrettyPrinter.Free;
|
||||||
|
|
||||||
FDebugger.MemManager.MemLimits.MaxArrayLen := Prop.MemLimits.MaxArrayLen;
|
FDebugger.MemManager.MemLimits.MaxArrayLen := Prop.MemLimits.MaxArrayLen;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user