mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 16:36:01 +02:00
debugger + ide: Inspect dialogs:
- add "Inspect..." menu item to the source editor debugger group - fix alt+F5 key combination (was crash) - don't access debugger directly from Inspect dialog since it cause a crash when debugger is not active. use debugboss method instead - move evaluate dialog initialization to InitEvaluateDlg method git-svn-id: trunk@22987 -
This commit is contained in:
parent
a7373b6df6
commit
2fd2eb30f1
@ -29,7 +29,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, TypInfo, FileUtil, LResources, Forms, Controls, Graphics,
|
||||
Dialogs, ComCtrls, ObjectInspector, PropEdits, Debugger, DebuggerDlg,
|
||||
Dialogs, ComCtrls, ObjectInspector, PropEdits, Debugger, DebuggerDlg, BaseDebugManager,
|
||||
LazarusIDEStrConsts, IDEWindowIntf,LCLProc,Grids, StdCtrls;
|
||||
|
||||
type
|
||||
@ -60,7 +60,6 @@ type
|
||||
FDataGrid,
|
||||
FPropertiesGrid,
|
||||
FMethodsGrid: TOIDBGGrid;
|
||||
FDebugger: TDebugger;
|
||||
FExpression: ansistring;
|
||||
FHumanReadable: ansistring;
|
||||
FDBGInfo: TDBGType;
|
||||
@ -79,7 +78,7 @@ type
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure Execute(const ADebugger: TDebugger; const AExpression: ansistring);
|
||||
procedure Execute(const AExpression: ansistring);
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -353,30 +352,26 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TIDEInspectDlg.Execute(const ADebugger: TDebugger;
|
||||
const AExpression: ansistring);
|
||||
procedure TIDEInspectDlg.Execute(const AExpression: ansistring);
|
||||
begin
|
||||
FExpression:='';
|
||||
FreeAndNil(FDBGInfo);
|
||||
FDebugger:=ADebugger;
|
||||
if not FDebugger.Evaluate(AExpression,FHumanReadable,FDBGInfo) then begin
|
||||
if not DebugBoss.Evaluate(AExpression,FHumanReadable,FDBGInfo) or not assigned(FDBGInfo) then
|
||||
begin
|
||||
FreeAndNil(FDBGInfo);
|
||||
Exit;
|
||||
end;
|
||||
if not assigned(FDBGInfo) then begin
|
||||
exit;
|
||||
end;
|
||||
FExpression:=AExpression;
|
||||
case FDBGInfo.Kind of
|
||||
skClass: InspectClass();
|
||||
skRecord: InspectRecord();
|
||||
// skEnum: ;
|
||||
// skSet: ;
|
||||
// skProcedure: ;
|
||||
// skFunction: ;
|
||||
skSimple: InspectSimple();
|
||||
skPointer: InspectPointer();
|
||||
// skDecomposable: ;
|
||||
skClass: InspectClass();
|
||||
skRecord: InspectRecord();
|
||||
// skEnum: ;
|
||||
// skSet: ;
|
||||
// skProcedure: ;
|
||||
// skFunction: ;
|
||||
skSimple: InspectSimple();
|
||||
skPointer: InspectPointer();
|
||||
// skDecomposable: ;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -1696,13 +1696,6 @@ begin
|
||||
TBreakPointsDlg(CurDialog).BaseDirectory:=Project1.ProjectDirectory;
|
||||
end;
|
||||
end;
|
||||
if (CurDialog is TEvaluateDlg) and (sourceNotebook<>nil)
|
||||
then begin
|
||||
if SourceNotebook.GetActiveSE.SelectionAvailable then
|
||||
TEvaluateDlg(CurDialog).FindText := SourceNotebook.GetActiveSE.Selection
|
||||
else
|
||||
TEvaluateDlg(CurDialog).FindText := SourceNotebook.GetActiveSE.GetOperandAtCurrentCaret;
|
||||
end;
|
||||
FDialogs[ADialogType].Show;
|
||||
end;
|
||||
|
||||
@ -1769,10 +1762,14 @@ begin
|
||||
end;
|
||||
|
||||
procedure TDebugManager.InitInspectDlg;
|
||||
//var
|
||||
// TheDialog: TIDEInspectDlg;
|
||||
var
|
||||
TheDialog: TIDEInspectDlg;
|
||||
begin
|
||||
// TheDialog := TIDEInspectDlg(FDialogs[ddtInspect]);
|
||||
TheDialog := TIDEInspectDlg(FDialogs[ddtInspect]);
|
||||
if SourceNotebook.GetActiveSE.SelectionAvailable then
|
||||
TheDialog.Execute(SourceNotebook.GetActiveSE.Selection)
|
||||
else
|
||||
TheDialog.Execute(SourceNotebook.GetActiveSE.GetOperandAtCurrentCaret);
|
||||
end;
|
||||
|
||||
procedure TDebugManager.InitCallStackDlg;
|
||||
@ -1785,8 +1782,14 @@ begin
|
||||
end;
|
||||
|
||||
procedure TDebugManager.InitEvaluateDlg;
|
||||
var
|
||||
TheDialog: TEvaluateDlg;
|
||||
begin
|
||||
// todo: pass current selection
|
||||
TheDialog := TEvaluateDlg(FDialogs[ddtEvaluate]);
|
||||
if SourceNotebook.GetActiveSE.SelectionAvailable then
|
||||
TheDialog.FindText := SourceNotebook.GetActiveSE.Selection
|
||||
else
|
||||
TheDialog.FindText := SourceNotebook.GetActiveSE.GetOperandAtCurrentCaret;
|
||||
end;
|
||||
|
||||
constructor TDebugManager.Create(TheOwner: TComponent);
|
||||
@ -1875,7 +1878,8 @@ begin
|
||||
|
||||
itmRunMenuResetDebugger.OnClick := @mnuResetDebuggerClicked;
|
||||
|
||||
// itmRunMenuInspect.OnClick := @mnuViewDebugDialogClick;
|
||||
itmRunMenuInspect.OnClick := @mnuViewDebugDialogClick;
|
||||
itmRunMenuInspect.Tag := Ord(ddtInspect);
|
||||
itmRunMenuEvaluate.OnClick := @mnuViewDebugDialogClick;
|
||||
itmRunMenuEvaluate.Tag := Ord(ddtEvaluate);
|
||||
itmRunMenuAddWatch.OnClick := @mnuAddWatchClicked;
|
||||
@ -1888,6 +1892,8 @@ begin
|
||||
SrcEditMenuAddWatchAtCursor.OnClick:=@mnuAddWatchClicked;
|
||||
SrcEditMenuEvaluateModify.OnClick:=@mnuViewDebugDialogClick;
|
||||
SrcEditMenuEvaluateModify.Tag := Ord(ddtEvaluate);
|
||||
SrcEditMenuInspect.OnClick:=@mnuViewDebugDialogClick;
|
||||
SrcEditMenuInspect.Tag := Ord(ddtInspect);
|
||||
end;
|
||||
|
||||
procedure TDebugManager.SetupMainBarShortCuts;
|
||||
@ -1908,7 +1914,6 @@ begin
|
||||
itmViewCallStack.Command:=GetCommand(ecToggleCallStack);
|
||||
itmViewAssembler.Command:=GetCommand(ecToggleAssembler);
|
||||
|
||||
|
||||
itmRunMenuInspect.Command:=GetCommand(ecInspect);
|
||||
itmRunMenuEvaluate.Command:=GetCommand(ecEvaluate);
|
||||
itmRunMenuAddWatch.Command:=GetCommand(ecAddWatch);
|
||||
@ -1927,6 +1932,7 @@ begin
|
||||
SrcEditMenuRunToCursor.Command:=GetCommand(ecRunToCursor);
|
||||
SrcEditMenuEvaluateModify.Command:=GetCommand(ecEvaluate);
|
||||
SrcEditMenuAddWatchAtCursor.Command:=GetCommand(ecAddWatch);
|
||||
SrcEditMenuInspect.Command:=GetCommand(ecInspect);
|
||||
SrcEditMenuViewCallStack.Command:=GetCommand(ecToggleCallStack);
|
||||
end;
|
||||
|
||||
@ -1962,6 +1968,8 @@ begin
|
||||
and (dcEvaluate in FDebugger.Commands);
|
||||
SrcEditMenuEvaluateModify.Enabled := (not DebuggerInvalid)
|
||||
and (dcEvaluate in FDebugger.Commands);
|
||||
SrcEditMenuInspect.Enabled := (not DebuggerInvalid)
|
||||
and (dcEvaluate in FDebugger.Commands);
|
||||
itmRunMenuAddWatch.Enabled := True; // always allow to add a watch
|
||||
// TODO: add other debugger menuitems
|
||||
// TODO: implement by actions
|
||||
@ -2310,22 +2318,23 @@ end;
|
||||
procedure TDebugManager.ProcessCommand(Command: word; var Handled: boolean);
|
||||
begin
|
||||
//debugln('TDebugManager.ProcessCommand ',dbgs(Command));
|
||||
Handled:=true;
|
||||
Handled := True;
|
||||
case Command of
|
||||
ecPause: DoPauseProject;
|
||||
ecStepInto: DoStepIntoProject;
|
||||
ecStepOver: DoStepOverProject;
|
||||
ecRunToCursor: DoRunToCursor;
|
||||
ecStopProgram: DoStopProject;
|
||||
ecResetDebugger: ResetDebugger;
|
||||
ecToggleCallStack: DoToggleCallStack;
|
||||
ecEvaluate: ViewDebugDialog(ddtEvaluate);
|
||||
ecToggleWatches: ViewDebugDialog(ddtWatches);
|
||||
ecToggleBreakPoints: ViewDebugDialog(ddtBreakpoints);
|
||||
ecToggleDebuggerOut: ViewDebugDialog(ddtOutput);
|
||||
ecToggleLocals: ViewDebugDialog(ddtLocals);
|
||||
ecPause: DoPauseProject;
|
||||
ecStepInto: DoStepIntoProject;
|
||||
ecStepOver: DoStepOverProject;
|
||||
ecRunToCursor: DoRunToCursor;
|
||||
ecStopProgram: DoStopProject;
|
||||
ecResetDebugger: ResetDebugger;
|
||||
ecToggleCallStack: DoToggleCallStack;
|
||||
ecEvaluate: ViewDebugDialog(ddtEvaluate);
|
||||
ecInspect: ViewDebugDialog(ddtInspect);
|
||||
ecToggleWatches: ViewDebugDialog(ddtWatches);
|
||||
ecToggleBreakPoints: ViewDebugDialog(ddtBreakpoints);
|
||||
ecToggleDebuggerOut: ViewDebugDialog(ddtOutput);
|
||||
ecToggleLocals: ViewDebugDialog(ddtLocals);
|
||||
else
|
||||
Handled:=false;
|
||||
Handled := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2376,7 +2385,7 @@ begin
|
||||
ViewDebugDialog(ddtInspect);
|
||||
if FDialogs[ddtInspect] <> nil then
|
||||
begin
|
||||
TIDEInspectDlg(FDialogs[ddtInspect]).Execute(FDebugger, AExpression);
|
||||
TIDEInspectDlg(FDialogs[ddtInspect]).Execute(AExpression);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -1968,6 +1968,7 @@ resourcestring
|
||||
uemToggleBreakpoint = '&Toggle Breakpoint';
|
||||
uemEvaluateModify = '&Evaluate/Modify...';
|
||||
uemAddWatchAtCursor = 'Add &Watch At Cursor';
|
||||
uemInspect = '&Inspect...';
|
||||
uemRunToCursor='&Run to Cursor';
|
||||
uemViewCallStack = 'View Call Stack';
|
||||
uemMovePageLeft='Move page left';
|
||||
|
@ -10,8 +10,8 @@ inherited SourceNotebook: TSourceNotebook
|
||||
OnMouseUp = FormMouseUp
|
||||
object StatusBar: TStatusBar[0]
|
||||
Left = 0
|
||||
Height = 20
|
||||
Top = 280
|
||||
Height = 23
|
||||
Top = 277
|
||||
Width = 400
|
||||
Panels = <
|
||||
item
|
||||
|
@ -5,7 +5,7 @@ LazarusResources.Add('TSourceNotebook','FORMDATA',[
|
||||
+','#1#3'Top'#3'v'#1#5'Width'#3#144#1#14'AllowDropFiles'#9#7'Caption'#6#14'So'
|
||||
+'urceNotebook'#12'ClientHeight'#3','#1#11'ClientWidth'#3#144#1#9'OnMouseUp'#7
|
||||
+#11'FormMouseUp'#0#242#2#0#10'TStatusBar'#9'StatusBar'#4'Left'#2#0#6'Height'
|
||||
+#2#20#3'Top'#3#24#1#5'Width'#3#144#1#6'Panels'#14#1#5'Width'#2'd'#0#1#5'Widt'
|
||||
+#2#23#3'Top'#3#21#1#5'Width'#3#144#1#6'Panels'#14#1#5'Width'#2'd'#0#1#5'Widt'
|
||||
+'h'#3#150#0#0#1#5'Width'#2'2'#0#1#4'Text'#6#3'INS'#5'Width'#2'2'#0#0#10'Simp'
|
||||
+'leText'#6#14'This is a test'#11'SimplePanel'#8#10'OnDblClick'#7#17'StatusBa'
|
||||
+'rDblClick'#0#0#0
|
||||
|
@ -933,6 +933,7 @@ var
|
||||
SrcEditMenuRunToCursor: TIDEMenuCommand;
|
||||
SrcEditMenuEvaluateModify: TIDEMenuCommand;
|
||||
SrcEditMenuAddWatchAtCursor: TIDEMenuCommand;
|
||||
SrcEditMenuInspect: TIDEMenuCommand;
|
||||
SrcEditMenuViewCallStack: TIDEMenuCommand;
|
||||
// refactoring
|
||||
SrcEditMenuCompleteCode: TIDEMenuCommand;
|
||||
@ -1107,6 +1108,8 @@ begin
|
||||
SrcEditMenuEvaluateModify.Enabled:=False;
|
||||
SrcEditMenuAddWatchAtCursor:=RegisterIDEMenuCommand(AParent,
|
||||
'Add Watch at Cursor',uemAddWatchAtCursor);
|
||||
SrcEditMenuInspect:=RegisterIDEMenuCommand(AParent, 'Inspect...', uemInspect);
|
||||
SrcEditMenuInspect.Enabled:=False;
|
||||
SrcEditMenuRunToCursor:=RegisterIDEMenuCommand(AParent,
|
||||
'Run to cursor', uemRunToCursor, nil, nil, nil, 'menu_run_cursor');
|
||||
SrcEditMenuViewCallStack:=RegisterIDEMenuCommand(AParent,
|
||||
|
Loading…
Reference in New Issue
Block a user