mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-21 16:59:36 +02:00
IDE: prevent debugger from entering invalid state, if started again before completely stopped. For info see issue #0023800
git-svn-id: trunk@40097 -
This commit is contained in:
parent
c788e63327
commit
2e47a30822
@ -137,6 +137,7 @@ type
|
|||||||
procedure SetupMainBarShortCuts; virtual; abstract;
|
procedure SetupMainBarShortCuts; virtual; abstract;
|
||||||
procedure SetupSourceMenuShortCuts; virtual; abstract;
|
procedure SetupSourceMenuShortCuts; virtual; abstract;
|
||||||
procedure UpdateButtonsAndMenuItems; virtual; abstract;
|
procedure UpdateButtonsAndMenuItems; virtual; abstract;
|
||||||
|
procedure UpdateToolStatus; virtual; abstract;
|
||||||
|
|
||||||
procedure LoadProjectSpecificInfo(XMLConfig: TXMLConfig;
|
procedure LoadProjectSpecificInfo(XMLConfig: TXMLConfig;
|
||||||
Merge: boolean); virtual; abstract;
|
Merge: boolean); virtual; abstract;
|
||||||
|
@ -172,6 +172,7 @@ type
|
|||||||
procedure SetupMainBarShortCuts; override;
|
procedure SetupMainBarShortCuts; override;
|
||||||
procedure SetupSourceMenuShortCuts; override;
|
procedure SetupSourceMenuShortCuts; override;
|
||||||
procedure UpdateButtonsAndMenuItems; override;
|
procedure UpdateButtonsAndMenuItems; override;
|
||||||
|
procedure UpdateToolStatus; override;
|
||||||
|
|
||||||
procedure LoadProjectSpecificInfo(XMLConfig: TXMLConfig;
|
procedure LoadProjectSpecificInfo(XMLConfig: TXMLConfig;
|
||||||
Merge: boolean); override;
|
Merge: boolean); override;
|
||||||
@ -1039,12 +1040,8 @@ procedure TDebugManager.DebuggerChangeState(ADebugger: TDebugger;
|
|||||||
FDialogs[DialogType].EndUpdate;
|
FDialogs[DialogType].EndUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
const
|
//const
|
||||||
// dsNone, dsIdle, dsStop, dsPause, dsInit, dsRun, dsError
|
// dsNone, dsIdle, dsStop, dsPause, dsInit, dsRun, dsError
|
||||||
TOOLSTATEMAP: array[TDBGState] of TIDEToolStatus = (
|
|
||||||
//dsNone, dsIdle, dsStop, dsPause, dsInternalPause, dsInit, dsRun, dsError, dsDestroying
|
|
||||||
itNone, itNone, itDebugger, itDebugger, itDebugger, itDebugger, itDebugger, itNone, itNone
|
|
||||||
);
|
|
||||||
//STATENAME: array[TDBGState] of string = (
|
//STATENAME: array[TDBGState] of string = (
|
||||||
// 'dsNone', 'dsIdle', 'dsStop', 'dsPause', 'dsInit', 'dsRun', 'dsError'
|
// 'dsNone', 'dsIdle', 'dsStop', 'dsPause', 'dsInit', 'dsRun', 'dsError'
|
||||||
//);
|
//);
|
||||||
@ -1100,8 +1097,7 @@ begin
|
|||||||
|
|
||||||
UpdateButtonsAndMenuItems;
|
UpdateButtonsAndMenuItems;
|
||||||
// Next may call ResetDebugger, then FDebugger is gone
|
// Next may call ResetDebugger, then FDebugger is gone
|
||||||
if MainIDE.ToolStatus in [itNone,itDebugger]
|
UpdateToolStatus;
|
||||||
then MainIDE.ToolStatus := TOOLSTATEMAP[FDebugger.State];
|
|
||||||
|
|
||||||
FAutoContinueTimer.Enabled := false;
|
FAutoContinueTimer.Enabled := false;
|
||||||
|
|
||||||
@ -1194,7 +1190,7 @@ begin
|
|||||||
if EnvironmentOptions.DebuggerResetAfterRun then
|
if EnvironmentOptions.DebuggerResetAfterRun then
|
||||||
ResetDebugger
|
ResetDebugger
|
||||||
else
|
else
|
||||||
FDebugger.FileName := '';
|
FDebugger.FileName := ''; // SetState(dsIdle) via ResetStateToIdle
|
||||||
|
|
||||||
if FDialogs[ddtAssembler] <> nil
|
if FDialogs[ddtAssembler] <> nil
|
||||||
then TAssemblerDlg(FDialogs[ddtAssembler]).SetLocation(nil, 0);
|
then TAssemblerDlg(FDialogs[ddtAssembler]).SetLocation(nil, 0);
|
||||||
@ -1862,6 +1858,23 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TDebugManager.UpdateToolStatus;
|
||||||
|
const
|
||||||
|
TOOLSTATEMAP: array[TDBGState] of TIDEToolStatus = (
|
||||||
|
//dsNone, dsIdle, dsStop, dsPause, dsInternalPause, dsInit, dsRun, dsError, dsDestroying
|
||||||
|
itNone, itNone, itDebugger, itDebugger, itDebugger, itDebugger, itDebugger, itNone, itNone
|
||||||
|
);
|
||||||
|
begin
|
||||||
|
// Next may call ResetDebugger, then FDebugger is gone
|
||||||
|
if MainIDE.ToolStatus in [itNone,itDebugger]
|
||||||
|
then begin
|
||||||
|
if FDebugger = nil then
|
||||||
|
MainIDE.ToolStatus := itNone
|
||||||
|
else
|
||||||
|
MainIDE.ToolStatus := TOOLSTATEMAP[FDebugger.State];
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
procedure TDebugManager.LoadProjectSpecificInfo(XMLConfig: TXMLConfig;
|
procedure TDebugManager.LoadProjectSpecificInfo(XMLConfig: TXMLConfig;
|
||||||
Merge: boolean);
|
Merge: boolean);
|
||||||
|
@ -7004,6 +7004,7 @@ var
|
|||||||
TargetExeDirectory: String;
|
TargetExeDirectory: String;
|
||||||
FPCVersion, FPCRelease, FPCPatch: integer;
|
FPCVersion, FPCRelease, FPCPatch: integer;
|
||||||
Note: String;
|
Note: String;
|
||||||
|
OldToolStatus: TIDEToolStatus;
|
||||||
begin
|
begin
|
||||||
if (Project1=nil) or (Project1.MainUnitInfo=nil) then begin
|
if (Project1=nil) or (Project1.MainUnitInfo=nil) then begin
|
||||||
// this project has no source to compile
|
// this project has no source to compile
|
||||||
@ -7214,6 +7215,7 @@ begin
|
|||||||
and (not (pbfDoNotCompileProject in Flags)) then begin
|
and (not (pbfDoNotCompileProject in Flags)) then begin
|
||||||
try
|
try
|
||||||
// change tool status
|
// change tool status
|
||||||
|
OldToolStatus := ToolStatus; // It can still be itDebugger, if the debugger is still stopping. Prevent any "Run" command after building, until the debugger is clear
|
||||||
ToolStatus:=itBuilder;
|
ToolStatus:=itBuilder;
|
||||||
|
|
||||||
ConnectOutputFilter;
|
ConnectOutputFilter;
|
||||||
@ -7267,6 +7269,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
finally
|
finally
|
||||||
|
if OldToolStatus = itDebugger then begin
|
||||||
|
ToolStatus := OldToolStatus;
|
||||||
|
if DebugBoss <> nil then
|
||||||
|
DebugBoss.UpdateToolStatus; // Maybe "Reset Debugger was called and changed the state?
|
||||||
|
end
|
||||||
|
else
|
||||||
ToolStatus:=itNone;
|
ToolStatus:=itNone;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user