mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 05:49:15 +02:00
DBG:: implement log expression-eval in breakpoint
git-svn-id: trunk@32431 -
This commit is contained in:
parent
a1e0eec879
commit
ce6ac1c77c
@ -173,7 +173,7 @@ end;
|
|||||||
function GetBreakPointActionsDescription(ABreakpoint: TBaseBreakpoint): string;
|
function GetBreakPointActionsDescription(ABreakpoint: TBaseBreakpoint): string;
|
||||||
const
|
const
|
||||||
DEBUG_ACTION: array[TIDEBreakPointAction] of ShortString =
|
DEBUG_ACTION: array[TIDEBreakPointAction] of ShortString =
|
||||||
(lisBreak, lisEnableGroups, lisDisableGroups, lisLogMessage, lisLogCallStack, lisTakeSnapshot);
|
(lisBreak, lisEnableGroups, lisDisableGroups, lisLogMessage, lisLogEvalExpression, lisLogCallStack, lisTakeSnapshot);
|
||||||
var
|
var
|
||||||
CurBreakPoint: TIDEBreakPoint;
|
CurBreakPoint: TIDEBreakPoint;
|
||||||
Action: TIDEBreakPointAction;
|
Action: TIDEBreakPointAction;
|
||||||
|
@ -281,7 +281,6 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
|
|||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
Caption = 'Eval expression'
|
Caption = 'Eval expression'
|
||||||
Enabled = False
|
|
||||||
TabOrder = 5
|
TabOrder = 5
|
||||||
end
|
end
|
||||||
object chkLogMessage: TCheckBox
|
object chkLogMessage: TCheckBox
|
||||||
@ -314,7 +313,6 @@ inherited BreakPropertyDlg: TBreakPropertyDlg
|
|||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
BorderSpacing.Bottom = 6
|
BorderSpacing.Bottom = 6
|
||||||
Enabled = False
|
|
||||||
TabOrder = 6
|
TabOrder = 6
|
||||||
end
|
end
|
||||||
object edtLogMessage: TEdit
|
object edtLogMessage: TEdit
|
||||||
|
@ -160,11 +160,12 @@ begin
|
|||||||
if chkActionBreak.Checked then Include(Actions, bpaStop);
|
if chkActionBreak.Checked then Include(Actions, bpaStop);
|
||||||
if chkDisableGroups.Checked then Include(Actions, bpaDisableGroup);
|
if chkDisableGroups.Checked then Include(Actions, bpaDisableGroup);
|
||||||
if chkEnableGroups.Checked then Include(Actions, bpaEnableGroup);
|
if chkEnableGroups.Checked then Include(Actions, bpaEnableGroup);
|
||||||
// if chkEvalExpression.Checked then Include(Actions, bpaEValExpression);
|
if chkEvalExpression.Checked then Include(Actions, bpaEValExpression);
|
||||||
if chkLogMessage.Checked then Include(Actions, bpaLogMessage);
|
if chkLogMessage.Checked then Include(Actions, bpaLogMessage);
|
||||||
if chkLogCallStack.Checked then Include(Actions, bpaLogCallStack);
|
if chkLogCallStack.Checked then Include(Actions, bpaLogCallStack);
|
||||||
if chkTakeSnap.Checked then include(Actions, bpaTakeSnapshot);
|
if chkTakeSnap.Checked then include(Actions, bpaTakeSnapshot);
|
||||||
FBreakpoint.Actions := Actions;
|
FBreakpoint.Actions := Actions;
|
||||||
|
FBreakpoint.LogEvalExpression := edtEvalExpression.Text;
|
||||||
FBreakpoint.LogMessage := edtLogMessage.Text;
|
FBreakpoint.LogMessage := edtLogMessage.Text;
|
||||||
FBreakpoint.LogCallStackLimit := edtLogCallStack.Value;
|
FBreakpoint.LogCallStackLimit := edtLogCallStack.Value;
|
||||||
|
|
||||||
@ -225,9 +226,10 @@ begin
|
|||||||
chkActionBreak.Checked := bpaStop in Actions;
|
chkActionBreak.Checked := bpaStop in Actions;
|
||||||
chkDisableGroups.Checked := bpaDisableGroup in Actions;
|
chkDisableGroups.Checked := bpaDisableGroup in Actions;
|
||||||
chkEnableGroups.Checked := bpaEnableGroup in Actions;
|
chkEnableGroups.Checked := bpaEnableGroup in Actions;
|
||||||
// chkEvalExpression.Checked := bpaEValExpression in Actions;
|
chkEvalExpression.Checked := bpaEValExpression in Actions;
|
||||||
chkLogMessage.Checked := bpaLogMessage in Actions;
|
chkLogMessage.Checked := bpaLogMessage in Actions;
|
||||||
edtLogMessage.Text := FBreakpoint.LogMessage;
|
edtLogMessage.Text := FBreakpoint.LogMessage;
|
||||||
|
edtEvalExpression.Text := FBreakpoint.LogEvalExpression;
|
||||||
chkLogCallStack.Checked := bpaLogCallStack in Actions;
|
chkLogCallStack.Checked := bpaLogCallStack in Actions;
|
||||||
edtLogCallStack.Value := FBreakpoint.LogCallStackLimit;
|
edtLogCallStack.Value := FBreakpoint.LogCallStackLimit;
|
||||||
chkTakeSnap.Checked := bpaTakeSnapshot in Actions;
|
chkTakeSnap.Checked := bpaTakeSnapshot in Actions;
|
||||||
|
@ -477,6 +477,7 @@ type
|
|||||||
bpaEnableGroup,
|
bpaEnableGroup,
|
||||||
bpaDisableGroup,
|
bpaDisableGroup,
|
||||||
bpaLogMessage,
|
bpaLogMessage,
|
||||||
|
bpaEValExpression,
|
||||||
bpaLogCallStack,
|
bpaLogCallStack,
|
||||||
bpaTakeSnapshot
|
bpaTakeSnapshot
|
||||||
);
|
);
|
||||||
@ -579,6 +580,7 @@ type
|
|||||||
|
|
||||||
TIDEBreakPoint = class(TBaseBreakPoint)
|
TIDEBreakPoint = class(TBaseBreakPoint)
|
||||||
private
|
private
|
||||||
|
FLogEvalExpression: String;
|
||||||
FMaster: TDBGBreakPoint;
|
FMaster: TDBGBreakPoint;
|
||||||
FAutoContinueTime: Cardinal;
|
FAutoContinueTime: Cardinal;
|
||||||
FActions: TIDEBreakPointActions;
|
FActions: TIDEBreakPointActions;
|
||||||
@ -618,6 +620,7 @@ type
|
|||||||
procedure SetActions(const AValue: TIDEBreakPointActions); virtual;
|
procedure SetActions(const AValue: TIDEBreakPointActions); virtual;
|
||||||
procedure SetGroup(const AValue: TIDEBreakPointGroup); virtual;
|
procedure SetGroup(const AValue: TIDEBreakPointGroup); virtual;
|
||||||
procedure SetAutoContinueTime(const AValue: Cardinal); virtual;
|
procedure SetAutoContinueTime(const AValue: Cardinal); virtual;
|
||||||
|
procedure SetLogEvalExpression(AValue: String);
|
||||||
procedure SetLogMessage(const AValue: String); virtual;
|
procedure SetLogMessage(const AValue: String); virtual;
|
||||||
procedure SetLogCallStackLimit(const AValue: Integer);
|
procedure SetLogCallStackLimit(const AValue: Integer);
|
||||||
public
|
public
|
||||||
@ -641,6 +644,7 @@ type
|
|||||||
property Actions: TIDEBreakPointActions read GetActions write SetActions;
|
property Actions: TIDEBreakPointActions read GetActions write SetActions;
|
||||||
property AutoContinueTime: Cardinal read GetAutoContinueTime write SetAutoContinueTime;
|
property AutoContinueTime: Cardinal read GetAutoContinueTime write SetAutoContinueTime;
|
||||||
property Group: TIDEBreakPointGroup read GetGroup write SetGroup;
|
property Group: TIDEBreakPointGroup read GetGroup write SetGroup;
|
||||||
|
property LogEvalExpression: String read FLogEvalExpression write SetLogEvalExpression;
|
||||||
property Loading: Boolean read FLoading;
|
property Loading: Boolean read FLoading;
|
||||||
property LogMessage: String read GetLogMessage write SetLogMessage;
|
property LogMessage: String read GetLogMessage write SetLogMessage;
|
||||||
property LogCallStackLimit: Integer read GetLogCallStackLimit write SetLogCallStackLimit;
|
property LogCallStackLimit: Integer read GetLogCallStackLimit write SetLogCallStackLimit;
|
||||||
@ -660,6 +664,7 @@ type
|
|||||||
procedure DoStateChange(const AOldState: TDBGState); virtual;
|
procedure DoStateChange(const AOldState: TDBGState); virtual;
|
||||||
procedure DoLogMessage(const AMessage: String); virtual;
|
procedure DoLogMessage(const AMessage: String); virtual;
|
||||||
procedure DoLogCallStack(const Limit: Integer); virtual;
|
procedure DoLogCallStack(const Limit: Integer); virtual;
|
||||||
|
procedure DoLogExpression(const AnExpression: String); virtual; // implemented in TGDBMIBreakpoint
|
||||||
property Debugger: TDebugger read GetDebugger;
|
property Debugger: TDebugger read GetDebugger;
|
||||||
public
|
public
|
||||||
constructor Create(ACollection: TCollection); override;
|
constructor Create(ACollection: TCollection); override;
|
||||||
@ -2838,6 +2843,7 @@ const
|
|||||||
'EnableGroup',
|
'EnableGroup',
|
||||||
'DisableGroup',
|
'DisableGroup',
|
||||||
'LogMessage',
|
'LogMessage',
|
||||||
|
'EvalExpression',
|
||||||
'LogCallStack',
|
'LogCallStack',
|
||||||
'TakeSnapshot'
|
'TakeSnapshot'
|
||||||
);
|
);
|
||||||
@ -6402,6 +6408,15 @@ begin
|
|||||||
Changed;
|
Changed;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TIDEBreakPoint.SetLogEvalExpression(AValue: String);
|
||||||
|
begin
|
||||||
|
if FLogEvalExpression <> AValue then
|
||||||
|
begin
|
||||||
|
FLogEvalExpression := AValue;
|
||||||
|
Changed;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TIDEBreakPoint.SetLogMessage(const AValue: String);
|
procedure TIDEBreakPoint.SetLogMessage(const AValue: String);
|
||||||
begin
|
begin
|
||||||
if FLogMessage <> AValue then
|
if FLogMessage <> AValue then
|
||||||
@ -6448,6 +6463,7 @@ begin
|
|||||||
TIDEBreakPoint(Dest).Actions := FActions;
|
TIDEBreakPoint(Dest).Actions := FActions;
|
||||||
TIDEBreakPoint(Dest).AutoContinueTime := FAutoContinueTime;
|
TIDEBreakPoint(Dest).AutoContinueTime := FAutoContinueTime;
|
||||||
TIDEBreakPoint(Dest).Group := FGroup;
|
TIDEBreakPoint(Dest).Group := FGroup;
|
||||||
|
TIDEBreakPoint(Dest).LogEvalExpression := FLogEvalExpression;
|
||||||
TIDEBreakPoint(Dest).LogMessage := FLogMessage;
|
TIDEBreakPoint(Dest).LogMessage := FLogMessage;
|
||||||
TIDEBreakPoint(Dest).LogCallStackLimit := FLogCallStackLimit;
|
TIDEBreakPoint(Dest).LogCallStackLimit := FLogCallStackLimit;
|
||||||
end;
|
end;
|
||||||
@ -6590,6 +6606,8 @@ begin
|
|||||||
AContinue := AContinue or not (bpaStop in Actions);
|
AContinue := AContinue or not (bpaStop in Actions);
|
||||||
if bpaLogMessage in Actions
|
if bpaLogMessage in Actions
|
||||||
then FMaster.DoLogMessage(FLogMessage);
|
then FMaster.DoLogMessage(FLogMessage);
|
||||||
|
if (bpaEValExpression in Actions) and (Trim(FLogEvalExpression) <> '')
|
||||||
|
then FMaster.DoLogExpression(Trim(FLogEvalExpression));
|
||||||
if bpaLogCallStack in Actions
|
if bpaLogCallStack in Actions
|
||||||
then FMaster.DoLogCallStack(FLogCallStackLimit);
|
then FMaster.DoLogCallStack(FLogCallStackLimit);
|
||||||
// SnapShot is taken in TDebugManager.DebuggerChangeState
|
// SnapShot is taken in TDebugManager.DebuggerChangeState
|
||||||
@ -6672,6 +6690,7 @@ begin
|
|||||||
InitialEnabled:=XMLConfig.GetValue(Path+'InitialEnabled/Value',true);
|
InitialEnabled:=XMLConfig.GetValue(Path+'InitialEnabled/Value',true);
|
||||||
Enabled:=FInitialEnabled;
|
Enabled:=FInitialEnabled;
|
||||||
FLine:=XMLConfig.GetValue(Path+'Line/Value',-1);
|
FLine:=XMLConfig.GetValue(Path+'Line/Value',-1);
|
||||||
|
FLogEvalExpression := XMLConfig.GetValue(Path+'LogEvalExpression/Value', '');
|
||||||
FLogMessage:=XMLConfig.GetValue(Path+'LogMessage/Value','');
|
FLogMessage:=XMLConfig.GetValue(Path+'LogMessage/Value','');
|
||||||
FLogCallStackLimit:=XMLConfig.GetValue(Path+'LogCallStackLimit/Value',0);
|
FLogCallStackLimit:=XMLConfig.GetValue(Path+'LogCallStackLimit/Value',0);
|
||||||
NewActions:=[];
|
NewActions:=[];
|
||||||
@ -6749,6 +6768,7 @@ begin
|
|||||||
AConfig.SetDeleteValue(APath+'Source/Value',Filename,'');
|
AConfig.SetDeleteValue(APath+'Source/Value',Filename,'');
|
||||||
AConfig.SetDeleteValue(APath+'InitialEnabled/Value',InitialEnabled,true);
|
AConfig.SetDeleteValue(APath+'InitialEnabled/Value',InitialEnabled,true);
|
||||||
AConfig.SetDeleteValue(APath+'Line/Value',Line,-1);
|
AConfig.SetDeleteValue(APath+'Line/Value',Line,-1);
|
||||||
|
AConfig.SetDeleteValue(APath+'LogEvalExpression/Value', FLogEvalExpression,'');
|
||||||
AConfig.SetDeleteValue(APath+'LogMessage/Value',LogMessage,'');
|
AConfig.SetDeleteValue(APath+'LogMessage/Value',LogMessage,'');
|
||||||
AConfig.SetDeleteValue(APath+'LogCallStackLimit/Value',LogCallStackLimit,0);
|
AConfig.SetDeleteValue(APath+'LogCallStackLimit/Value',LogCallStackLimit,0);
|
||||||
|
|
||||||
@ -6943,6 +6963,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TDBGBreakPoint.DoLogExpression(const AnExpression: String);
|
||||||
|
begin
|
||||||
|
// will be called while Debgger.State = dsRun => can not call Evaluate
|
||||||
|
end;
|
||||||
|
|
||||||
function TDBGBreakPoint.GetDebugger: TDebugger;
|
function TDBGBreakPoint.GetDebugger: TDebugger;
|
||||||
begin
|
begin
|
||||||
Result := TDBGBreakPoints(Collection).FDebugger;
|
Result := TDBGBreakPoints(Collection).FDebugger;
|
||||||
|
@ -841,6 +841,7 @@ type
|
|||||||
procedure DoEnableChange; override;
|
procedure DoEnableChange; override;
|
||||||
procedure DoExpressionChange; override;
|
procedure DoExpressionChange; override;
|
||||||
procedure DoStateChange(const AOldState: TDBGState); override;
|
procedure DoStateChange(const AOldState: TDBGState); override;
|
||||||
|
procedure DoLogExpression(const AnExpression: String); override;
|
||||||
procedure MakeInvalid;
|
procedure MakeInvalid;
|
||||||
procedure SetAddress(const AValue: TDBGPtr); override;
|
procedure SetAddress(const AValue: TDBGPtr); override;
|
||||||
public
|
public
|
||||||
@ -7425,6 +7426,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TGDBMIBreakPoint.DoLogExpression(const AnExpression: String);
|
||||||
|
var
|
||||||
|
s: String;
|
||||||
|
t: TDBGType;
|
||||||
|
begin
|
||||||
|
if TGDBMIDebugger(Debugger).GDBEvaluate(AnExpression, s, t, [defNoTypeInfo])
|
||||||
|
then begin
|
||||||
|
Debugger.DoDbgEvent(ecBreakpoint, etBreakpointEvaluation, s);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TGDBMIBreakPoint.MakeInvalid;
|
procedure TGDBMIBreakPoint.MakeInvalid;
|
||||||
begin
|
begin
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
|
@ -4648,6 +4648,7 @@ resourcestring
|
|||||||
lisEnableGroups = 'Enable Groups';
|
lisEnableGroups = 'Enable Groups';
|
||||||
lisDisableGroups = 'Disable Groups';
|
lisDisableGroups = 'Disable Groups';
|
||||||
lisLogMessage = 'Log Message';
|
lisLogMessage = 'Log Message';
|
||||||
|
lisLogEvalExpression = 'Eval expression';
|
||||||
lisLogCallStack = 'Log Call Stack';
|
lisLogCallStack = 'Log Call Stack';
|
||||||
lisLogCallStackLimit = '(frames limit. 0 - no limits)';
|
lisLogCallStackLimit = '(frames limit. 0 - no limits)';
|
||||||
lisAutoContinue = 'Auto Continue';
|
lisAutoContinue = 'Auto Continue';
|
||||||
|
Loading…
Reference in New Issue
Block a user