mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 05:29:29 +02:00
IDE: debugging: DoRUnProject: only start debugger, run debugger on timer so that the loop does not hold the LCL component that processed the event
git-svn-id: trunk@23235 -
This commit is contained in:
parent
d8faa4f504
commit
7312388f96
@ -49,7 +49,9 @@ type
|
|||||||
TDebugManagerState = (
|
TDebugManagerState = (
|
||||||
dmsInitializingDebuggerObject,
|
dmsInitializingDebuggerObject,
|
||||||
dmsInitializingDebuggerObjectFailed,
|
dmsInitializingDebuggerObjectFailed,
|
||||||
dmsDebuggerObjectBroken // the debugger entered the error state
|
dmsDebuggerObjectBroken, // the debugger entered the error state
|
||||||
|
dmsWaitForRun, // waiting for call to RunDebugger, set by StartDebugging
|
||||||
|
dmsRunning // set by RunDebugger
|
||||||
);
|
);
|
||||||
TDebugManagerStates = set of TDebugManagerState;
|
TDebugManagerStates = set of TDebugManagerState;
|
||||||
|
|
||||||
@ -107,7 +109,8 @@ type
|
|||||||
procedure DoToggleCallStack; virtual; abstract;
|
procedure DoToggleCallStack; virtual; abstract;
|
||||||
procedure ProcessCommand(Command: word; var Handled: boolean); virtual; abstract;
|
procedure ProcessCommand(Command: word; var Handled: boolean); virtual; abstract;
|
||||||
|
|
||||||
function RunDebugger: TModalResult; virtual; abstract;
|
function StartDebugging: TModalResult; virtual; abstract; // set ToolStatus to itDebugger, but do not run debugger yet
|
||||||
|
function RunDebugger: TModalResult; virtual; abstract; // run program, wait until program ends
|
||||||
procedure EndDebugging; virtual; abstract;
|
procedure EndDebugging; virtual; abstract;
|
||||||
|
|
||||||
function Evaluate(const AExpression: String; var AResult: String;
|
function Evaluate(const AExpression: String; var AResult: String;
|
||||||
|
@ -76,6 +76,7 @@ type
|
|||||||
|
|
||||||
TDebugManager = class(TBaseDebugManager)
|
TDebugManager = class(TBaseDebugManager)
|
||||||
procedure BreakAutoContinueTimer(Sender: TObject);
|
procedure BreakAutoContinueTimer(Sender: TObject);
|
||||||
|
procedure OnRunTimer(Sender: TObject);
|
||||||
// Menu events
|
// Menu events
|
||||||
procedure mnuViewDebugDialogClick(Sender: TObject);
|
procedure mnuViewDebugDialogClick(Sender: TObject);
|
||||||
procedure mnuResetDebuggerClicked(Sender: TObject);
|
procedure mnuResetDebuggerClicked(Sender: TObject);
|
||||||
@ -110,6 +111,8 @@ type
|
|||||||
// when the debug output log is not open, store the debug log internally
|
// when the debug output log is not open, store the debug log internally
|
||||||
FHiddenDebugOutputLog: TStringList;
|
FHiddenDebugOutputLog: TStringList;
|
||||||
|
|
||||||
|
FRunTimer: TTimer;
|
||||||
|
|
||||||
procedure SetDebugger(const ADebugger: TDebugger);
|
procedure SetDebugger(const ADebugger: TDebugger);
|
||||||
|
|
||||||
// Breakpoint routines
|
// Breakpoint routines
|
||||||
@ -164,7 +167,8 @@ type
|
|||||||
procedure DoToggleCallStack; override;
|
procedure DoToggleCallStack; override;
|
||||||
procedure ProcessCommand(Command: word; var Handled: boolean); override;
|
procedure ProcessCommand(Command: word; var Handled: boolean); override;
|
||||||
|
|
||||||
function RunDebugger: TModalResult; override;
|
function StartDebugging: TModalResult; override; // returns immediately
|
||||||
|
function RunDebugger: TModalResult; override; // waits till program ends
|
||||||
procedure EndDebugging; override;
|
procedure EndDebugging; override;
|
||||||
function Evaluate(const AExpression: String; var AResult: String;
|
function Evaluate(const AExpression: String; var AResult: String;
|
||||||
var ATypeInfo: TDBGType): Boolean; override;
|
var ATypeInfo: TDBGType): Boolean; override;
|
||||||
@ -1320,6 +1324,13 @@ begin
|
|||||||
FDebugger.Run;
|
FDebugger.Run;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TDebugManager.OnRunTimer(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FRunTimer.Enabled:=false;
|
||||||
|
if dmsWaitForRun in FManagerStates then
|
||||||
|
RunDebugger;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TDebugManager.DebuggerBreakPointHit(ADebugger: TDebugger;
|
procedure TDebugManager.DebuggerBreakPointHit(ADebugger: TDebugger;
|
||||||
ABreakPoint: TBaseBreakPoint; var ACanContinue: Boolean);
|
ABreakPoint: TBaseBreakPoint; var ACanContinue: Boolean);
|
||||||
begin
|
begin
|
||||||
@ -1825,6 +1836,9 @@ begin
|
|||||||
FAutoContinueTimer := TTimer.Create(Self);
|
FAutoContinueTimer := TTimer.Create(Self);
|
||||||
FAutoContinueTimer.Enabled := False;
|
FAutoContinueTimer.Enabled := False;
|
||||||
FAutoContinueTimer.OnTimer := @BreakAutoContinueTimer;
|
FAutoContinueTimer.OnTimer := @BreakAutoContinueTimer;
|
||||||
|
FRunTimer := TTimer.Create(Self);
|
||||||
|
FRunTimer.Interval := 1;
|
||||||
|
FRunTimer.OnTimer := @OnRunTimer;
|
||||||
|
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
end;
|
end;
|
||||||
@ -2359,18 +2373,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDebugManager.RunDebugger: TModalResult;
|
function TDebugManager.StartDebugging: TModalResult;
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseDebugger}
|
{$ifdef VerboseDebugger}
|
||||||
DebugLn('TDebugManager.RunDebugger A ',DbgS(FDebugger<>nil),' Destroying=',DbgS(Destroying));
|
DebugLn('TDebugManager.StartDebugging A ',DbgS(FDebugger<>nil),' Destroying=',DbgS(Destroying));
|
||||||
{$endif}
|
{$endif}
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
if Destroying then exit;
|
if Destroying then exit;
|
||||||
|
if [dmsWaitForRun,dmsRunning]*FManagerStates<>[] then exit;
|
||||||
if (FDebugger <> nil) then
|
if (FDebugger <> nil) then
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseDebugger}
|
{$ifdef VerboseDebugger}
|
||||||
DebugLn('TDebugManager.RunDebugger B ',FDebugger.ClassName);
|
DebugLn('TDebugManager.StartDebugging B ',FDebugger.ClassName);
|
||||||
{$endif}
|
{$endif}
|
||||||
// check if debugging needs restart
|
// check if debugging needs restart
|
||||||
if (dmsDebuggerObjectBroken in FManagerStates)
|
if (dmsDebuggerObjectBroken in FManagerStates)
|
||||||
and (MainIDE.ToolStatus=itDebugger) then begin
|
and (MainIDE.ToolStatus=itDebugger) then begin
|
||||||
@ -2378,13 +2393,47 @@ begin
|
|||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
FDebugger.Run;
|
Include(FManagerStates,dmsWaitForRun);
|
||||||
|
FRunTimer.Enabled:=true;
|
||||||
|
Result:=mrOk;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TDebugManager.RunDebugger: TModalResult;
|
||||||
|
begin
|
||||||
|
{$ifdef VerboseDebugger}
|
||||||
|
DebugLn('TDebugManager.RunDebugger A ',DbgS(FDebugger<>nil),' Destroying=',DbgS(Destroying));
|
||||||
|
{$endif}
|
||||||
|
Result:=mrCancel;
|
||||||
|
if Destroying then exit;
|
||||||
|
Exclude(FManagerStates,dmsWaitForRun);
|
||||||
|
if dmsRunning in FManagerStates then exit;
|
||||||
|
if MainIDE.ToolStatus<>itDebugger then exit;
|
||||||
|
if (FDebugger <> nil) then
|
||||||
|
begin
|
||||||
|
{$ifdef VerboseDebugger}
|
||||||
|
DebugLn('TDebugManager.RunDebugger B ',FDebugger.ClassName);
|
||||||
|
{$endif}
|
||||||
|
// check if debugging needs restart
|
||||||
|
if (dmsDebuggerObjectBroken in FManagerStates)
|
||||||
|
and (MainIDE.ToolStatus=itDebugger) then begin
|
||||||
|
MainIDE.ToolStatus:=itNone;
|
||||||
|
Result:=mrCancel;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
Include(FManagerStates,dmsRunning);
|
||||||
|
try
|
||||||
|
FDebugger.Run;
|
||||||
|
finally
|
||||||
|
Exclude(FManagerStates,dmsRunning);
|
||||||
|
end;
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDebugManager.EndDebugging;
|
procedure TDebugManager.EndDebugging;
|
||||||
begin
|
begin
|
||||||
|
Exclude(FManagerStates,dmsWaitForRun);
|
||||||
if FDebugger <> nil then FDebugger.Done;
|
if FDebugger <> nil then FDebugger.Done;
|
||||||
// if not already freed
|
// if not already freed
|
||||||
FreeDebugger;
|
FreeDebugger;
|
||||||
|
@ -10250,7 +10250,7 @@ begin
|
|||||||
|
|
||||||
Result := mrCancel;
|
Result := mrCancel;
|
||||||
|
|
||||||
Result := DebugBoss.RunDebugger;
|
Result := DebugBoss.StartDebugging;
|
||||||
// if Result<>mrOk then exit;
|
// if Result<>mrOk then exit;
|
||||||
|
|
||||||
DebugLn('[TMainIDE.DoRunProject] END');
|
DebugLn('[TMainIDE.DoRunProject] END');
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
TTreeView for LCL
|
TTreeView for LCL
|
||||||
|
|
||||||
ToDo:
|
ToDo:
|
||||||
- Editing
|
|
||||||
- Columns
|
- Columns
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user