mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 09:19:22 +02:00
GDBMI Debugger: Added work around for wrong stackframe when assert is triggered. Issue #0029959
git-svn-id: trunk@58283 -
This commit is contained in:
parent
ff1d04d947
commit
018bda7a2f
@ -165,6 +165,7 @@ type
|
|||||||
FDisableStartupShell: Boolean;
|
FDisableStartupShell: Boolean;
|
||||||
FEncodeCurrentDirPath: TGDBMIDebuggerFilenameEncoding;
|
FEncodeCurrentDirPath: TGDBMIDebuggerFilenameEncoding;
|
||||||
FEncodeExeFileName: TGDBMIDebuggerFilenameEncoding;
|
FEncodeExeFileName: TGDBMIDebuggerFilenameEncoding;
|
||||||
|
FFixStackFrameForFpcAssert: Boolean;
|
||||||
FGdbLocalsValueMemLimit: Integer;
|
FGdbLocalsValueMemLimit: Integer;
|
||||||
{$IFDEF UNIX}
|
{$IFDEF UNIX}
|
||||||
FConsoleTty: String;
|
FConsoleTty: String;
|
||||||
@ -224,6 +225,8 @@ type
|
|||||||
property AssemblerStyle: TGDBMIDebuggerAssemblerStyle read FAssemblerStyle write FAssemblerStyle default gdasDefault;
|
property AssemblerStyle: TGDBMIDebuggerAssemblerStyle read FAssemblerStyle write FAssemblerStyle default gdasDefault;
|
||||||
property DisableStartupShell: Boolean read FDisableStartupShell
|
property DisableStartupShell: Boolean read FDisableStartupShell
|
||||||
write FDisableStartupShell default False;
|
write FDisableStartupShell default False;
|
||||||
|
property FixStackFrameForFpcAssert: Boolean read FFixStackFrameForFpcAssert
|
||||||
|
write FFixStackFrameForFpcAssert default True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TGDBMIDebuggerProperties = class(TGDBMIDebuggerPropertiesBase)
|
TGDBMIDebuggerProperties = class(TGDBMIDebuggerPropertiesBase)
|
||||||
@ -251,6 +254,7 @@ type
|
|||||||
property GdbLocalsValueMemLimit;
|
property GdbLocalsValueMemLimit;
|
||||||
property AssemblerStyle;
|
property AssemblerStyle;
|
||||||
property DisableStartupShell;
|
property DisableStartupShell;
|
||||||
|
property FixStackFrameForFpcAssert;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TGDBMIDebugger = class;
|
TGDBMIDebugger = class;
|
||||||
@ -5536,6 +5540,7 @@ function TGDBMIDebuggerCommandExecute.ProcessStopped(const AParams: String;
|
|||||||
S: String;
|
S: String;
|
||||||
FP: TDBGPtr;
|
FP: TDBGPtr;
|
||||||
i, cnt: longint;
|
i, cnt: longint;
|
||||||
|
Frame: TGDBMINameValueList;
|
||||||
begin
|
begin
|
||||||
FTheDebugger.QueueExecuteLock;
|
FTheDebugger.QueueExecuteLock;
|
||||||
try
|
try
|
||||||
@ -5561,6 +5566,17 @@ function TGDBMIDebuggerCommandExecute.ProcessStopped(const AParams: String;
|
|||||||
DebugLn(DBG_THREAD_AND_FRAME, ['ProcessStopped GetLocation found fp Stack(Internal) = ', FTheDebugger.FCurrentStackFrame]);
|
DebugLn(DBG_THREAD_AND_FRAME, ['ProcessStopped GetLocation found fp Stack(Internal) = ', FTheDebugger.FCurrentStackFrame]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if (FTheDebugger.FCurrentStackFrame > 3) and // must be 2 below fpc_assert, and that again must be below raise_except
|
||||||
|
TGDBMIDebuggerPropertiesBase(FTheDebugger.GetProperties).FixStackFrameForFpcAssert then begin
|
||||||
|
s := GetFrame(FTheDebugger.FCurrentStackFrame - 2);
|
||||||
|
if s <> '' then begin
|
||||||
|
Frame := TGDBMINameValueList.Create(S);
|
||||||
|
if Frame.Values['func'] = 'fpc_assert' then
|
||||||
|
FTheDebugger.FCurrentStackFrame := FTheDebugger.FCurrentStackFrame - 1;
|
||||||
|
Frame.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
if FTheDebugger.FCurrentStackFrame <> 0
|
if FTheDebugger.FCurrentStackFrame <> 0
|
||||||
then begin
|
then begin
|
||||||
// This frame should have all the info we need
|
// This frame should have all the info we need
|
||||||
@ -7341,6 +7357,7 @@ begin
|
|||||||
FGdbLocalsValueMemLimit := 32000;
|
FGdbLocalsValueMemLimit := 32000;
|
||||||
FAssemblerStyle := gdasDefault;
|
FAssemblerStyle := gdasDefault;
|
||||||
FDisableStartupShell := False;
|
FDisableStartupShell := False;
|
||||||
|
FFixStackFrameForFpcAssert := True;
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -7370,6 +7387,7 @@ begin
|
|||||||
FGdbLocalsValueMemLimit := TGDBMIDebuggerPropertiesBase(Source).FGdbLocalsValueMemLimit;
|
FGdbLocalsValueMemLimit := TGDBMIDebuggerPropertiesBase(Source).FGdbLocalsValueMemLimit;
|
||||||
FAssemblerStyle := TGDBMIDebuggerPropertiesBase(Source).FAssemblerStyle;
|
FAssemblerStyle := TGDBMIDebuggerPropertiesBase(Source).FAssemblerStyle;
|
||||||
FDisableStartupShell := TGDBMIDebuggerPropertiesBase(Source).FDisableStartupShell;
|
FDisableStartupShell := TGDBMIDebuggerPropertiesBase(Source).FDisableStartupShell;
|
||||||
|
FFixStackFrameForFpcAssert := TGDBMIDebuggerPropertiesBase(Source).FFixStackFrameForFpcAssert;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,6 +84,7 @@ type
|
|||||||
property GdbLocalsValueMemLimit;
|
property GdbLocalsValueMemLimit;
|
||||||
property AssemblerStyle;
|
property AssemblerStyle;
|
||||||
property DisableStartupShell;
|
property DisableStartupShell;
|
||||||
|
property FixStackFrameForFpcAssert;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
|
@ -98,6 +98,7 @@ type
|
|||||||
property GdbLocalsValueMemLimit;
|
property GdbLocalsValueMemLimit;
|
||||||
property AssemblerStyle;
|
property AssemblerStyle;
|
||||||
property DisableStartupShell;
|
property DisableStartupShell;
|
||||||
|
property FixStackFrameForFpcAssert;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
|
Loading…
Reference in New Issue
Block a user