diff --git a/debugger/frames/debugger_general_options.pas b/debugger/frames/debugger_general_options.pas index 2d977b4bca..13d2c98808 100644 --- a/debugger/frames/debugger_general_options.pas +++ b/debugger/frames/debugger_general_options.pas @@ -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], diff --git a/ide/debugmanager.pas b/ide/debugmanager.pas index 6b712ad2b6..d87e212b49 100644 --- a/ide/debugmanager.pas +++ b/ide/debugmanager.pas @@ -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); diff --git a/ide/environmentopts.pp b/ide/environmentopts.pp index ee00857118..6a1a5f50d9 100644 --- a/ide/environmentopts.pp +++ b/ide/environmentopts.pp @@ -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); diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 25051024cb..d1ce478f31 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -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';