mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 18:16:06 +02:00
LazDebuggerFp: Make sure OnIdle is called, and all results are awaited. (Fixes Debug History) / DebugManager triggers snapshots for any dsPause and dsInternalPause.
This commit is contained in:
parent
edb26c9d33
commit
f99f5c0ed9
@ -34,7 +34,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, fgl, math, process,
|
||||
Forms, Dialogs, syncobjs,
|
||||
Maps, LazLogger, LazUTF8, lazCollections,
|
||||
Maps, LazLoggerBase, LazUTF8, lazCollections,
|
||||
DbgIntfBaseTypes, DbgIntfDebuggerBase,
|
||||
FpDebugDebuggerUtils, FpDebugDebuggerWorkThreads,
|
||||
// FpDebug
|
||||
@ -633,11 +633,18 @@ var
|
||||
c: LongInt;
|
||||
begin
|
||||
FpDebugger.FWorkQueue.Lock;
|
||||
Application.ProcessMessages;
|
||||
FpDebugger.CheckAndRunIdle;
|
||||
c := FpDebugger.FWorkQueue.Count;
|
||||
(* IdleThreadCount could (race condition) be to high.
|
||||
Then DebugHistory may loose ONE item. (only one working thread.
|
||||
Practically this is unlikely, since the thread had time to set
|
||||
the count, since the Lock started.
|
||||
*)
|
||||
c := FpDebugger.FWorkQueue.Count + FpDebugger.FWorkQueue.ThreadCount - FpDebugger.FWorkQueue.IdleThreadCount;
|
||||
FpDebugger.FWorkQueue.Unlock;
|
||||
|
||||
if c = 0 then begin
|
||||
Application.ProcessMessages;
|
||||
FpDebugger.StartDebugLoop;
|
||||
end
|
||||
else begin
|
||||
@ -3413,8 +3420,15 @@ begin
|
||||
if State in [dsPause, dsInternalPause] then begin
|
||||
FWorkQueue.Lock;
|
||||
CheckAndRunIdle;
|
||||
c := FWorkQueue.Count;
|
||||
(* IdleThreadCount could (race condition) be to high.
|
||||
Then DebugHistory may loose ONE item. (only one working thread.
|
||||
Practically this is unlikely, since the thread had time to set
|
||||
the count, since the Lock started.
|
||||
*)
|
||||
c := FWorkQueue.Count + FWorkQueue.ThreadCount - FWorkQueue.IdleThreadCount;
|
||||
FWorkQueue.Unlock;
|
||||
if c = 0 then
|
||||
Application.ProcessMessages;
|
||||
end
|
||||
else
|
||||
c := 0;
|
||||
@ -3464,7 +3478,7 @@ end;
|
||||
|
||||
procedure TFpDebugDebugger.CheckAndRunIdle;
|
||||
begin
|
||||
if (State <> dsPause) or
|
||||
if (not (State in [dsPause, dsInternalPause])) or
|
||||
(not Assigned(OnIdle)) or
|
||||
(FWorkQueue.Count <> 0)
|
||||
then
|
||||
|
Loading…
Reference in New Issue
Block a user