mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 18:19:08 +02:00
DBG: move same debugln to LazLogger cmd-line config
git-svn-id: trunk@35316 -
This commit is contained in:
parent
ce0d3e2bc4
commit
94bee9379a
@ -34,14 +34,13 @@ unit GDBMIDebugger;
|
|||||||
{$mode objfpc}
|
{$mode objfpc}
|
||||||
{$H+}
|
{$H+}
|
||||||
|
|
||||||
{$IFDEF GDMI_QUEUE_DEBUG}{$DEFINE DBGMI_QUEUE_DEBUG}{$ENDIF} // temporary, since renamed/spelling
|
|
||||||
{$IFDEF linux} {$DEFINE DBG_ENABLE_TERMINAL} {$ENDIF}
|
{$IFDEF linux} {$DEFINE DBG_ENABLE_TERMINAL} {$ENDIF}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Controls, Math, Variants, LCLProc, Dialogs, DebugUtils,
|
Classes, SysUtils, Controls, Math, Variants, LCLProc, LazLogger, Dialogs,
|
||||||
Debugger, FileUtil, CmdLineDebugger, GDBTypeInfo, Maps, LCLIntf,
|
DebugUtils, Debugger, FileUtil, CmdLineDebugger, GDBTypeInfo, Maps, LCLIntf,
|
||||||
{$IFdef MSWindows}
|
{$IFdef MSWindows}
|
||||||
Windows,
|
Windows,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -549,6 +548,10 @@ resourcestring
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
var
|
||||||
|
DBGMI_QUEUE_DEBUG: PLazLoggerLogGroup;
|
||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
GDBMIBreakPointReasonNames: Array[TGDBMIBreakpointReason] of string =
|
GDBMIBreakPointReasonNames: Array[TGDBMIBreakpointReason] of string =
|
||||||
('Breakpoint', 'Watchpoint', 'Watchpoint (scope)');
|
('Breakpoint', 'Watchpoint', 'Watchpoint (scope)');
|
||||||
@ -1930,9 +1933,7 @@ end;
|
|||||||
|
|
||||||
procedure TGDBMIDebuggerCommandStack.DoCallstackFreed(Sender: TObject);
|
procedure TGDBMIDebuggerCommandStack.DoCallstackFreed(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
{$IFDEF DBGMI_QUEUE_DEBUG}
|
debugln(DBGMI_QUEUE_DEBUG, ['DoCallstackFreed: ', DebugText]);
|
||||||
debugln(['DoCallstackFreed: ', DebugText]);
|
|
||||||
{$ENDIF}
|
|
||||||
FCallstack := nil;
|
FCallstack := nil;
|
||||||
Cancel;
|
Cancel;
|
||||||
end;
|
end;
|
||||||
@ -5381,9 +5382,7 @@ begin
|
|||||||
// - Queue is unlocked, so nothing should be empty
|
// - Queue is unlocked, so nothing should be empty
|
||||||
// But make info available, if anything wants to queue
|
// But make info available, if anything wants to queue
|
||||||
FNextExecQueued := True;
|
FNextExecQueued := True;
|
||||||
{$IFDEF DBGMI_QUEUE_DEBUG}
|
debugln(DBGMI_QUEUE_DEBUG, ['CommandExecute: Internal queuing -exec-continue (ContinueExecution = True)']);
|
||||||
DebugLn(['CommandExecute: Internal queuing -exec-continue (ContinueExecution = True)']);
|
|
||||||
{$ENDIF}
|
|
||||||
FTheDebugger.FPauseWaitState := pwsNone;
|
FTheDebugger.FPauseWaitState := pwsNone;
|
||||||
NextExecCmdObj := TGDBMIDebuggerCommandExecute.Create(FTheDebugger, ectContinue);
|
NextExecCmdObj := TGDBMIDebuggerCommandExecute.Create(FTheDebugger, ectContinue);
|
||||||
FTheDebugger.QueueExecuteLock; // force queue
|
FTheDebugger.QueueExecuteLock; // force queue
|
||||||
@ -6238,10 +6237,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGDBMIDebugger.UnLockCommandProcessing;
|
procedure TGDBMIDebugger.UnLockCommandProcessing;
|
||||||
{$IFDEF DBGMI_QUEUE_DEBUG}
|
|
||||||
var
|
var
|
||||||
c: Boolean;
|
c: Boolean;
|
||||||
{$ENDIF}
|
|
||||||
begin
|
begin
|
||||||
dec(FCommandProcessingLock);
|
dec(FCommandProcessingLock);
|
||||||
if (FCommandProcessingLock = 0)
|
if (FCommandProcessingLock = 0)
|
||||||
@ -6251,14 +6248,10 @@ begin
|
|||||||
// if FCommandQueueExecLock, then queu will be run, by however has that lock
|
// if FCommandQueueExecLock, then queu will be run, by however has that lock
|
||||||
if (FCommandQueueExecLock = 0)
|
if (FCommandQueueExecLock = 0)
|
||||||
then begin
|
then begin
|
||||||
{$IFDEF DBGMI_QUEUE_DEBUG}
|
|
||||||
c := FCommandQueue.Count > 0;
|
c := FCommandQueue.Count > 0;
|
||||||
if c then DebugLnEnter(['TGDBMIDebugger.UnLockCommandProcessing: Execute RunQueue ']);
|
if c then DebugLnEnter(DBGMI_QUEUE_DEBUG, ['TGDBMIDebugger.UnLockCommandProcessing: Execute RunQueue ']);
|
||||||
{$ENDIF}
|
|
||||||
RunQueue;
|
RunQueue;
|
||||||
{$IFDEF DBGMI_QUEUE_DEBUG}
|
if c then DebugLnExit(DBGMI_QUEUE_DEBUG, ['TGDBMIDebugger.UnLockCommandProcessing: Finished RunQueue']);
|
||||||
if c then DebugLnExit(['TGDBMIDebugger.UnLockCommandProcessing: Finished RunQueue']);
|
|
||||||
{$ENDIF}
|
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -6520,9 +6513,7 @@ begin
|
|||||||
Inc(FInExecuteCount);
|
Inc(FInExecuteCount);
|
||||||
|
|
||||||
FCommandQueue.Delete(0);
|
FCommandQueue.Delete(0);
|
||||||
{$IFDEF DBGMI_QUEUE_DEBUG}
|
DebugLnEnter(DBGMI_QUEUE_DEBUG, ['Executing (Recurse-Count=', FInExecuteCount-1, ') queued= ', FCommandQueue.Count, ' CmdPrior=', Cmd.Priority,' CmdMinRunLvl=', Cmd.QueueRunLevel, ' : "', Cmd.DebugText,'" State=',DBGStateNames[State],' PauseWaitState=',ord(FPauseWaitState) ]);
|
||||||
DebugLnEnter(['Executing (Recurse-Count=', FInExecuteCount-1, ') queued= ', FCommandQueue.Count, ' CmdPrior=', Cmd.Priority,' CmdMinRunLvl=', Cmd.QueueRunLevel, ' : "', Cmd.DebugText,'" State=',DBGStateNames[State],' PauseWaitState=',ord(FPauseWaitState) ]);
|
|
||||||
{$ENDIF}
|
|
||||||
// cmd may be canceled while executed => don't loose it while working with it
|
// cmd may be canceled while executed => don't loose it while working with it
|
||||||
Cmd.AddReference;
|
Cmd.AddReference;
|
||||||
NestedCurrentCmdTmp := FCurrentCommand;
|
NestedCurrentCmdTmp := FCurrentCommand;
|
||||||
@ -6532,9 +6523,7 @@ begin
|
|||||||
Cmd.DoFinished;
|
Cmd.DoFinished;
|
||||||
FCurrentCommand := NestedCurrentCmdTmp;
|
FCurrentCommand := NestedCurrentCmdTmp;
|
||||||
Cmd.ReleaseReference;
|
Cmd.ReleaseReference;
|
||||||
{$IFDEF DBGMI_QUEUE_DEBUG}
|
DebugLnExit(DBGMI_QUEUE_DEBUG, 'Exec done');
|
||||||
DebugLnExit('Exec done');
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
Dec(FInExecuteCount);
|
Dec(FInExecuteCount);
|
||||||
// Do not add code with callbacks outside "FInExecuteCount"
|
// Do not add code with callbacks outside "FInExecuteCount"
|
||||||
@ -6564,16 +6553,12 @@ begin
|
|||||||
// insert continue command
|
// insert continue command
|
||||||
Cmd := TGDBMIDebuggerCommandExecute.Create(Self, ectContinue);
|
Cmd := TGDBMIDebuggerCommandExecute.Create(Self, ectContinue);
|
||||||
FCommandQueue.Add(Cmd);
|
FCommandQueue.Add(Cmd);
|
||||||
{$IFDEF DBGMI_QUEUE_DEBUG}
|
debugln(DBGMI_QUEUE_DEBUG, ['Internal Queueing: exec-continue']);
|
||||||
debugln(['Internal Queueing: exec-continue']);
|
|
||||||
{$ENDIF}
|
|
||||||
end
|
end
|
||||||
else Break; // Queue empty
|
else Break; // Queue empty
|
||||||
end;
|
end;
|
||||||
until not R;
|
until not R;
|
||||||
{$IFDEF DBGMI_QUEUE_DEBUG}
|
debugln(DBGMI_QUEUE_DEBUG, ['Leaving Queue with count: ', FCommandQueue.Count, ' Recurse-Count=', FInExecuteCount,' State=',DBGStateNames[State]]);
|
||||||
debugln(['Leaving Queue with count: ', FCommandQueue.Count, ' Recurse-Count=', FInExecuteCount,' State=',DBGStateNames[State]]);
|
|
||||||
{$ENDIF}
|
|
||||||
finally
|
finally
|
||||||
UnlockRelease;
|
UnlockRelease;
|
||||||
FInExecuteCount := SavedInExecuteCount;
|
FInExecuteCount := SavedInExecuteCount;
|
||||||
@ -6647,9 +6632,7 @@ begin
|
|||||||
if (not CanRunQueue) or (FCommandQueueExecLock > 0)
|
if (not CanRunQueue) or (FCommandQueueExecLock > 0)
|
||||||
or (FCommandProcessingLock > 0) or ForceQueue
|
or (FCommandProcessingLock > 0) or ForceQueue
|
||||||
then begin
|
then begin
|
||||||
{$IFDEF DBGMI_QUEUE_DEBUG}
|
debugln(DBGMI_QUEUE_DEBUG, ['Queueing (Recurse-Count=', FInExecuteCount, ') at pos=', i, ' cnt=',FCommandQueue.Count-1, ' State=',DBGStateNames[State], ' Lock=',FCommandQueueExecLock, ' Forced=', dbgs(ForceQueue), ' Prior=',p, ': "', ACommand.DebugText,'"']);
|
||||||
debugln(['Queueing (Recurse-Count=', FInExecuteCount, ') at pos=', i, ' cnt=',FCommandQueue.Count-1, ' State=',DBGStateNames[State], ' Lock=',FCommandQueueExecLock, ' Forced=', dbgs(ForceQueue), ' Prior=',p, ': "', ACommand.DebugText,'"']);
|
|
||||||
{$ENDIF}
|
|
||||||
ACommand.DoQueued;
|
ACommand.DoQueued;
|
||||||
|
|
||||||
// FCommandProcessingLock still must call RunQueue
|
// FCommandProcessingLock still must call RunQueue
|
||||||
@ -7266,9 +7249,7 @@ procedure TGDBMIDebugger.InterruptTarget;
|
|||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
{$IFDEF DBGMI_QUEUE_DEBUG}
|
debugln(DBGMI_QUEUE_DEBUG, ['TGDBMIDebugger.InterruptTarget: TargetPID=', TargetPID]);
|
||||||
DebugLn(['TGDBMIDebugger.InterruptTarget: TargetPID=', TargetPID]);
|
|
||||||
{$ENDIF}
|
|
||||||
if TargetPID = 0 then Exit;
|
if TargetPID = 0 then Exit;
|
||||||
{$IFDEF UNIX}
|
{$IFDEF UNIX}
|
||||||
FpKill(TargetPID, SIGINT);
|
FpKill(TargetPID, SIGINT);
|
||||||
@ -7286,9 +7267,7 @@ begin
|
|||||||
or not TryNT
|
or not TryNT
|
||||||
then begin
|
then begin
|
||||||
// We have no other choice than trying this
|
// We have no other choice than trying this
|
||||||
{$IFDEF DBGMI_QUEUE_DEBUG}
|
debugln(DBGMI_QUEUE_DEBUG, ['TGDBMIDebugger.InterruptTarget: Send CTRL_BREAK_EVENT']);
|
||||||
DebugLn(['TGDBMIDebugger.InterruptTarget: Send CTRL_BREAK_EVENT']);
|
|
||||||
{$ENDIF}
|
|
||||||
GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, TargetPID);
|
GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, TargetPID);
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
@ -7385,9 +7364,7 @@ end;
|
|||||||
procedure TGDBMIDebugger.ResetStateToIdle;
|
procedure TGDBMIDebugger.ResetStateToIdle;
|
||||||
begin
|
begin
|
||||||
if FInExecuteCount > 0 then begin
|
if FInExecuteCount > 0 then begin
|
||||||
{$IFDEF DBGMI_QUEUE_DEBUG}
|
debugln(DBGMI_QUEUE_DEBUG, ['Defer dsIdle: Recurse-Count=', FInExecuteCount]);
|
||||||
debugln(['Defer dsIdle: Recurse-Count=', FInExecuteCount]);
|
|
||||||
{$ENDIF}
|
|
||||||
FNeedStateToIdle := True;
|
FNeedStateToIdle := True;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -10501,10 +10478,8 @@ begin
|
|||||||
i := FTheDebugger.FTypeRequestCache.IndexOf
|
i := FTheDebugger.FTypeRequestCache.IndexOf
|
||||||
(FTheDebugger.FInternalThreadId, FTheDebugger.FInternalStackFrame, AReq^);
|
(FTheDebugger.FInternalThreadId, FTheDebugger.FInternalStackFrame, AReq^);
|
||||||
if i >= 0 then begin
|
if i >= 0 then begin
|
||||||
{$IFDEF DBGMI_QUEUE_DEBUG}
|
debugln(DBGMI_QUEUE_DEBUG, ['DBG TypeRequest-Cache: Found entry for T=', FTheDebugger.FInternalThreadId,
|
||||||
DebugLn(['DBG TypeRequest-Cache: Found entry for T=', FTheDebugger.FInternalThreadId,
|
|
||||||
' F=', FTheDebugger.FInternalStackFrame, ' R="', AReq^.Request,'"']);
|
' F=', FTheDebugger.FInternalStackFrame, ' R="', AReq^.Request,'"']);
|
||||||
{$ENDIF}
|
|
||||||
CReq := FTheDebugger.FTypeRequestCache.Request[i];
|
CReq := FTheDebugger.FTypeRequestCache.Request[i];
|
||||||
AReq^.Result := CReq.Result;
|
AReq^.Result := CReq.Result;
|
||||||
AReq^.Error := CReq.Error;
|
AReq^.Error := CReq.Error;
|
||||||
@ -10835,9 +10810,7 @@ end;
|
|||||||
|
|
||||||
procedure TGDBMIDebuggerCommand.Cancel;
|
procedure TGDBMIDebuggerCommand.Cancel;
|
||||||
begin
|
begin
|
||||||
{$IFDEF DBGMI_QUEUE_DEBUG}
|
debugln(DBGMI_QUEUE_DEBUG, ['Canceling: "', DebugText,'"']);
|
||||||
DebugLn(['Canceling: "', DebugText,'"']);
|
|
||||||
{$ENDIF}
|
|
||||||
FTheDebugger.UnQueueCommand(Self);
|
FTheDebugger.UnQueueCommand(Self);
|
||||||
DoCancel;
|
DoCancel;
|
||||||
DoOnCanceled;
|
DoOnCanceled;
|
||||||
@ -11141,9 +11114,7 @@ end;
|
|||||||
|
|
||||||
procedure TGDBMIDebuggerCommandEvaluate.DoWatchFreed(Sender: TObject);
|
procedure TGDBMIDebuggerCommandEvaluate.DoWatchFreed(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
{$IFDEF DBGMI_QUEUE_DEBUG}
|
debugln(DBGMI_QUEUE_DEBUG, ['DoWatchFreed: ', DebugText]);
|
||||||
debugln(['DoWatchFreed: ', DebugText]);
|
|
||||||
{$ENDIF}
|
|
||||||
FWatchValue := nil;
|
FWatchValue := nil;
|
||||||
Cancel;
|
Cancel;
|
||||||
end;
|
end;
|
||||||
@ -12453,5 +12424,6 @@ end;
|
|||||||
|
|
||||||
initialization
|
initialization
|
||||||
RegisterDebugger(TGDBMIDebugger);
|
RegisterDebugger(TGDBMIDebugger);
|
||||||
|
DBGMI_QUEUE_DEBUG := DebugLogger.RegisterLogGroup('DBGMI_QUEUE_DEBUG' {$IFDEF DBGMI_QUEUE_DEBUG} , True {$ENDIF} );
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user