DBG: Add watchpoints to src-edit popup menu

git-svn-id: trunk@32575 -
This commit is contained in:
martin 2011-09-30 19:18:18 +00:00
parent 173b64a12c
commit e9e9d97ea2
4 changed files with 44 additions and 4 deletions

View File

@ -76,6 +76,7 @@ type
procedure mnuAddBpAddress(Sender: TObject);
procedure mnuAddBpSource(Sender: TObject);
procedure mnuAddBpData(Sender: TObject);
procedure mnuAddBpDataAtCursor(Sender: TObject);
// Debugger events
procedure DebuggerBreakPointHit(ADebugger: TDebugger; ABreakPoint: TBaseBreakPoint; var ACanContinue: Boolean);
@ -721,10 +722,43 @@ var
NewBreakpoint: TIDEBreakPoint;
begin
NewBreakpoint := BreakPoints.Add('', wpsGlobal, wpkWrite);
if ShowBreakPointProperties(NewBreakpoint) <> mrOk then
if ShowBreakPointProperties(NewBreakpoint) = mrOk then
ViewDebugDialog(ddtBreakpoints, False)
else
NewBreakpoint.Free;
end;
procedure TDebugManager.mnuAddBpDataAtCursor(Sender: TObject);
var
SE: TSourceEditor;
WatchVar: String;
NewBreakpoint: TIDEBreakPoint;
begin
SE := SourceEditorManager.GetActiveSE;
if Assigned(SE) then
begin
if SE.SelectionAvailable then
WatchVar := SE.Selection
else
WatchVar := SE.GetOperandAtCurrentCaret;
if (WatchVar <> '') and SE.EditorComponent.Focused then
begin
// TODO: find existing?
NewBreakpoint := BreakPoints.Add(WatchVar, wpsGlobal, wpkWrite);
if ShowBreakPointProperties(NewBreakpoint) = mrOk then
ViewDebugDialog(ddtBreakpoints, False)
else
NewBreakpoint.Free;
exit;
end;
end;
// watch was not added automatically => show a dialog
mnuAddBpData(nil);
end;
procedure TDebugManager.BreakAutoContinueTimer(Sender: TObject);
begin
FAutoContinueTimer.Enabled := False;
@ -808,7 +842,7 @@ begin
end;
// watch was not added automatically => show a dialog
ShowWatchProperties(nil, WatchVar);
ShowWatchProperties(nil, '');
end;
//-----------------------------------------------------------------------------
@ -1625,6 +1659,7 @@ end;
procedure TDebugManager.ConnectSourceNotebookEvents;
begin
SrcEditMenuAddWatchAtCursor.OnClick:=@mnuAddWatchClicked;
SrcEditMenuAddWatchPointAtCursor.OnClick:=@mnuAddBpDataAtCursor;
SrcEditMenuEvaluateModify.OnClick:=@mnuViewDebugDialogClick;
SrcEditMenuEvaluateModify.Tag := Ord(ddtEvaluate);
SrcEditMenuInspect.OnClick:=@mnuViewDebugDialogClick;
@ -1675,6 +1710,7 @@ begin
SrcEditMenuRunToCursor.Command:=GetCommand(ecRunToCursor);
SrcEditMenuEvaluateModify.Command:=GetCommand(ecEvaluate);
SrcEditMenuAddWatchAtCursor.Command:=GetCommand(ecAddWatch);
SrcEditMenuAddWatchPointAtCursor.Command:=GetCommand(ecAddBpDataWatch);
SrcEditMenuInspect.Command:=GetCommand(ecInspect);
SrcEditMenuViewCallStack.Command:=GetCommand(ecToggleCallStack);
end;

View File

@ -579,7 +579,7 @@ begin
ecAddWatch: SetResult(VK_F5,[ssCtrl],VK_UNKNOWN,[]);
ecAddBpSource: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecAddBpAddress: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecAddBpDataWatch: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecAddBpDataWatch: SetResult(VK_F5,[ssShift],VK_UNKNOWN,[]);
// components menu
ecNewPackage: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
@ -1835,7 +1835,7 @@ begin
ecAddWatch: SetResult(VK_F5,[ssCtrl],VK_F5,[ssCtrl,ssMeta]);
ecAddBpSource: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecAddBpAddress: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecAddBpDataWatch: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecAddBpDataWatch: SetResult(VK_F5,[ssShift],VK_UNKNOWN,[]);
end;
end;

View File

@ -2279,6 +2279,7 @@ resourcestring
uemToggleBreakpoint = 'Toggle &Breakpoint';
uemEvaluateModify = '&Evaluate/Modify ...';
uemAddWatchAtCursor = 'Add &Watch At Cursor';
uemAddWatchPointAtCursor = 'Add Watch&Point At Cursor';
uemInspect = '&Inspect ...';
uemRunToCursor='&Run to Cursor';
uemViewCallStack = 'View Call Stack';

View File

@ -1169,6 +1169,7 @@ var
SrcEditMenuRunToCursor: TIDEMenuCommand;
SrcEditMenuEvaluateModify: TIDEMenuCommand;
SrcEditMenuAddWatchAtCursor: TIDEMenuCommand;
SrcEditMenuAddWatchPointAtCursor: TIDEMenuCommand;
SrcEditMenuInspect: TIDEMenuCommand;
SrcEditMenuViewCallStack: TIDEMenuCommand;
// source
@ -1435,6 +1436,8 @@ begin
SrcEditMenuEvaluateModify.Enabled:=False;
SrcEditMenuAddWatchAtCursor:=RegisterIDEMenuCommand
(AParent, 'Add Watch at Cursor',uemAddWatchAtCursor);
SrcEditMenuAddWatchPointAtCursor:=RegisterIDEMenuCommand
(AParent, 'Add Watch at Cursor',uemAddWatchPointAtCursor);
SrcEditMenuInspect:=RegisterIDEMenuCommand
(AParent, 'Inspect...', uemInspect, nil, nil, nil, 'debugger_inspect');
SrcEditMenuInspect.Enabled:=False;