DBG: process IDE commands in dialogs. Add step-over/into with automatic (windows context) asm/cmd switch

git-svn-id: trunk@28416 -
This commit is contained in:
martin 2010-11-22 18:46:25 +00:00
parent cffb9da137
commit 71d957a779
15 changed files with 61 additions and 73 deletions

View File

@ -189,7 +189,10 @@ procedure TAssemblerDlg.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShif
var
i: LongInt;
begin
if Shift - [ssShift] <> [] then Exit;
if Shift - [ssShift] <> [] then begin
inherited;
Exit;
end;
case Key of
VK_UP: begin
SetSelection(FSelectLine - 1, True, ssShift in Shift);
@ -223,6 +226,8 @@ begin
sbHorizontal.Position := 0;
Key := 0;
end;
else
inherited;
end;
pbAsm.Invalidate;
end;

View File

@ -332,7 +332,9 @@ begin
Handled := false;
if Handled then
Key := 0;
Key := 0
else
inherited;;
end;

View File

@ -539,7 +539,8 @@ end;
procedure TCallStackDlg.lvCallStackKeyPress(Sender: TObject; var Key: char);
begin
if key = #13
then lvCallStackDBLCLICK(Sender);
then lvCallStackDBLCLICK(Sender)
else inherited;;
end;
procedure TCallStackDlg.actViewLimitExecute(Sender: TObject);

View File

@ -37,13 +37,18 @@ unit DebuggerDlg;
interface
uses
Classes, Forms, Controls, IDEProcs, Debugger, EnvironmentOpts, IDEOptionDefs;
Classes, Forms, Controls, IDEProcs, Debugger, EnvironmentOpts, IDEOptionDefs,
EditorOptions, IDECommands;
type
{ TDebuggerDlg }
TDebuggerDlg = class(TForm)
private
FUpdateCount: integer;
protected
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure DoClose(var CloseAction: TCloseAction); override;
procedure DoBeginUpdate; virtual;
procedure DoEndUpdate; virtual;
@ -54,6 +59,9 @@ type
end;
TDebuggerDlgClass = class of TDebuggerDlg;
var
OnProcessCommand: procedure(Sender: TObject; Command: word; var Handled: boolean) of object;
implementation
{ TDebuggerDlg }
@ -76,6 +84,21 @@ begin
Result := FUpdateCount;
end;
procedure TDebuggerDlg.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
var
Command: Word;
Handled: Boolean;
begin
Command := EditorOpts.KeyMap.TranslateKey(Key,Shift,TDebuggerDlg);
if Assigned(OnProcessCommand) and (Command <> ecNone)
then begin
OnProcessCommand(Self,Command,Handled);
Handled := Handled or (Command = ecNone);
end;
end;
(*
procedure TDebuggerDlg.SetDebugger(const ADebugger: TDebugger);
begin

View File

@ -210,7 +210,9 @@ procedure TEvaluateDlg.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = VK_ESCAPE then
Close;
Close
else
inherited;;
end;
procedure TEvaluateDlg.tbEvaluateClick(Sender: TObject);

View File

@ -221,6 +221,8 @@ begin
//insert key pressed: add new item
VK_INSERT: popAddClick(Sender);
else
inherited;
end;
end;

View File

@ -2219,10 +2219,6 @@ begin
StepOverSpeedButton.Enabled := CanRun and (not DebuggerIsValid
or (dcStepOver in FDebugger.Commands) or (FDebugger.State = dsIdle));
itmRunMenuStepOver.Enabled := StepOverSpeedButton.Enabled;
itmRunMenuStepIntoInstr.Enabled := CanRun and (not DebuggerIsValid or
(dcStepIntoInstr in FDebugger.Commands) or (FDebugger.State = dsIdle));
itmRunMenuStepOverInstr.Enabled := CanRun and (not DebuggerIsValid or
(dcStepOverInstr in FDebugger.Commands) or (FDebugger.State = dsIdle));
// Step out
StepOutSpeedButton.Enabled := CanRun and (not DebuggerIsValid
or (dcStepOut in FDebugger.Commands) or (FDebugger.State = dsIdle));
@ -2726,6 +2722,16 @@ begin
ecStepOver: DoStepOverProject;
ecStepIntoInstr: DoStepIntoInstrProject;
ecStepOverInstr: DoStepOverInstrProject;
ecStepIntoContext: begin
if (FDialogs[ddtAssembler] <> nil) and FDialogs[ddtAssembler].Active
then DoStepIntoInstrProject
else DoStepIntoProject;
end;
ecStepOverContext: begin
if (FDialogs[ddtAssembler] <> nil) and FDialogs[ddtAssembler].Active
then DoStepOverInstrProject
else DoStepOverProject;
end;
ecStepOut: DoStepOutProject;
ecRunToCursor: DoRunToCursor;
ecStopProgram: DoStopProject;

View File

@ -2141,6 +2141,8 @@ begin
ecStepOver : Result:= lisMenuStepOver;
ecStepIntoInstr : Result:= lisMenuStepIntoInstr;
ecStepOverInstr : Result:= lisMenuStepOverInstr;
ecStepIntoContext : Result:= lisMenuStepIntoContext;
ecStepOverContext : Result:= lisMenuStepOverContext;
ecStepOut : Result:= lisMenuStepOut;
ecRunToCursor : Result:= lisMenuRunToCursor;
ecStopProgram : Result:= srkmecStopProgram;
@ -2852,6 +2854,8 @@ begin
AddDefault(C, 'Step over', lisMenuStepOver, ecStepOver);
AddDefault(C, 'Step into instr', lisMenuStepIntoInstr, ecStepIntoInstr);
AddDefault(C, 'Step over instr', lisMenuStepOverInstr, ecStepOverInstr);
AddDefault(C, 'Step into context', lisMenuStepIntoContext, ecStepIntoContext);
AddDefault(C, 'Step over context', lisMenuStepOverContext, ecStepOverContext);
AddDefault(C, 'Step out', lisMenuStepOut, ecStepOut);
AddDefault(C, 'Run to cursor', lisMenuRunToCursor, ecRunToCursor);
AddDefault(C, 'Stop program', lisKMStopProgram, ecStopProgram);

View File

@ -345,6 +345,8 @@ resourcestring
lisMenuStepOver = 'Step over';
lisMenuStepIntoInstr = 'Step into instruction';
lisMenuStepOverInstr = 'Step over instruction';
lisMenuStepIntoContext = 'Step into (Context)';
lisMenuStepOverContext = 'Step over (Context)';
lisMenuStepOut = 'Step out';
lisMenuRunToCursor = 'Run to cursor';
lisKMStopProgram = 'Stop program';

View File

@ -93,7 +93,7 @@ uses
// LRT stuff
Translations,
// debugger
RunParamsOpts, BaseDebugManager, DebugManager, debugger,
RunParamsOpts, BaseDebugManager, DebugManager, debugger, DebuggerDlg,
// packager
PackageSystem, PkgManager, BasePkgManager,
// source editing
@ -1349,6 +1349,8 @@ begin
// initialize the other IDE managers
DebugBoss:=TDebugManager.Create(nil);
DebugBoss.ConnectMainBarEvents;
DebuggerDlg.OnProcessCommand := @OnProcessIDECommand;
PkgBoss:=TPkgManager.Create(nil);
PkgBoss.ConnectMainBarEvents;
HelpBoss:=TIDEHelpManager.Create(nil);
@ -2470,8 +2472,6 @@ begin
itmRunMenuShowExecutionPoint.OnClick := @mnuShowExecutionPointClicked;
itmRunMenuStepInto.OnClick := @mnuStepIntoProjectClicked;
itmRunMenuStepOver.OnClick := @mnuStepOverProjectClicked;
itmRunMenuStepIntoInstr.OnClick := @mnuStepIntoInstrProjectClicked;
itmRunMenuStepOverInstr.OnClick := @mnuStepOverInstrProjectClicked;
itmRunMenuStepOut.OnClick := @mnuStepOutProjectClicked;
itmRunMenuRunToCursor.OnClick := @mnuRunToCursorProjectClicked;
itmRunMenuStop.OnClick := @mnuStopProjectClicked;

View File

@ -260,8 +260,6 @@ type
itmRunMenuShowExecutionPoint: TIDEMenuCommand;
itmRunMenuStepInto: TIDEMenuCommand;
itmRunMenuStepOver: TIDEMenuCommand;
itmRunMenuStepIntoInstr: TIDEMenuCommand;
itmRunMenuStepOverInstr: TIDEMenuCommand;
itmRunMenuStepOut: TIDEMenuCommand;
itmRunMenuRunToCursor: TIDEMenuCommand;
itmRunMenuStop: TIDEMenuCommand;

View File

@ -658,8 +658,6 @@ begin
lisMenuShowExecutionPoint,'debugger_show_execution_point', False);
CreateMenuItem(ParentMI,itmRunMenuStepInto,'itmRunMenuStepInto',lisMenuStepInto,'menu_stepinto');
CreateMenuItem(ParentMI,itmRunMenuStepOver,'itmRunMenuStepOver',lisMenuStepOver,'menu_stepover');
CreateMenuItem(ParentMI,itmRunMenuStepIntoInstr,'itmRunMenuStepIntoInstr',lisMenuStepIntoInstr,'menu_stepinto_instr');
CreateMenuItem(ParentMI,itmRunMenuStepOverInstr,'itmRunMenuStepOverInstr',lisMenuStepOverInstr,'menu_stepover_instr');
CreateMenuItem(ParentMI,itmRunMenuStepOut,'itmRunMenuStepOut',lisMenuStepOut,'menu_stepout');
CreateMenuItem(ParentMI,itmRunMenuRunToCursor,'itmRunMenuRunToCursor',lisMenuRunToCursor,'menu_run_cursor');
CreateMenuItem(ParentMI,itmRunMenuStop,'itmRunMenuStop',lisMenuStop,'menu_stop', False);
@ -956,8 +954,6 @@ begin
itmRunMenuPause.Command:=GetCommand(ecPause);
itmRunMenuStepInto.Command:=GetCommand(ecStepInto);
itmRunMenuStepOver.Command:=GetCommand(ecStepOver);
itmRunMenuStepIntoInstr.Command:=GetCommand(ecStepIntoInstr);
itmRunMenuStepOverInstr.Command:=GetCommand(ecStepOverInstr);
itmRunMenuStepOut.Command:=GetCommand(ecStepOut);
itmRunMenuRunToCursor.Command:=GetCommand(ecRunToCursor);
itmRunMenuStop.Command:=GetCommand(ecStopProgram);

View File

@ -249,6 +249,8 @@ const
ecStepOut = ecFirstLazarus + 419;
ecStepIntoInstr = ecFirstLazarus + 420;
ecStepOverInstr = ecFirstLazarus + 421;
ecStepIntoContext = ecFirstLazarus + 422;
ecStepOverContext = ecFirstLazarus + 423;
// project menu
ecNewProject = ecFirstLazarus + 500;

View File

@ -7799,59 +7799,6 @@ LazarusResources.Add('menu_stepover','PNG',[
+#174'<'#155#254#141#177'&0E'#184'l'#157#227#249#233'$'#166#167#167#30#221#198
+#255#229#235'7>oE;>'#0#0#0#0'IEND'#174'B`'#130
]);
LazarusResources.Add('menu_stepinto_instr','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#6#0#0#0#31#243#255'a'
+#0#0#0#1'sRGB'#0#174#206#28#233#0#0#0#4'gAMA'#0#0#177#143#11#252'a'#5#0#0#0#9
+'pHYs'#0#0#14#195#0#0#14#195#1#199'o'#168'd'#0#0#0#6'bKGD'#0#216#0#234#0#199
+#225#179#141#130#0#0#0#7'tIME'#7#216#9#9#16#28'2p'''#182#180#0#0#1#195'IDAT8'
+'O'#149'RK/'#3'Q'#20#254#230'AU4'#132#144'Xk"'#22'V,'#132#133'G'#196#150'DCX'
+'H'#237'X'#16'Bl'#136#180#18#18#255#128'x$'#162#11'?'#128#133'W'#217#208'=!'
+#22#237#206'#'#222#173'VM3'#211#25#247#158'jM['#207'/'#249'2'''#247'~'#231
+#220's'#190'3'#194#197#157#207#0'Cei'#29'|'#190'c'#30#254#15#231#183'G'#198
+#201#245#161#193#177#239#221#163#239'_'#193#245'bUY='#170#203#27#233'UEQ'#16
+#139'}'#207'@ '#0'A'#16'H'#195#30'!'#189'xp'#177#129#221#179#245'T'#129'd'
+#255#150'<+2i'#183#219#233':'#30#143#167#244'b0'#242#128#208#235'cV'#129#232
+'k'#4'fnmn'#194#239#247#147'N'#146#164'O'#189'y'#222#250'1'#217'P'#148#183#31
+#201'2'#233'^'#215'uceu'#217#144#151#246#167#160#197'U'#12#182#205#195#209'4'
+#128#150'I'#27#188#179#225#212'&,='#189'Y[QU'#21#185#185#22#242'@'#142#188
+#133#168#0#7#143'[k'#28'iE'#162#158#132'?'#28#162'('#2#214'|'#200#178#252#233
+#1'O'#226#156#244'8'#16#137#190#176#248#5#181#149#205'T'#196'</'#143#173','
+#217#252#229#219#16'&'#214#218#13'MS'#169#139'L'#250#175'Nq'#164#15'e'#141#16
+'v'#187'PP`'#131#203'='#205'F'#136'&F'#200#228#229'}'#0#219#174''''#132#217
+#190#249#206#205#20'u'#250'y'#201#3#129'o!'#249'D'#231'\'#5#21'z'#8#221'`w&h'
+'Jb'#214''#20'a'#17#197#133#133'E'#24#25#29'F'#194#141#15'$'#253#216'q'#7
+#193#182#196'7Fb'#219#194'b'#218#24#247'N'#231#215#29'4'#140#231'`'#199#253
+#156#209'2'#160'iZ'#218#153'$'#137'(..'#129#179#191#143'ZK'#161#171#219'A?'
+#200'_'#200#147#184'>'#205#131#142#142#246','#199';x'#7#21#133#216#228'['
+#164'T'#160#0#0#0#0'IEND'#174'B`'#130
]);
LazarusResources.Add('menu_stepover_instr','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#6#0#0#0#31#243#255'a'
+#0#0#0#1'sRGB'#0#174#206#28#233#0#0#0#4'gAMA'#0#0#177#143#11#252'a'#5#0#0#0#9
+'pHYs'#0#0#14#195#0#0#14#195#1#199'o'#168'd'#0#0#0#6'bKGD'#0#216#0#234#0#199
+#225#179#141#130#0#0#0#7'tIME'#7#216#9#9#16#29'5'#247'X'#18'V'#0#0#1#230'IDA'
+'T8O'#141'S=K#Q'#20'=/1'#163#22'&ZX'#153'26'#138#129'm'#212'B'#27'u'#17#178
+#130'6'#178#1'A-'#4#193#181'r'#183'S'#20#11'5'#130'AK'#247#15#136#187#11#154
+'N'#173#172'dw'#193#157'E'#16'#'#152'D'#193#175#201'$o&'#241#221#151#188#201
+#196'(z'#225'p'#239#12#247#157'w?'#206'c'#5'a('#217#209#209#161#10#223#239
+#137'@'#217'~|'#207#253#249'fL'#249#236#248#252'W'#129'[9X6'#7'yn'#139#216#18
+#177#240#131#237#147#21#149'\\$'#16#10#133'`'#154#25'hZ-~'#252#220#133#199
+#204#25'0s'#25#1#242#6#178#174#184#182#174#30#10'DL'#135#201'l'#219#150#222
+'4M"'#200#136'C'#6#250#219#198'p'#243'['#195#199#182'qD'#194'S'#24#10'O'#195
+'x|pp'#185#179#3']'#215#229'A'#175#215#235'&('#222#172#24'U'#205#148#228#198
+#192'@?'#130#193#150#138#150#168#130#26#170#192#18#189'?''P'#153#155'['#155
+'U'#27#225#156#203#25'H'#2'*'#159#6#246#26#193#228'Dy'#144'T'#209#151#153'Y'
+#248'|'#190#151'['#200'fM'#244#205'7T'#220'H'#135'<'#30#15#24'c'#168#19#131
+'$S'#158#242#229#16#9#170#130'H'#215'X'#21#201'Zl'#21#177#245'5,.-H'#220#221
+#221':'#249'b'#6#134#208'@'#185#133'<7'#208#27#254'$I'#226'+'#247'2'#241#235
+#220'7'#144'`'#21#242#249#162'xKk,'#234'`'#241'{'#20#222#246#255'%=d'#240#161
+#181#199#169#132'1j'#161#8'j'#167'P'#200#187#8'xYD'#207'E'#21'j'#233#144'$'
+#13'~?'#252#129#0#2#141#141#2'M'#224#220'*'#19',G'#183#29#21'*E'#210'f('#214
+#19''''#178#141#235't'#26#233'T'#10#169'd'#18#201#171'+Q'#5's'#8#152#251'5~'
+#142#142'B'#235'<'#149'o'#225'<'#249#15#7#27'\&'#186#30#172#179'!'#218#10#229
+'W'#16#140#140#12'C'#235#254#139'D'#250#12#205'z'#164'J@/'#253'x'#2#226#246
+'{J'#180'<'#162'h'#0#0#0#0'IEND'#174'B`'#130
]);
LazarusResources.Add('menu_stepout','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#6#0#0#0#31#243#255'a'
+#0#0#0#1'sRGB'#0#174#206#28#233#0#0#0#6'bKGD'#0#255#0#255#0#255#160#189#167

View File

@ -93,8 +93,6 @@ menu/menu_search_replace.png
menu/menu_select_all.png
menu/menu_stepinto.png
menu/menu_stepover.png
menu/menu_stepinto_instr.png
menu/menu_stepover_instr.png
menu/menu_stepout.png
menu/menu_stop.png
menu/menu_tool_check_lfm.png