mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 12:59:14 +02:00
GdbmiDebugger: introduce option to disable exception handling (e.g. for embedded, or disable run-error if they get caught as exception too)
git-svn-id: trunk@61557 -
This commit is contained in:
parent
31c1cc7cfa
commit
ac17315ae2
@ -1767,6 +1767,25 @@ type
|
|||||||
end;
|
end;
|
||||||
TDebuggerPropertiesClass= class of TDebuggerProperties;
|
TDebuggerPropertiesClass= class of TDebuggerProperties;
|
||||||
|
|
||||||
|
{ TCommonDebuggerProperties
|
||||||
|
properties that all debuggers should/could implement
|
||||||
|
}
|
||||||
|
|
||||||
|
TInternalExceptionBreakPoint = (ieRaiseBreakPoint, ieRunErrorBreakPoint, ieBreakErrorBreakPoint);
|
||||||
|
TInternalExceptionBreakPoints = set of TInternalExceptionBreakPoint;
|
||||||
|
|
||||||
|
TCommonDebuggerProperties = class(TDebuggerProperties)
|
||||||
|
private
|
||||||
|
FInternalExceptionBreakPoints: TInternalExceptionBreakPoints;
|
||||||
|
protected const
|
||||||
|
INTERNALEXCEPTIONBREAKPOINTS_DEFAULT = [ieRaiseBreakPoint, ieRunErrorBreakPoint, ieBreakErrorBreakPoint];
|
||||||
|
protected
|
||||||
|
property InternalExceptionBreakPoints: TInternalExceptionBreakPoints
|
||||||
|
read FInternalExceptionBreakPoints write FInternalExceptionBreakPoints;
|
||||||
|
public
|
||||||
|
constructor Create; override;
|
||||||
|
procedure Assign({%H-}Source: TPersistent); override;
|
||||||
|
end;
|
||||||
|
|
||||||
{$INTERFACES CORBA} // no ref counting needed
|
{$INTERFACES CORBA} // no ref counting needed
|
||||||
|
|
||||||
@ -2185,6 +2204,21 @@ begin
|
|||||||
[AnAddr.Value, AnAddr.GuessedValue, AnAddr.Offset, ValidityName[AnAddr.Validity]]);
|
[AnAddr.Value, AnAddr.GuessedValue, AnAddr.Offset, ValidityName[AnAddr.Validity]]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TCommonDebuggerProperties }
|
||||||
|
|
||||||
|
constructor TCommonDebuggerProperties.Create;
|
||||||
|
begin
|
||||||
|
FInternalExceptionBreakPoints := INTERNALEXCEPTIONBREAKPOINTS_DEFAULT;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCommonDebuggerProperties.Assign(Source: TPersistent);
|
||||||
|
begin
|
||||||
|
inherited Assign(Source);
|
||||||
|
if Source is TCommonDebuggerProperties then begin
|
||||||
|
FInternalExceptionBreakPoints := TCommonDebuggerProperties(Source).FInternalExceptionBreakPoints;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TDBGDisassemblerRangeExtender }
|
{ TDBGDisassemblerRangeExtender }
|
||||||
|
|
||||||
function TDBGDisassemblerRangeExtender.InitAddress(AValue: TDBGPtr;
|
function TDBGDisassemblerRangeExtender.InitAddress(AValue: TDBGPtr;
|
||||||
|
@ -158,7 +158,7 @@ type
|
|||||||
|
|
||||||
{ TGDBMIDebuggerPropertiesBase }
|
{ TGDBMIDebuggerPropertiesBase }
|
||||||
|
|
||||||
TGDBMIDebuggerPropertiesBase = class(TDebuggerProperties)
|
TGDBMIDebuggerPropertiesBase = class(TCommonDebuggerProperties)
|
||||||
private
|
private
|
||||||
FAssemblerStyle: TGDBMIDebuggerAssemblerStyle;
|
FAssemblerStyle: TGDBMIDebuggerAssemblerStyle;
|
||||||
FCaseSensitivity: TGDBMIDebuggerCaseSensitivity;
|
FCaseSensitivity: TGDBMIDebuggerCaseSensitivity;
|
||||||
@ -235,6 +235,7 @@ type
|
|||||||
property FixStackFrameForFpcAssert: Boolean read FFixStackFrameForFpcAssert
|
property FixStackFrameForFpcAssert: Boolean read FFixStackFrameForFpcAssert
|
||||||
write FFixStackFrameForFpcAssert default True;
|
write FFixStackFrameForFpcAssert default True;
|
||||||
property FixIncorrectStepOver: Boolean read FFixIncorrectStepOver write FFixIncorrectStepOver default False;
|
property FixIncorrectStepOver: Boolean read FFixIncorrectStepOver write FFixIncorrectStepOver default False;
|
||||||
|
property InternalExceptionBreakPoints;
|
||||||
{$IFdef MSWindows}
|
{$IFdef MSWindows}
|
||||||
property AggressiveWaitTime: Cardinal read FAggressiveWaitTime write SetAggressiveWaitTime default 100;
|
property AggressiveWaitTime: Cardinal read FAggressiveWaitTime write SetAggressiveWaitTime default 100;
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
@ -267,6 +268,7 @@ type
|
|||||||
property DisableStartupShell;
|
property DisableStartupShell;
|
||||||
property FixStackFrameForFpcAssert;
|
property FixStackFrameForFpcAssert;
|
||||||
property FixIncorrectStepOver;
|
property FixIncorrectStepOver;
|
||||||
|
property InternalExceptionBreakPoints;
|
||||||
{$IFdef MSWindows}
|
{$IFdef MSWindows}
|
||||||
property AggressiveWaitTime;
|
property AggressiveWaitTime;
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
@ -5295,6 +5297,7 @@ var
|
|||||||
List: TGDBMINameValueList;
|
List: TGDBMINameValueList;
|
||||||
CanContinue: Boolean;
|
CanContinue: Boolean;
|
||||||
StateStopped: Boolean;
|
StateStopped: Boolean;
|
||||||
|
DbgProp: TGDBMIDebuggerPropertiesBase;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
FSuccess := False;
|
FSuccess := False;
|
||||||
@ -5409,18 +5412,22 @@ begin
|
|||||||
Exclude(FTheDebugger.FDebuggerFlags, dfSetBreakPending);
|
Exclude(FTheDebugger.FDebuggerFlags, dfSetBreakPending);
|
||||||
// they may still exist from prev run, addr will be checked
|
// they may still exist from prev run, addr will be checked
|
||||||
// TODO: defered setting of below beakpoint / e.g. if debugging a library
|
// TODO: defered setting of below beakpoint / e.g. if debugging a library
|
||||||
|
DbgProp := TGDBMIDebuggerPropertiesBase(FTheDebugger.GetProperties);
|
||||||
{$IFdef WITH_GDB_FORCE_EXCEPTBREAK}
|
{$IFdef WITH_GDB_FORCE_EXCEPTBREAK}
|
||||||
FTheDebugger.FExceptionBreak.SetByAddr(Self, True);
|
FTheDebugger.FExceptionBreak.SetByAddr(Self, True);
|
||||||
FTheDebugger.FBreakErrorBreak.SetByAddr(Self, True);
|
FTheDebugger.FBreakErrorBreak.SetByAddr(Self, True);
|
||||||
FTheDebugger.FRunErrorBreak.SetByAddr(Self, True);
|
FTheDebugger.FRunErrorBreak.SetByAddr(Self, True);
|
||||||
{$Else}
|
{$Else}
|
||||||
FTheDebugger.FExceptionBreak.SetByAddr(Self);
|
if ieRaiseBreakPoint in DbgProp.InternalExceptionBreakPoints
|
||||||
FTheDebugger.FBreakErrorBreak.SetByAddr(Self);
|
then FTheDebugger.FExceptionBreak.SetByAddr(Self);
|
||||||
FTheDebugger.FRunErrorBreak.SetByAddr(Self);
|
if ieBreakErrorBreakPoint in DbgProp.InternalExceptionBreakPoints
|
||||||
|
then FTheDebugger.FBreakErrorBreak.SetByAddr(Self);
|
||||||
|
if ieRunErrorBreakPoint in DbgProp.InternalExceptionBreakPoints
|
||||||
|
then FTheDebugger.FRunErrorBreak.SetByAddr(Self);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if (not (FTheDebugger.FExceptionBreak.IsBreakSet and
|
if (not ((FTheDebugger.FExceptionBreak.IsBreakSet or not (ieRaiseBreakPoint in DbgProp.InternalExceptionBreakPoints)) and
|
||||||
FTheDebugger.FBreakErrorBreak.IsBreakSet and
|
(FTheDebugger.FBreakErrorBreak.IsBreakSet or not (ieBreakErrorBreakPoint in DbgProp.InternalExceptionBreakPoints)) and
|
||||||
FTheDebugger.FRunErrorBreak.IsBreakSet)) and
|
(FTheDebugger.FRunErrorBreak.IsBreakSet or not (ieRunErrorBreakPoint in DbgProp.InternalExceptionBreakPoints)) )) and
|
||||||
(DebuggerProperties.WarnOnSetBreakpointError in [gdbwAll, gdbwExceptionsAndRunError])
|
(DebuggerProperties.WarnOnSetBreakpointError in [gdbwAll, gdbwExceptionsAndRunError])
|
||||||
then
|
then
|
||||||
Include(FTheDebugger.FDebuggerFlags, dfSetBreakFailed);
|
Include(FTheDebugger.FDebuggerFlags, dfSetBreakFailed);
|
||||||
@ -5658,9 +5665,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
SetTargetInfo(FileType);
|
SetTargetInfo(FileType);
|
||||||
|
|
||||||
FTheDebugger.FExceptionBreak.SetByAddr(Self);
|
if ieRaiseBreakPoint in TGDBMIDebuggerPropertiesBase(FTheDebugger.GetProperties).InternalExceptionBreakPoints
|
||||||
FTheDebugger.FBreakErrorBreak.SetByAddr(Self);
|
then FTheDebugger.FExceptionBreak.SetByAddr(Self);
|
||||||
FTheDebugger.FRunErrorBreak.SetByAddr(Self);
|
if ieBreakErrorBreakPoint in TGDBMIDebuggerPropertiesBase(FTheDebugger.GetProperties).InternalExceptionBreakPoints
|
||||||
|
then FTheDebugger.FBreakErrorBreak.SetByAddr(Self);
|
||||||
|
if ieRunErrorBreakPoint in TGDBMIDebuggerPropertiesBase(FTheDebugger.GetProperties).InternalExceptionBreakPoints
|
||||||
|
then FTheDebugger.FRunErrorBreak.SetByAddr(Self);
|
||||||
|
|
||||||
if not(DebuggerState in [dsPause]) then
|
if not(DebuggerState in [dsPause]) then
|
||||||
SetDebuggerState(dsPause);
|
SetDebuggerState(dsPause);
|
||||||
@ -6891,7 +6901,9 @@ begin
|
|||||||
EnablePopCatches;
|
EnablePopCatches;
|
||||||
EnableRtlUnwind;
|
EnableRtlUnwind;
|
||||||
end;
|
end;
|
||||||
if (FExecType in [ectRunTo, ectStepOver{, ectStepInto}, ectStepOut, ectStepOverInstruction {, ectStepIntoInstruction}]) then
|
if (FExecType in [ectRunTo, ectStepOver{, ectStepInto}, ectStepOut, ectStepOverInstruction {, ectStepIntoInstruction}]) and
|
||||||
|
(ieRaiseBreakPoint in TGDBMIDebuggerPropertiesBase(FTheDebugger.GetProperties).InternalExceptionBreakPoints)
|
||||||
|
then
|
||||||
FTheDebugger.FReRaiseBreak.EnableOrSetByAddr(Self, True)
|
FTheDebugger.FReRaiseBreak.EnableOrSetByAddr(Self, True)
|
||||||
else
|
else
|
||||||
FTheDebugger.FReRaiseBreak.Disable(Self);
|
FTheDebugger.FReRaiseBreak.Disable(Self);
|
||||||
|
@ -99,6 +99,7 @@ type
|
|||||||
property DisableStartupShell;
|
property DisableStartupShell;
|
||||||
property FixStackFrameForFpcAssert;
|
property FixStackFrameForFpcAssert;
|
||||||
property FixIncorrectStepOver;
|
property FixIncorrectStepOver;
|
||||||
|
property InternalExceptionBreakPoints;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
|
@ -110,6 +110,7 @@ type
|
|||||||
property DisableStartupShell;
|
property DisableStartupShell;
|
||||||
property FixStackFrameForFpcAssert;
|
property FixStackFrameForFpcAssert;
|
||||||
property FixIncorrectStepOver;
|
property FixIncorrectStepOver;
|
||||||
|
property InternalExceptionBreakPoints;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
|
Loading…
Reference in New Issue
Block a user