Debugger: Option to autoclose the asm window, if it was auto-opened (break at no source line). Issue #027800

git-svn-id: trunk@58522 -
This commit is contained in:
martin 2018-07-14 20:34:45 +00:00
parent 82ab3151e0
commit 62434fa788
4 changed files with 24 additions and 1 deletions

View File

@ -166,6 +166,7 @@ begin
// IMPORTANT if more items are added the indexes must be updated here!
gcbDebuggerGeneralOptions.Checked[0] := EnvironmentOptions.DebuggerShowStopMessage;
gcbDebuggerGeneralOptions.Checked[1] := EnvironmentOptions.DebuggerResetAfterRun;
gcbDebuggerGeneralOptions.Checked[2] := EnvironmentOptions.DebuggerAutoCloseAsm;
end;
procedure TDebuggerGeneralOptionsFrame.FetchDebuggerSpecificOptions;
@ -333,6 +334,7 @@ begin
gcbDebuggerGeneralOptions.Caption := lisDebugOptionsFrmDebuggerGeneralOptions;
gcbDebuggerGeneralOptions.Items.Add(lisDebugOptionsFrmShowMessageOnStop);
gcbDebuggerGeneralOptions.Items.Add(lisDebugOptionsFrmResetDebuggerOnEachRun);
gcbDebuggerGeneralOptions.Items.Add(lisDebugOptionsFrmAutoCloseAsm);
gbDebuggerSpecific.Caption := lisDebugOptionsFrmDebuggerSpecific;
end;
@ -364,6 +366,7 @@ begin
// IMPORTANT if more items are added the indexes must be updated here!
DebuggerShowStopMessage := gcbDebuggerGeneralOptions.Checked[0];
DebuggerResetAfterRun := gcbDebuggerGeneralOptions.Checked[1];
DebuggerAutoCloseAsm := gcbDebuggerGeneralOptions.Checked[2];
for i := 0 to FCurrentDebPropertiesList.Count - 1 do
SaveDebuggerProperties(FCurrentDebPropertiesList[i],

View File

@ -95,6 +95,7 @@ type
function DoProjectClose(Sender: TObject; AProject: TLazProject): TModalResult;
procedure DoProjectModified(Sender: TObject);
private
FAsmWindowShouldAutoClose: Boolean;
procedure BreakAutoContinueTimer(Sender: TObject);
procedure OnRunTimer(Sender: TObject);
// Menu events
@ -1423,7 +1424,11 @@ begin
FDebugger.FileName := ''; // SetState(dsIdle) via ResetStateToIdle
if FDialogs[ddtAssembler] <> nil
then TAssemblerDlg(FDialogs[ddtAssembler]).SetLocation(nil, 0);
then begin
TAssemblerDlg(FDialogs[ddtAssembler]).SetLocation(nil, 0);
if FAsmWindowShouldAutoClose then
TAssemblerDlg(FDialogs[ddtAssembler]).Close;
end;
end;
end;
dsInit: begin
@ -1453,6 +1458,7 @@ var
StackEntry: TIdeCallStackEntry;
Flags: TJumpToCodePosFlags;
CurrentSourceUnitInfo: TDebuggerUnitInfo;
a: Boolean;
begin
if (Sender<>FDebugger) or (Sender=nil) then exit;
if FDebugger.State = dsInternalPause then exit;
@ -1463,12 +1469,14 @@ begin
CurrentSourceUnitInfo := nil;
if (SrcLine < 1) and (SrcLine <> -2) // TODO: this should move to the debugger
// SrcLine will be -2 after stepping (gdbmi)
then begin
// jump to the deepest stack frame with debugging info
// TODO: Only below the frame supplied by debugger
i:=0;
TId := Threads.CurrentThreads.CurrentThreadId;
c := CallStack.CurrentCallStackList.EntriesForThreads[TId].CountLimited(30);
c := -1;
while (i < c) do
begin
StackEntry := CallStack.CurrentCallStackList.EntriesForThreads[TId].Entries[i];
@ -1529,9 +1537,13 @@ begin
if SrcLine < 1
then begin
a := FAsmWindowShouldAutoClose or (FDialogs[ddtAssembler] = nil) or (not FDialogs[ddtAssembler].Visible);
ViewDebugDialog(ddtAssembler);
FAsmWindowShouldAutoClose := a and EnvironmentOptions.DebuggerAutoCloseAsm;
exit;
end;
if (FDialogs[ddtAssembler] <> nil) and FAsmWindowShouldAutoClose then
TAssemblerDlg(FDialogs[ddtAssembler]).Close;
Editor := nil;
if SourceEditorManager <> nil
@ -1602,6 +1614,8 @@ begin
if Destroying then exit;
if (ADialogType = ddtPseudoTerminal) and not HasConsoleSupport
then exit;
if ADialogType = ddtAssembler then
FAsmWindowShouldAutoClose := False;
if FDialogs[ADialogType] = nil
then begin
CurDialog := TDebuggerDlg(DEBUGDIALOGCLASS[ADialogType].NewInstance);

View File

@ -456,6 +456,7 @@ type
TEnvironmentOptions = class(TIDEEnvironmentOptions)
private
FDebuggerAutoCloseAsm: boolean;
// config file
FFilename: string;
FFileAge: longint;
@ -797,6 +798,7 @@ type
property DebuggerSearchPath: string read GetDebuggerSearchPath write SetDebuggerSearchPath;
property DebuggerShowStopMessage: boolean read FDebuggerShowStopMessage write FDebuggerShowStopMessage;
property DebuggerResetAfterRun: boolean read FDebuggerResetAfterRun write FDebuggerResetAfterRun;
property DebuggerAutoCloseAsm: boolean read FDebuggerAutoCloseAsm write FDebuggerAutoCloseAsm;
// ShowCompileDialog and AutoCloseCompileDialog are currently not used.
// But maybe someone will implement them again. Keep them till 1.4.2
property ShowCompileDialog: boolean read FShowCompileDialog write FShowCompileDialog;
@ -1955,6 +1957,7 @@ begin
// Debugger General Options
DebuggerShowStopMessage:=FXMLCfg.GetValue(Path+'DebuggerOptions/ShowStopMessage/Value', True);
DebuggerResetAfterRun :=FXMLCfg.GetValue(Path+'DebuggerOptions/DebuggerResetAfterRun/Value', False);
FDebuggerAutoCloseAsm :=FXMLCfg.GetValue(Path+'DebuggerOptions/DebuggerAutoCloseAsm/Value', False);
FDebuggerEventLogClearOnRun := FXMLCfg.GetValue(Path+'Debugger/EventLogClearOnRun', True);
FDebuggerEventLogCheckLineLimit := FXMLCfg.GetValue(Path+'Debugger/EventLogCheckLineLimit', False);
FDebuggerEventLogLineLimit := FXMLCfg.GetValue(Path+'Debugger/EventLogLineLimit', 1000);
@ -2336,6 +2339,8 @@ begin
FDebuggerShowStopMessage, True);
FXMLCfg.SetDeleteValue(Path+'DebuggerOptions/DebuggerResetAfterRun/Value',
FDebuggerResetAfterRun, False);
FXMLCfg.SetDeleteValue(Path+'DebuggerOptions/DebuggerAutoCloseAsm/Value',
FDebuggerAutoCloseAsm, False);
SaveRecentList(FXMLCfg,FDebuggerFileHistory,Path+'DebuggerFilename/History/');
FXMLCfg.SetDeleteValue(Path+'DebuggerSearchPath/Value',DebuggerSearchPath,'');
FXMLCfg.SetDeleteValue(Path+'Debugger/EventLogClearOnRun',FDebuggerEventLogClearOnRun, True);

View File

@ -5259,6 +5259,7 @@ resourcestring
lisDebugOptionsFrmDebuggerGeneralOptions = 'Debugger general options';
lisDebugOptionsFrmShowMessageOnStop = 'Show message on stop';
lisDebugOptionsFrmResetDebuggerOnEachRun = 'Reset Debugger after each run';
lisDebugOptionsFrmAutoCloseAsm = 'Automatically close the assembler window, after source not found';
lisDebugOptionsFrmDebuggerSpecific = 'Debugger specific options (depends on '
+'type of debugger)';
lisDebugOptionsFrmEventLog = 'Event Log';