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:
martin 2019-07-10 12:41:27 +00:00
parent 31c1cc7cfa
commit ac17315ae2
4 changed files with 59 additions and 11 deletions

View File

@ -1767,6 +1767,25 @@ type
end;
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
@ -2185,6 +2204,21 @@ begin
[AnAddr.Value, AnAddr.GuessedValue, AnAddr.Offset, ValidityName[AnAddr.Validity]]);
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 }
function TDBGDisassemblerRangeExtender.InitAddress(AValue: TDBGPtr;

View File

@ -158,7 +158,7 @@ type
{ TGDBMIDebuggerPropertiesBase }
TGDBMIDebuggerPropertiesBase = class(TDebuggerProperties)
TGDBMIDebuggerPropertiesBase = class(TCommonDebuggerProperties)
private
FAssemblerStyle: TGDBMIDebuggerAssemblerStyle;
FCaseSensitivity: TGDBMIDebuggerCaseSensitivity;
@ -235,6 +235,7 @@ type
property FixStackFrameForFpcAssert: Boolean read FFixStackFrameForFpcAssert
write FFixStackFrameForFpcAssert default True;
property FixIncorrectStepOver: Boolean read FFixIncorrectStepOver write FFixIncorrectStepOver default False;
property InternalExceptionBreakPoints;
{$IFdef MSWindows}
property AggressiveWaitTime: Cardinal read FAggressiveWaitTime write SetAggressiveWaitTime default 100;
{$EndIf}
@ -267,6 +268,7 @@ type
property DisableStartupShell;
property FixStackFrameForFpcAssert;
property FixIncorrectStepOver;
property InternalExceptionBreakPoints;
{$IFdef MSWindows}
property AggressiveWaitTime;
{$EndIf}
@ -5295,6 +5297,7 @@ var
List: TGDBMINameValueList;
CanContinue: Boolean;
StateStopped: Boolean;
DbgProp: TGDBMIDebuggerPropertiesBase;
begin
Result := True;
FSuccess := False;
@ -5409,18 +5412,22 @@ begin
Exclude(FTheDebugger.FDebuggerFlags, dfSetBreakPending);
// they may still exist from prev run, addr will be checked
// TODO: defered setting of below beakpoint / e.g. if debugging a library
DbgProp := TGDBMIDebuggerPropertiesBase(FTheDebugger.GetProperties);
{$IFdef WITH_GDB_FORCE_EXCEPTBREAK}
FTheDebugger.FExceptionBreak.SetByAddr(Self, True);
FTheDebugger.FBreakErrorBreak.SetByAddr(Self, True);
FTheDebugger.FRunErrorBreak.SetByAddr(Self, True);
{$Else}
FTheDebugger.FExceptionBreak.SetByAddr(Self);
FTheDebugger.FBreakErrorBreak.SetByAddr(Self);
FTheDebugger.FRunErrorBreak.SetByAddr(Self);
if ieRaiseBreakPoint in DbgProp.InternalExceptionBreakPoints
then FTheDebugger.FExceptionBreak.SetByAddr(Self);
if ieBreakErrorBreakPoint in DbgProp.InternalExceptionBreakPoints
then FTheDebugger.FBreakErrorBreak.SetByAddr(Self);
if ieRunErrorBreakPoint in DbgProp.InternalExceptionBreakPoints
then FTheDebugger.FRunErrorBreak.SetByAddr(Self);
{$ENDIF}
if (not (FTheDebugger.FExceptionBreak.IsBreakSet and
FTheDebugger.FBreakErrorBreak.IsBreakSet and
FTheDebugger.FRunErrorBreak.IsBreakSet)) and
if (not ((FTheDebugger.FExceptionBreak.IsBreakSet or not (ieRaiseBreakPoint in DbgProp.InternalExceptionBreakPoints)) and
(FTheDebugger.FBreakErrorBreak.IsBreakSet or not (ieBreakErrorBreakPoint in DbgProp.InternalExceptionBreakPoints)) and
(FTheDebugger.FRunErrorBreak.IsBreakSet or not (ieRunErrorBreakPoint in DbgProp.InternalExceptionBreakPoints)) )) and
(DebuggerProperties.WarnOnSetBreakpointError in [gdbwAll, gdbwExceptionsAndRunError])
then
Include(FTheDebugger.FDebuggerFlags, dfSetBreakFailed);
@ -5658,9 +5665,12 @@ begin
end;
SetTargetInfo(FileType);
FTheDebugger.FExceptionBreak.SetByAddr(Self);
FTheDebugger.FBreakErrorBreak.SetByAddr(Self);
FTheDebugger.FRunErrorBreak.SetByAddr(Self);
if ieRaiseBreakPoint in TGDBMIDebuggerPropertiesBase(FTheDebugger.GetProperties).InternalExceptionBreakPoints
then FTheDebugger.FExceptionBreak.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
SetDebuggerState(dsPause);
@ -6891,7 +6901,9 @@ begin
EnablePopCatches;
EnableRtlUnwind;
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)
else
FTheDebugger.FReRaiseBreak.Disable(Self);

View File

@ -99,6 +99,7 @@ type
property DisableStartupShell;
property FixStackFrameForFpcAssert;
property FixIncorrectStepOver;
property InternalExceptionBreakPoints;
end;
procedure Register;

View File

@ -110,6 +110,7 @@ type
property DisableStartupShell;
property FixStackFrameForFpcAssert;
property FixIncorrectStepOver;
property InternalExceptionBreakPoints;
end;
procedure Register;