mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 16:49:07 +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
|
uses
|
||||||
Classes, SysUtils, TypInfo, FileUtil, LResources, Forms, Controls, Graphics,
|
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;
|
LazarusIDEStrConsts, IDEWindowIntf,LCLProc,Grids, StdCtrls;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -60,7 +60,6 @@ type
|
|||||||
FDataGrid,
|
FDataGrid,
|
||||||
FPropertiesGrid,
|
FPropertiesGrid,
|
||||||
FMethodsGrid: TOIDBGGrid;
|
FMethodsGrid: TOIDBGGrid;
|
||||||
FDebugger: TDebugger;
|
|
||||||
FExpression: ansistring;
|
FExpression: ansistring;
|
||||||
FHumanReadable: ansistring;
|
FHumanReadable: ansistring;
|
||||||
FDBGInfo: TDBGType;
|
FDBGInfo: TDBGType;
|
||||||
@ -79,7 +78,7 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Execute(const ADebugger: TDebugger; const AExpression: ansistring);
|
procedure Execute(const AExpression: ansistring);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -353,30 +352,26 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIDEInspectDlg.Execute(const ADebugger: TDebugger;
|
procedure TIDEInspectDlg.Execute(const AExpression: ansistring);
|
||||||
const AExpression: ansistring);
|
|
||||||
begin
|
begin
|
||||||
FExpression:='';
|
FExpression:='';
|
||||||
FreeAndNil(FDBGInfo);
|
FreeAndNil(FDBGInfo);
|
||||||
FDebugger:=ADebugger;
|
if not DebugBoss.Evaluate(AExpression,FHumanReadable,FDBGInfo) or not assigned(FDBGInfo) then
|
||||||
if not FDebugger.Evaluate(AExpression,FHumanReadable,FDBGInfo) then begin
|
begin
|
||||||
FreeAndNil(FDBGInfo);
|
FreeAndNil(FDBGInfo);
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
if not assigned(FDBGInfo) then begin
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
FExpression:=AExpression;
|
FExpression:=AExpression;
|
||||||
case FDBGInfo.Kind of
|
case FDBGInfo.Kind of
|
||||||
skClass: InspectClass();
|
skClass: InspectClass();
|
||||||
skRecord: InspectRecord();
|
skRecord: InspectRecord();
|
||||||
// skEnum: ;
|
// skEnum: ;
|
||||||
// skSet: ;
|
// skSet: ;
|
||||||
// skProcedure: ;
|
// skProcedure: ;
|
||||||
// skFunction: ;
|
// skFunction: ;
|
||||||
skSimple: InspectSimple();
|
skSimple: InspectSimple();
|
||||||
skPointer: InspectPointer();
|
skPointer: InspectPointer();
|
||||||
// skDecomposable: ;
|
// skDecomposable: ;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -1696,13 +1696,6 @@ begin
|
|||||||
TBreakPointsDlg(CurDialog).BaseDirectory:=Project1.ProjectDirectory;
|
TBreakPointsDlg(CurDialog).BaseDirectory:=Project1.ProjectDirectory;
|
||||||
end;
|
end;
|
||||||
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;
|
FDialogs[ADialogType].Show;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1769,10 +1762,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDebugManager.InitInspectDlg;
|
procedure TDebugManager.InitInspectDlg;
|
||||||
//var
|
var
|
||||||
// TheDialog: TIDEInspectDlg;
|
TheDialog: TIDEInspectDlg;
|
||||||
begin
|
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;
|
end;
|
||||||
|
|
||||||
procedure TDebugManager.InitCallStackDlg;
|
procedure TDebugManager.InitCallStackDlg;
|
||||||
@ -1785,8 +1782,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDebugManager.InitEvaluateDlg;
|
procedure TDebugManager.InitEvaluateDlg;
|
||||||
|
var
|
||||||
|
TheDialog: TEvaluateDlg;
|
||||||
begin
|
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;
|
end;
|
||||||
|
|
||||||
constructor TDebugManager.Create(TheOwner: TComponent);
|
constructor TDebugManager.Create(TheOwner: TComponent);
|
||||||
@ -1875,7 +1878,8 @@ begin
|
|||||||
|
|
||||||
itmRunMenuResetDebugger.OnClick := @mnuResetDebuggerClicked;
|
itmRunMenuResetDebugger.OnClick := @mnuResetDebuggerClicked;
|
||||||
|
|
||||||
// itmRunMenuInspect.OnClick := @mnuViewDebugDialogClick;
|
itmRunMenuInspect.OnClick := @mnuViewDebugDialogClick;
|
||||||
|
itmRunMenuInspect.Tag := Ord(ddtInspect);
|
||||||
itmRunMenuEvaluate.OnClick := @mnuViewDebugDialogClick;
|
itmRunMenuEvaluate.OnClick := @mnuViewDebugDialogClick;
|
||||||
itmRunMenuEvaluate.Tag := Ord(ddtEvaluate);
|
itmRunMenuEvaluate.Tag := Ord(ddtEvaluate);
|
||||||
itmRunMenuAddWatch.OnClick := @mnuAddWatchClicked;
|
itmRunMenuAddWatch.OnClick := @mnuAddWatchClicked;
|
||||||
@ -1888,6 +1892,8 @@ begin
|
|||||||
SrcEditMenuAddWatchAtCursor.OnClick:=@mnuAddWatchClicked;
|
SrcEditMenuAddWatchAtCursor.OnClick:=@mnuAddWatchClicked;
|
||||||
SrcEditMenuEvaluateModify.OnClick:=@mnuViewDebugDialogClick;
|
SrcEditMenuEvaluateModify.OnClick:=@mnuViewDebugDialogClick;
|
||||||
SrcEditMenuEvaluateModify.Tag := Ord(ddtEvaluate);
|
SrcEditMenuEvaluateModify.Tag := Ord(ddtEvaluate);
|
||||||
|
SrcEditMenuInspect.OnClick:=@mnuViewDebugDialogClick;
|
||||||
|
SrcEditMenuInspect.Tag := Ord(ddtInspect);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDebugManager.SetupMainBarShortCuts;
|
procedure TDebugManager.SetupMainBarShortCuts;
|
||||||
@ -1908,7 +1914,6 @@ begin
|
|||||||
itmViewCallStack.Command:=GetCommand(ecToggleCallStack);
|
itmViewCallStack.Command:=GetCommand(ecToggleCallStack);
|
||||||
itmViewAssembler.Command:=GetCommand(ecToggleAssembler);
|
itmViewAssembler.Command:=GetCommand(ecToggleAssembler);
|
||||||
|
|
||||||
|
|
||||||
itmRunMenuInspect.Command:=GetCommand(ecInspect);
|
itmRunMenuInspect.Command:=GetCommand(ecInspect);
|
||||||
itmRunMenuEvaluate.Command:=GetCommand(ecEvaluate);
|
itmRunMenuEvaluate.Command:=GetCommand(ecEvaluate);
|
||||||
itmRunMenuAddWatch.Command:=GetCommand(ecAddWatch);
|
itmRunMenuAddWatch.Command:=GetCommand(ecAddWatch);
|
||||||
@ -1927,6 +1932,7 @@ begin
|
|||||||
SrcEditMenuRunToCursor.Command:=GetCommand(ecRunToCursor);
|
SrcEditMenuRunToCursor.Command:=GetCommand(ecRunToCursor);
|
||||||
SrcEditMenuEvaluateModify.Command:=GetCommand(ecEvaluate);
|
SrcEditMenuEvaluateModify.Command:=GetCommand(ecEvaluate);
|
||||||
SrcEditMenuAddWatchAtCursor.Command:=GetCommand(ecAddWatch);
|
SrcEditMenuAddWatchAtCursor.Command:=GetCommand(ecAddWatch);
|
||||||
|
SrcEditMenuInspect.Command:=GetCommand(ecInspect);
|
||||||
SrcEditMenuViewCallStack.Command:=GetCommand(ecToggleCallStack);
|
SrcEditMenuViewCallStack.Command:=GetCommand(ecToggleCallStack);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1962,6 +1968,8 @@ begin
|
|||||||
and (dcEvaluate in FDebugger.Commands);
|
and (dcEvaluate in FDebugger.Commands);
|
||||||
SrcEditMenuEvaluateModify.Enabled := (not DebuggerInvalid)
|
SrcEditMenuEvaluateModify.Enabled := (not DebuggerInvalid)
|
||||||
and (dcEvaluate in FDebugger.Commands);
|
and (dcEvaluate in FDebugger.Commands);
|
||||||
|
SrcEditMenuInspect.Enabled := (not DebuggerInvalid)
|
||||||
|
and (dcEvaluate in FDebugger.Commands);
|
||||||
itmRunMenuAddWatch.Enabled := True; // always allow to add a watch
|
itmRunMenuAddWatch.Enabled := True; // always allow to add a watch
|
||||||
// TODO: add other debugger menuitems
|
// TODO: add other debugger menuitems
|
||||||
// TODO: implement by actions
|
// TODO: implement by actions
|
||||||
@ -2310,7 +2318,7 @@ end;
|
|||||||
procedure TDebugManager.ProcessCommand(Command: word; var Handled: boolean);
|
procedure TDebugManager.ProcessCommand(Command: word; var Handled: boolean);
|
||||||
begin
|
begin
|
||||||
//debugln('TDebugManager.ProcessCommand ',dbgs(Command));
|
//debugln('TDebugManager.ProcessCommand ',dbgs(Command));
|
||||||
Handled:=true;
|
Handled := True;
|
||||||
case Command of
|
case Command of
|
||||||
ecPause: DoPauseProject;
|
ecPause: DoPauseProject;
|
||||||
ecStepInto: DoStepIntoProject;
|
ecStepInto: DoStepIntoProject;
|
||||||
@ -2320,12 +2328,13 @@ begin
|
|||||||
ecResetDebugger: ResetDebugger;
|
ecResetDebugger: ResetDebugger;
|
||||||
ecToggleCallStack: DoToggleCallStack;
|
ecToggleCallStack: DoToggleCallStack;
|
||||||
ecEvaluate: ViewDebugDialog(ddtEvaluate);
|
ecEvaluate: ViewDebugDialog(ddtEvaluate);
|
||||||
|
ecInspect: ViewDebugDialog(ddtInspect);
|
||||||
ecToggleWatches: ViewDebugDialog(ddtWatches);
|
ecToggleWatches: ViewDebugDialog(ddtWatches);
|
||||||
ecToggleBreakPoints: ViewDebugDialog(ddtBreakpoints);
|
ecToggleBreakPoints: ViewDebugDialog(ddtBreakpoints);
|
||||||
ecToggleDebuggerOut: ViewDebugDialog(ddtOutput);
|
ecToggleDebuggerOut: ViewDebugDialog(ddtOutput);
|
||||||
ecToggleLocals: ViewDebugDialog(ddtLocals);
|
ecToggleLocals: ViewDebugDialog(ddtLocals);
|
||||||
else
|
else
|
||||||
Handled:=false;
|
Handled := False;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2376,7 +2385,7 @@ begin
|
|||||||
ViewDebugDialog(ddtInspect);
|
ViewDebugDialog(ddtInspect);
|
||||||
if FDialogs[ddtInspect] <> nil then
|
if FDialogs[ddtInspect] <> nil then
|
||||||
begin
|
begin
|
||||||
TIDEInspectDlg(FDialogs[ddtInspect]).Execute(FDebugger, AExpression);
|
TIDEInspectDlg(FDialogs[ddtInspect]).Execute(AExpression);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -1968,6 +1968,7 @@ resourcestring
|
|||||||
uemToggleBreakpoint = '&Toggle Breakpoint';
|
uemToggleBreakpoint = '&Toggle Breakpoint';
|
||||||
uemEvaluateModify = '&Evaluate/Modify...';
|
uemEvaluateModify = '&Evaluate/Modify...';
|
||||||
uemAddWatchAtCursor = 'Add &Watch At Cursor';
|
uemAddWatchAtCursor = 'Add &Watch At Cursor';
|
||||||
|
uemInspect = '&Inspect...';
|
||||||
uemRunToCursor='&Run to Cursor';
|
uemRunToCursor='&Run to Cursor';
|
||||||
uemViewCallStack = 'View Call Stack';
|
uemViewCallStack = 'View Call Stack';
|
||||||
uemMovePageLeft='Move page left';
|
uemMovePageLeft='Move page left';
|
||||||
|
@ -10,8 +10,8 @@ inherited SourceNotebook: TSourceNotebook
|
|||||||
OnMouseUp = FormMouseUp
|
OnMouseUp = FormMouseUp
|
||||||
object StatusBar: TStatusBar[0]
|
object StatusBar: TStatusBar[0]
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 20
|
Height = 23
|
||||||
Top = 280
|
Top = 277
|
||||||
Width = 400
|
Width = 400
|
||||||
Panels = <
|
Panels = <
|
||||||
item
|
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'
|
+','#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
|
+'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'
|
+#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'
|
+'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'
|
+'leText'#6#14'This is a test'#11'SimplePanel'#8#10'OnDblClick'#7#17'StatusBa'
|
||||||
+'rDblClick'#0#0#0
|
+'rDblClick'#0#0#0
|
||||||
|
@ -933,6 +933,7 @@ var
|
|||||||
SrcEditMenuRunToCursor: TIDEMenuCommand;
|
SrcEditMenuRunToCursor: TIDEMenuCommand;
|
||||||
SrcEditMenuEvaluateModify: TIDEMenuCommand;
|
SrcEditMenuEvaluateModify: TIDEMenuCommand;
|
||||||
SrcEditMenuAddWatchAtCursor: TIDEMenuCommand;
|
SrcEditMenuAddWatchAtCursor: TIDEMenuCommand;
|
||||||
|
SrcEditMenuInspect: TIDEMenuCommand;
|
||||||
SrcEditMenuViewCallStack: TIDEMenuCommand;
|
SrcEditMenuViewCallStack: TIDEMenuCommand;
|
||||||
// refactoring
|
// refactoring
|
||||||
SrcEditMenuCompleteCode: TIDEMenuCommand;
|
SrcEditMenuCompleteCode: TIDEMenuCommand;
|
||||||
@ -1107,6 +1108,8 @@ begin
|
|||||||
SrcEditMenuEvaluateModify.Enabled:=False;
|
SrcEditMenuEvaluateModify.Enabled:=False;
|
||||||
SrcEditMenuAddWatchAtCursor:=RegisterIDEMenuCommand(AParent,
|
SrcEditMenuAddWatchAtCursor:=RegisterIDEMenuCommand(AParent,
|
||||||
'Add Watch at Cursor',uemAddWatchAtCursor);
|
'Add Watch at Cursor',uemAddWatchAtCursor);
|
||||||
|
SrcEditMenuInspect:=RegisterIDEMenuCommand(AParent, 'Inspect...', uemInspect);
|
||||||
|
SrcEditMenuInspect.Enabled:=False;
|
||||||
SrcEditMenuRunToCursor:=RegisterIDEMenuCommand(AParent,
|
SrcEditMenuRunToCursor:=RegisterIDEMenuCommand(AParent,
|
||||||
'Run to cursor', uemRunToCursor, nil, nil, nil, 'menu_run_cursor');
|
'Run to cursor', uemRunToCursor, nil, nil, nil, 'menu_run_cursor');
|
||||||
SrcEditMenuViewCallStack:=RegisterIDEMenuCommand(AParent,
|
SrcEditMenuViewCallStack:=RegisterIDEMenuCommand(AParent,
|
||||||
|
Loading…
Reference in New Issue
Block a user