diff --git a/components/fpdebug/fpdbgcallcontextinfo.pas b/components/fpdebug/fpdbgcallcontextinfo.pas index dc63c2185e..53e07366fd 100644 --- a/components/fpdebug/fpdbgcallcontextinfo.pas +++ b/components/fpdebug/fpdbgcallcontextinfo.pas @@ -542,7 +542,7 @@ function TFpDbgInfoCallContext.AddOrdinalParam(AParamSymbolType: TFpSymbol; AVal var ParamSymbol: TFpValue; begin -debugln(['TFpDbgInfoCallContext.AddOrdinalParam ',FNextParamRegister]); + debugln(FPDBG_FUNCCALL, ['TFpDbgInfoCallContext.AddOrdinalParam ',FNextParamRegister]); Result := False; if AParamSymbolType = nil then AParamSymbolType := TFpSymbolCallParamOrdinalOrPointer.Create('', 0) diff --git a/components/fpdebug/fpdbgwinclasses.pas b/components/fpdebug/fpdbgwinclasses.pas index 1294d4c58d..3111952749 100644 --- a/components/fpdebug/fpdbgwinclasses.pas +++ b/components/fpdebug/fpdbgwinclasses.pas @@ -802,7 +802,6 @@ function TDbgWinProcess.Continue(AProcess: TDbgProcess; AThread: TDbgThread; Result := True; break; end; -debugln(['HasThreadInSkippingBreak ',Result]); end; var @@ -811,7 +810,7 @@ var WinAThread: TDbgWinThread absolute AThread; HasExceptionCleared, EventThreadNeedsTempBrkRemove: Boolean; begin -debugln(FPDBG_WINDOWS, ['TDbgWinProcess.Continue ',SingleStep, ' # ', ' # ',DbgSTime]); + debugln(FPDBG_WINDOWS, ['TDbgWinProcess.Continue ',SingleStep, ' # ', ' # ',DbgSTime]); HasExceptionCleared := (WinAThread <> nil) and WinAThread.FHasExceptionCleared; if assigned(AThread) and not FThreadMap.HasId(AThread.ID) then begin @@ -984,10 +983,10 @@ begin // we currently do not use the file handle => close it if MDebugEvent.CreateProcessInfo.hFile <> 0 then if not CloseHandle(MDebugEvent.CreateProcessInfo.hFile) then - debugln([DBG_WARNINGS, 'Failed to close new process file handle: ',GetLastErrorText]); + debugln(DBG_WARNINGS, ['Failed to close new process file handle: ',GetLastErrorText]); if _DebugActiveProcessStop <> nil then if not _DebugActiveProcessStop(MDebugEvent.dwProcessId) then - debugln([DBG_WARNINGS, 'Failed to detach: ',GetLastErrorText]); + debugln(DBG_WARNINGS, ['Failed to detach: ',GetLastErrorText]); Windows.ContinueDebugEvent(MDebugEvent.dwProcessId, MDebugEvent.dwThreadId, DBG_CONTINUE); Done := False; diff --git a/components/lazdebuggergdbmi/cmdlinedebugger.pp b/components/lazdebuggergdbmi/cmdlinedebugger.pp index f2da9c7845..c2575762aa 100644 --- a/components/lazdebuggergdbmi/cmdlinedebugger.pp +++ b/components/lazdebuggergdbmi/cmdlinedebugger.pp @@ -117,7 +117,7 @@ uses SysUtils; var - DBG_CMD_ECHO, DBG_CMD_ECHO_FULL: PLazLoggerLogGroup; + DBG_WARNINGS, DBG_CMD_ECHO, DBG_CMD_ECHO_FULL: PLazLoggerLogGroup; {------------------------------------------------------------------------------ Function: WaitForHandles @@ -157,7 +157,7 @@ begin end; if Max=0 then begin // no valid handle, so no change possible - DebugLn('WaitForHandles: Error: no handles'); + DebugLn(DBG_WARNINGS or DBG_CMD_ECHO, 'WaitForHandles: Error: no handles'); exit; end; @@ -249,7 +249,7 @@ begin R := Windows.PeekNamedPipe(PipeHandle, nil, 0, nil, @TotalBytesAvailable, nil); if not R then begin // PeekNamedPipe failed - DebugLn('PeekNamedPipe failed, GetLastError is ', IntToStr(GetLastError)); + DebugLn(DBG_WARNINGS or DBG_CMD_ECHO, 'PeekNamedPipe failed, GetLastError is ', IntToStr(GetLastError)); Exit; end; if R then begin @@ -401,12 +401,12 @@ begin then begin try FDbgProcess.Execute; - DebugLn('[TCmdLineDebugger] Debug PID: ', IntToStr(FDbgProcess.Handle)); + DebugLn(DBG_CMD_ECHO, '[TCmdLineDebugger] Debug PID: ', IntToStr(FDbgProcess.Handle)); Result := FDbgProcess.Running; except on E: Exception do begin FOutputBuf := E.Message; - DebugLn('Exception while executing debugger: ', FOutputBuf); + DebugLn(DBG_WARNINGS or DBG_CMD_ECHO, 'Exception while executing debugger: ', FOutputBuf); end; end; end; @@ -622,7 +622,7 @@ begin {$EndIf} end else begin - DebugLn('[TCmdLineDebugger.SendCmdLn] Unable to send <', ACommand, '>. No process running.'); + DebugLn(DBG_WARNINGS or DBG_CMD_ECHO, '[TCmdLineDebugger.SendCmdLn] Unable to send <', ACommand, '>. No process running.'); DoWriteError; end; end; @@ -658,6 +658,7 @@ begin end; initialization + DBG_WARNINGS := DebugLogger.FindOrRegisterLogGroup('DBG_CMD_ECHO' {$IF defined(DBG_VERBOSE) or defined(DBG_CMD_ECHO)} , True {$ENDIF} ); DBG_CMD_ECHO := DebugLogger.FindOrRegisterLogGroup('DBG_CMD_ECHO' {$IF defined(DBG_VERBOSE) or defined(DBG_CMD_ECHO)} , True {$ENDIF} ); DBG_CMD_ECHO_FULL := DebugLogger.FindOrRegisterLogGroup('DBG_CMD_ECHO_FULL' {$IF defined(DBG_VERBOSE_FULL_DATA) or defined(DBG_CMD_ECHO_FULL)} , True {$ENDIF} ); diff --git a/components/lazdebuggergdbmi/gdbmidebugger.pp b/components/lazdebuggergdbmi/gdbmidebugger.pp index a3a4ccabd5..28b83aa364 100644 --- a/components/lazdebuggergdbmi/gdbmidebugger.pp +++ b/components/lazdebuggergdbmi/gdbmidebugger.pp @@ -4066,7 +4066,7 @@ begin else begin // unknown - debugln(['WARNING: TGDBMIDisassembleResultList.Parse: unknown disass entry', + debugln(DBG_VERBOSE or DBG_WARNINGS, ['WARNING: TGDBMIDisassembleResultList.Parse: unknown disass entry', DbgsPCLen(Itm^.Name),': ',DbgsPCLen(Itm^.Value)]); end; end; @@ -5042,7 +5042,7 @@ function TGDBMIDebuggerCommandDisassemble.DoExecute: Boolean; if DisAssList.Count < 2 then begin - debugln('Error failed to get enough data for dsassemble'); + debugln(DBG_WARNINGS, 'Error failed to get enough data for dsassemble'); // create a dummy range, so we will not retry NewRange.Capacity := 1; NewRange.RangeStartAddr := AFirstAddr.Value; @@ -5737,7 +5737,7 @@ begin exit; end; - DebugLn(['TGDBMIDebuggerBase.StartDebugging WorkingDir="', FTheDebugger.WorkingDir,'"']); + DebugLn(DBG_VERBOSE, ['TGDBMIDebuggerBase.StartDebugging WorkingDir="', FTheDebugger.WorkingDir,'"']); if FTheDebugger.WorkingDir <> '' then begin // to workaround a possible bug in gdb, first set the workingdir to . @@ -6594,7 +6594,7 @@ function TGDBMIDebuggerCommandExecute.ProcessStopped(const AParams: String; if (DebuggerState = dsRun) then begin - debugln(['********** WARNING: breakpoint hit, but nothing known about it ABreakId=', ABreakID, ' brbtno=', List.Values['bkptno'] ]); + debugln(DBG_VERBOSE or DBG_WARNINGS, ['********** WARNING: breakpoint hit, but nothing known about it ABreakId=', ABreakID, ' brbtno=', List.Values['bkptno'] ]); {$IFDEF DBG_VERBOSE_BRKPOINT} debugln(['-*- List of breakpoints Cnt=', FTheDebugger.Breakpoints.Count]); for ABreakID := 0 to FTheDebugger.Breakpoints.Count - 1 do @@ -7444,7 +7444,7 @@ var end; if i < 0 then begin - DebugLn(['CommandExecute: exStepOver, frame not found: ', i]); + DebugLn(DBG_VERBOSE or DBG_WARNINGS, ['CommandExecute: exStepOver, frame not found: ', i]); DoEndStepping; // TODO: User-error feedback end; end; @@ -7732,8 +7732,8 @@ begin then begin // Handle the unforeseen if (StoppedParams <> '') - then debugln(['ERROR: Got stop params, but did not change FTheDebugger.state: ', StoppedParams]) - else debugln(['ERROR: Got NO stop params at all, but was running']); + then debugln(DBG_VERBOSE or DBG_WARNINGS, ['ERROR: Got stop params, but did not change FTheDebugger.state: ', StoppedParams]) + else debugln(DBG_VERBOSE or DBG_WARNINGS, ['ERROR: Got NO stop params at all, but was running']); SetDebuggerState(dsPause); end; end; @@ -8873,7 +8873,7 @@ var Report, Report2: string; begin try - debugln(['ERROR: Exception occurred in ',Sender.ClassName+': ', + debugln(DBG_VERBOSE or DBG_WARNINGS, ['ERROR: Exception occurred in ',Sender.ClassName+': ', AnException.ClassName, ' Msg="', AnException.Message, '" Addr=', dbgs(ExceptAddr), ' Dbg.State=', dbgs(State)]); Report := BackTraceStrFunc(ExceptAddr); @@ -8886,7 +8886,7 @@ begin end; except end; - debugln(Report); + debugln(DBG_VERBOSE or DBG_WARNINGS, [Report]); if MessageDlg(gdbmiTheDebuggerExperiencedAnUnknownCondition, Format(gdbmiPressIgnoreToContinueDebuggingThisMayNOTBeSafePres, @@ -9258,7 +9258,7 @@ begin except On E: Exception do DoUnknownException(Self, E); else - debugln(['ERROR: Exception occurred in ',ClassName+': ', + debugln(DBG_VERBOSE or DBG_WARNINGS, ['ERROR: Exception occurred in ',ClassName+': ', '" Addr=', dbgs(ExceptAddr), ' Dbg.State=', dbgs(State)]); end; @@ -12821,7 +12821,7 @@ begin On E: Exception do FTheDebugger.DoUnknownException(Self, E) else - debugln(['ERROR: Exception occurred in ',ClassName+'.DoExecute ', + debugln(DBG_VERBOSE or DBG_WARNINGS, ['ERROR: Exception occurred in ',ClassName+'.DoExecute ', '" Addr=', dbgs(ExceptAddr), ' Dbg.State=', dbgs(FTheDebugger.State)]); end; // No re-raise in the except block. So no try-finally required diff --git a/components/lazdebuggergdbmi/gdbtypeinfo.pp b/components/lazdebuggergdbmi/gdbtypeinfo.pp index c78bb3e810..94a0a4013f 100644 --- a/components/lazdebuggergdbmi/gdbtypeinfo.pp +++ b/components/lazdebuggergdbmi/gdbtypeinfo.pp @@ -735,7 +735,7 @@ begin Result.Kind := CheckKeyword; if Result.Kind = ptprkSimple then begin Result.Kind := ptprkError; - debugln('** WARNING: ptype info format error: ' + ATypeText); + debugln(DBG_WARNINGS, '** WARNING: ptype info format error: ' + ATypeText); exit; end; @@ -1831,7 +1831,7 @@ begin end; - if CurPtr < EndPtr then debugln(['Scan aborted: ', PCLenToString(FText)]); + if CurPtr < EndPtr then debugln(DBG_WARNINGS, ['Scan aborted: ', PCLenToString(FText)]); if CurPtr < EndPtr then FreeAndNil(Result); end; @@ -2587,7 +2587,7 @@ var then exit; if IsReqError(t) - then debugln('Failed "ptype expr^[^]" request for class expression'); + then debugln(DBG_WARNINGS, 'Failed "ptype expr^[^]" request for class expression'); if (not IsReqError(t)) and (ptprfPointer in FReqResults[t].Result.Flags) then begin diff --git a/components/lazdebuggers/cmdlinedebuggerbase/debuginstructions.pas b/components/lazdebuggers/cmdlinedebuggerbase/debuginstructions.pas index 0401558b9d..e7abfc2ff2 100644 --- a/components/lazdebuggers/cmdlinedebuggerbase/debuginstructions.pas +++ b/components/lazdebuggers/cmdlinedebuggerbase/debuginstructions.pas @@ -206,7 +206,7 @@ function dbgsInstr(AnInstr: TDBGInstruction): String; implementation var - DBGMI_TIMEOUT_DEBUG, DBG_THREAD_AND_FRAME, DBG_VERBOSE: PLazLoggerLogGroup; + DBGMI_TIMEOUT_DEBUG, DBGMI_QUEUE_DEBUG, DBG_THREAD_AND_FRAME, DBG_VERBOSE: PLazLoggerLogGroup; function dbgs(AState: TDBGInstructionState): String; begin @@ -294,7 +294,7 @@ end; procedure TDBGInstruction.SetContentReceieved; begin FState := disContentReceived; -debugln('disContentReceived'); + debugln(DBG_VERBOSE and DBGMI_QUEUE_DEBUG, 'disContentReceived'); end; procedure TDBGInstruction.InternalCreate(ACommand: String; AThread, @@ -333,7 +333,7 @@ end; procedure TDBGInstruction.Cancel; begin -debugln(['TDBGInstruction.Cancel ', Command]); + debugln(DBGMI_QUEUE_DEBUG, ['TDBGInstruction.Cancel ', Command]); if FState = disQueued then FQueue.RemoveInstruction(Self) else @@ -357,7 +357,7 @@ end; procedure TDBGInstruction.MarkAsSuccess; begin -debugln(['TDBGInstruction.MarkAsSuccess SUCCESS ', Command]); + debugln(DBGMI_QUEUE_DEBUG, ['TDBGInstruction.MarkAsSuccess SUCCESS ', Command]); FState := disComleted; if FOnSuccess <> nil then FOnSuccess(Self); if FOnFinish <> nil then FOnFinish(Self); @@ -368,7 +368,7 @@ end; procedure TDBGInstruction.MarkAsFailed; begin -debugln(['TDBGInstruction.MarkAsFailed FAILED ',Command]); + debugln(DBGMI_QUEUE_DEBUG, ['TDBGInstruction.MarkAsFailed FAILED ',Command]); FState := disFailed; if FOnFailure <> nil then FOnFailure(Self); if FOnFinish <> nil then FOnFinish(Self); @@ -436,7 +436,7 @@ begin exit; if FRunningInstruction <> nil then exit; -debugln(['TDBGInstructionQueue.RunQueue ', dbgsInstr(FCurrentInstruction), ' / ', dbgsInstr(FRunningInstruction)]); + debugln(DBGMI_QUEUE_DEBUG, ['TDBGInstructionQueue.RunQueue ', dbgsInstr(FCurrentInstruction), ' / ', dbgsInstr(FRunningInstruction)]); if FCurrentInstruction = nil then begin FCurrentInstruction := GetNextInstructionToRun; @@ -444,7 +444,7 @@ debugln(['TDBGInstructionQueue.RunQueue ', dbgsInstr(FCurrentInstruction), ' / ' exit; FCurrentInstruction.AddReference; RemoveInstruction(FCurrentInstruction); -DebugLnEnter(['>> Current Instruction: ', FCurrentInstruction.Command]); + DebugLn(DBG_VERBOSE and DBGMI_QUEUE_DEBUG, ['>> Current Instruction: ', FCurrentInstruction.Command]); end; // set FCurrentInstruction to a pre running state, while changing stack.... @@ -547,15 +547,14 @@ end; procedure TDBGInstructionQueue.DoInstructionFinished(Sender: TDBGInstruction); begin -DebugLnExit(['<< Finished Instruction: ', FRunningInstruction.Command, ' // ', Sender=FRunningInstruction]); -if nil = FCurrentInstruction then DebugLnExit(['<< Current Instruction: ']); + DebugLn(DBGMI_QUEUE_DEBUG, ['<< Finished Instruction: ', FRunningInstruction.Command, ' // ', Sender=FRunningInstruction]); ReleaseRefAndNil(FRunningInstruction); RunQueue; end; procedure TDBGInstructionQueue.RunInstruction(AnInstruction: TDBGInstruction); begin -DebugLnEnter(['>> Running Instruction: ', AnInstruction.Command]); + DebugLn(DBGMI_QUEUE_DEBUG, ['>> Running Instruction: ', AnInstruction.Command]); FRunningInstruction := AnInstruction; FRunningInstruction.AddReference; FRunningInstruction.SendCommandDataToDBG; @@ -655,7 +654,7 @@ end; procedure TDBGInstructionQueue.QueueInstruction(AnInstruction: TDBGInstruction); begin -debugln(['TDBGInstructionQueue.QueueInstruction ', AnInstruction.DebugText]); + debugln(DBGMI_QUEUE_DEBUG, ['TDBGInstructionQueue.QueueInstruction ', AnInstruction.DebugText]); Assert(AnInstruction.State = disNew, 'queue only new instr'); AnInstruction.AddReference; AnInstruction.FNextQueuedInstruction := nil; @@ -671,6 +670,7 @@ end; initialization DBGMI_TIMEOUT_DEBUG := DebugLogger.FindOrRegisterLogGroup('DBGMI_TIMEOUT_DEBUG' {$IFDEF DBGMI_TIMEOUT_DEBUG} , True {$ENDIF} ); + DBGMI_QUEUE_DEBUG := DebugLogger.FindOrRegisterLogGroup('DBGMI_QUEUE_DEBUG' {$IFDEF DBGMI_QUEUE_DEBUG} , True {$ENDIF} ); DBG_THREAD_AND_FRAME := DebugLogger.FindOrRegisterLogGroup('DBG_THREAD_AND_FRAME' {$IFDEF DBG_THREAD_AND_FRAME} , True {$ENDIF} ); DBG_VERBOSE := DebugLogger.FindOrRegisterLogGroup('DBG_VERBOSE' {$IFDEF DBG_VERBOSE} , True {$ENDIF} ); diff --git a/components/lazdebuggers/cmdlinedebuggerbase/debugprocess.pas b/components/lazdebuggers/cmdlinedebuggerbase/debugprocess.pas index 2acce7780b..a8873cdae5 100644 --- a/components/lazdebuggers/cmdlinedebuggerbase/debugprocess.pas +++ b/components/lazdebuggers/cmdlinedebuggerbase/debugprocess.pas @@ -166,20 +166,17 @@ begin break; if r < 0 then begin -DebugLn('TTTTT pipe err'); + DebugLn(DBG_WARNINGS, 'TDebugProcessReadThread.Execute: pipe err'); Queue(FOnPipeError); exit; end; if (R > 0) and (FpFD_ISSET(FStream.Handle,FDS)=1) then begin -DebugLn('TTTTT data avail'); Queue(FOnDataAvail); RTLeventWaitFor(FAsyncLoopWaitEvent); -DebugLn('TTTTT data avail continue'); end; end; -DebugLn(['TTTTT loop end ', Terminated]); RemoveQueuedEvents(Self, FOnDataAvail); RemoveQueuedEvents(Self, FOnPipeError); end; @@ -225,7 +222,7 @@ end; procedure TDebugAsyncProcess.ThreadPipeError; begin -DebugLn(['got pipe err / is running ', Running]); + DebugLn(DBG_WARNINGS, ['TDebugAsyncProcess.ThreadPipeError: got pipe err / is running ', Running]); Terminate(0); HandleProcessTermination(0, cerExit, 0); end; @@ -253,7 +250,6 @@ end; procedure TDebugAsyncProcess.HandleProcessTermination(AData: PtrInt; AReason: TChildExitReason; AInfo: dword); begin -DebugLn('HandleProcessTermination'); UnhookProcessHandle; UnhookPipeHandle; if FOnTerminate <> nil then @@ -311,9 +307,7 @@ begin if FReadThread <> nil then begin TerminataThread; FReadThread.WaitFor; -debugln(['DESTROY thread destroying']); FreeAndNil(FReadThread); -debugln(['DESTROY thread destroyed']); end; {$ENDIF} inherited; @@ -328,9 +322,7 @@ begin if FReadThread <> nil then begin TerminataThread; FReadThread.WaitFor; -debugln(['DESTROY thread destroying']); FreeAndNil(FReadThread); -debugln(['DESTROY thread destroyed']); end; {$ENDIF} Result := inherited Terminate(AExitCode); @@ -547,7 +539,7 @@ end; procedure TDebugProcess.StopDebugProcess; begin -debugln(['TDebugProcess.StopDebugProcess FDbgProcess = nil ',FDbgProcess = nil]); + debugln(DBG_VERBOSE, ['TDebugProcess.StopDebugProcess FDbgProcess = nil ',FDbgProcess = nil]); if FDbgProcess = nil then exit; FDbgProcess.Terminate(0); diff --git a/components/lazdebuggers/lazdebuggerfp/fpdebugdebuggerworkthreads.pas b/components/lazdebuggers/lazdebuggerfp/fpdebugdebuggerworkthreads.pas index d7f9332fd2..c5ace02afd 100644 --- a/components/lazdebuggers/lazdebuggerfp/fpdebugdebuggerworkthreads.pas +++ b/components/lazdebuggers/lazdebuggerfp/fpdebugdebuggerworkthreads.pas @@ -347,6 +347,8 @@ type end; implementation +var + DBG_VERBOSE, DBG_WARNINGS, FPDBG_FUNCCALL: PLazLoggerLogGroup; { TFpDbgDebggerThreadWorkerItem } @@ -845,7 +847,7 @@ begin if not (FunctionResultSymbolType.Kind in [skInteger, skCurrency, skPointer, skEnum, skCardinal, skBoolean, skChar, skClass, skString, skAnsiString, skWideString]) then begin - DebugLn(['Error result kind ', dbgs(FunctionSymbolType.Kind)]); + DebugLn(FPDBG_FUNCCALL or DBG_WARNINGS, ['Error result kind ', dbgs(FunctionSymbolType.Kind)]); AnError := CreateError(fpErrAnyError, ['Result type of function not supported']); exit; end; @@ -854,7 +856,7 @@ begin if (not FunctionResultSymbolType.ReadSize(nil, FunctionResultDataSize)) or (FunctionResultDataSize > FDebugger.MemManager.RegisterSize(0)) then begin - DebugLn(['Error result size', dbgs(FunctionResultDataSize)]); + DebugLn(FPDBG_FUNCCALL or DBG_WARNINGS, ['Error result size', dbgs(FunctionResultDataSize)]); //ReturnMessage := 'Unable to call function. The size of the function-result exceeds the content-size of a register.'; AnError := CreateError(fpErrAnyError, ['Result type of function not supported']); exit; @@ -878,7 +880,7 @@ begin StringResultDecRefAddress := FDebugger.GetCached_FPC_ANSISTR_DECR_REF; if (StringResultDecRefAddress = 0) then begin - DebugLn(['Error result kind ', dbgs(FunctionSymbolType.Kind)]); + DebugLn(FPDBG_FUNCCALL or DBG_WARNINGS, ['Error result kind ', dbgs(FunctionSymbolType.Kind)]); AnError := CreateError(fpErrAnyError, ['Result type of function not supported']); exit; end; @@ -900,7 +902,7 @@ begin ProcAddress := AFunctionValue.EntryPCAddress; if not IsReadableLoc(ProcAddress) then begin - DebugLn(['Error proc addr']); + DebugLn(FPDBG_FUNCCALL or DBG_WARNINGS, ['Error proc addr']); AnError := CreateError(fpErrAnyError, ['Unable to calculate function address']); exit; end; @@ -935,7 +937,7 @@ begin else begin ExprParamVal := AParams.Items[FoundIdx].ResultValue; if (ExprParamVal = nil) then begin - DebugLn('Internal error for arg %d ', [FoundIdx]); + DebugLn(FPDBG_FUNCCALL or DBG_WARNINGS, 'Internal error for arg %d ', [FoundIdx]); AnError := AnExpressionPart.Expression.Error; if not IsError(AnError) then AnError := CreateError(fpErrAnyError, ['internal error, computing parameter']); @@ -945,7 +947,7 @@ begin rk := ExprParamVal.Kind; if not(rk in [skInteger, {skCurrency,} skPointer, skEnum, skCardinal, skBoolean, skChar, skClass, skRecord, skString, skAnsiString, skWideString]) then begin - DebugLn('Error not supported kind arg %d : %s ', [FoundIdx, dbgs(rk)]); + DebugLn(FPDBG_FUNCCALL or DBG_WARNINGS, 'Error not supported kind arg %d : %s ', [FoundIdx, dbgs(rk)]); AnError := CreateError(fpErrAnyError, ['parameter type not supported']); exit; end; @@ -986,7 +988,7 @@ begin if (TempSymbol.Kind <> rk) and ( (TempSymbol.Kind in [skInteger, skCardinal]) <> (rk in [skInteger, skCardinal]) ) then begin - DebugLn('Error kind mismatch for arg %d : %s <> %s', [FoundIdx, dbgs(TempSymbol.Kind), dbgs(rk)]); + DebugLn(FPDBG_FUNCCALL or DBG_WARNINGS, 'Error kind mismatch for arg %d : %s <> %s', [FoundIdx, dbgs(TempSymbol.Kind), dbgs(rk)]); AnError := CreateError(fpErrAnyError, ['wrong type for parameter']); exit; end; @@ -996,7 +998,7 @@ begin ParameterSymbolArr[FoundIdx].TypeSym := TempSymbol; end; //if not IsTargetOrRegNotNil(FDebugger.DbgController.CurrentProcess.CallParamDefaultLocation(FoundIdx)) then begin - // DebugLn('error to many args / not supported / arg > %d ', [FoundIdx]); + // DebugLn(FPDBG_FUNCCALL or DBG_WARNINGS, 'error to many args / not supported / arg > %d ', [FoundIdx]); // AnError := CreateError(fpErrAnyError, ['too many parameter / not supported']); // exit; //end; @@ -1005,7 +1007,7 @@ begin end; if (FoundIdx <> PCnt) then begin - DebugLn(['Error param count']); + DebugLn(FPDBG_FUNCCALL or DBG_WARNINGS, ['Error param count']); AnError := CreateError(fpErrAnyError, ['wrong amount of parameters']); exit; end; @@ -1017,7 +1019,7 @@ begin try if (ASelfValue <> nil) then begin if not CallContext.AddParam(SelfTypeSym.TypeInfo, ASelfValue) then begin - DebugLn('Internal error for self'); + DebugLn(FPDBG_FUNCCALL or DBG_WARNINGS, 'Internal error for self'); AnError := CallContext.LastError; exit; end; @@ -1025,7 +1027,7 @@ begin if (StringResultDecRefAddress <> 0) then begin if not CallContext.AddStringResult then begin - DebugLn('Internal error for string result'); + DebugLn(FPDBG_FUNCCALL or DBG_WARNINGS, 'Internal error for string result'); AnError := CallContext.LastError; exit; end; @@ -1040,14 +1042,14 @@ begin else ParRes := CallContext.AddParam(ParameterSymbolArr[i].TypeSym.TypeInfo, ParameterSymbolArr[i].ParamVal); if not ParRes then begin - DebugLn('Internal error for arg %d ', [i]); + DebugLn(FPDBG_FUNCCALL or DBG_WARNINGS, 'Internal error for arg %d ', [i]); AnError := CallContext.LastError; exit; end; end; if not CallContext.FinalizeParams then begin - DebugLn('Internal error after params'); + DebugLn(FPDBG_FUNCCALL or DBG_WARNINGS, 'Internal error after params'); AnError := CallContext.LastError; exit; end; @@ -1056,7 +1058,7 @@ begin FDebugger.RunProcessLoop(not FAllowFunctionsAllThread); if not CallContext.IsValid then begin - DebugLn(['Error in call ',CallContext.Message]); + DebugLn(FPDBG_FUNCCALL or DBG_WARNINGS, ['Error in call ',CallContext.Message]); //ReturnMessage := CallContext.Message; AnError := CallContext.LastError; if not IsError(AnError) then @@ -1477,5 +1479,10 @@ begin inherited Create(ADebugger, twpUser); end; +initialization + DBG_VERBOSE := DebugLogger.FindOrRegisterLogGroup('DBG_VERBOSE' {$IFDEF DBG_VERBOSE} , True {$ENDIF} ); + DBG_WARNINGS := DebugLogger.FindOrRegisterLogGroup('DBG_WARNINGS' {$IFDEF DBG_WARNINGS} , True {$ENDIF} ); + FPDBG_FUNCCALL := DebugLogger.FindOrRegisterLogGroup('FPDBG_FUNCCALL' {$IFDEF FPDBG_FUNCCALL} , True {$ENDIF} ); + end. diff --git a/components/lazdebuggers/lazdebuggerfpgdbmi/fpgdbmidebugger.pp b/components/lazdebuggers/lazdebuggerfpgdbmi/fpgdbmidebugger.pp index 7cf47f3dcd..ad2cabb141 100644 --- a/components/lazdebuggers/lazdebuggerfpgdbmi/fpgdbmidebugger.pp +++ b/components/lazdebuggers/lazdebuggerfpgdbmi/fpgdbmidebugger.pp @@ -586,7 +586,7 @@ begin else if not FpDebugger.EvaluateExpression(WatchValue, WatchValue.Expression, ResText, ResTypeInfo) then begin - if IsWatchValueAlive then debugln(['TFPGDBMIWatches.InternalRequestData FAILED ', WatchValue.Expression]); + if IsWatchValueAlive then debugln(DBG_ERRORS, ['TFPGDBMIWatches.InternalRequestData FAILED ', WatchValue.Expression]); if IsWatchValueAlive then inherited InternalRequestData(WatchValue); end; diff --git a/components/lazdebuggers/lazdebuggerfplldb/fplldbdebugger.pas b/components/lazdebuggers/lazdebuggerfplldb/fplldbdebugger.pas index dbfc9bd7b7..44eff7187b 100644 --- a/components/lazdebuggers/lazdebuggerfplldb/fplldbdebugger.pas +++ b/components/lazdebuggers/lazdebuggerfplldb/fplldbdebugger.pas @@ -612,7 +612,7 @@ begin sleep(30); end; - debugln(['TFpLldbDbgMemReader.ReadMemory got mem ', AnAddress, ' ', ASize, ' ', Length(InStr.Res)]); + debugln(DBG_VERBOSE, ['TFpLldbDbgMemReader.ReadMemory got mem ', AnAddress, ' ', ASize, ' ', Length(InStr.Res)]); if Length(InStr.Res) <> ASize then exit; @@ -822,7 +822,7 @@ begin if (FpDebugger.FWatchEvalList.Count = 0) or (FWatchEvalLock > 0) or FWatchEvalCancel then exit; -debugln(['ProcessEvalList ']); + debugln(DBG_VERBOSE, ['ProcessEvalList ']); inc(FWatchEvalLock); FpDebugger.LockUnLoadDwarf; try // TODO: if the stack/thread is changed, registers will be wrong @@ -840,7 +840,7 @@ debugln(['ProcessEvalList ']); ResTypeInfo := nil; if not FpDebugger.EvaluateExpression(WatchValue, WatchValue.Expression, ResText, ResTypeInfo) then begin - if IsWatchValueAlive then debugln(['TFPLldbWatches.InternalRequestData FAILED ', WatchValue.Expression]); + if IsWatchValueAlive then debugln(DBG_VERBOSE or DBG_ERRORS, ['TFPLldbWatches.InternalRequestData FAILED ', WatchValue.Expression]); if IsWatchValueAlive then inherited InternalRequestData(WatchValue); end; diff --git a/components/lazdebuggers/lazdebuggerlldb/lldbinstructions.pas b/components/lazdebuggers/lazdebuggerlldb/lldbinstructions.pas index ab6166e6cf..44853e1dd6 100644 --- a/components/lazdebuggers/lazdebuggerlldb/lldbinstructions.pas +++ b/components/lazdebuggers/lazdebuggerlldb/lldbinstructions.pas @@ -409,6 +409,8 @@ type end; implementation +var + DBG_VERBOSE: PLazLoggerLogGroup; { TLldbInstructionValueBase } @@ -424,7 +426,7 @@ begin '}': dec(FCurly); end; inc(i); - if FCurly<0 then debugln(['ParseStruct curly too low ', FCurly]); + if FCurly<0 then debugln(DBG_VERBOSE, ['ParseStruct curly too low ', FCurly]); end; Result := FCurly <= 0; end; @@ -1312,7 +1314,6 @@ begin if StrStartsWith(AData, '* thread #') or StrStartsWith(AData, ' thread #') then begin -DebugLn(['######### add ',AData]); l := Length(FRes); SetLength(FRes, l+1); FRes[l] := AData; @@ -1481,6 +1482,8 @@ begin Queue.SendDataToDBG(Self, 'version'); // end marker // do not sent before new prompt end; +initialization + DBG_VERBOSE := DebugLogger.FindOrRegisterLogGroup('DBG_VERBOSE' {$IFDEF DBG_VERBOSE} , True {$ENDIF} ); end. diff --git a/ide/packages/idedebugger/debugger.pp b/ide/packages/idedebugger/debugger.pp index c4925172be..4671705c8b 100644 --- a/ide/packages/idedebugger/debugger.pp +++ b/ide/packages/idedebugger/debugger.pp @@ -1914,7 +1914,7 @@ function HasConsoleSupport: Boolean; implementation var - DBG_DATA_MONITORS, DBG_LOCATION_INFO: PLazLoggerLogGroup; + DBG_VERBOSE, DBG_BREAKPOINT, DBG_DATA_MONITORS, DBG_LOCATION_INFO: PLazLoggerLogGroup; function dbgs(AFlag: TDebuggerLocationFlag): String; begin @@ -2596,7 +2596,7 @@ begin NewSnap.LoadDataFromXMLConfig(AConfig, APath + 'SnapEntry' + IntToStr(i) + '/', UIProv); if not(NewSnap.IsHistory or NewSnap.IsSnapshot) then begin RemoveHistoryEntryFromMonitors(NewSnap); // TODO: add user feedback / warning - debugln(['************** Snapshot loaded, but not kept']); + debugln(DBG_VERBOSE, ['************** Snapshot loaded, but not kept']); end; NewSnap.ReleaseReference; end; @@ -2611,7 +2611,7 @@ begin NewSnap.LoadDataFromXMLConfig(AConfig, APath + 'HistEntry' + IntToStr(i) + '/', UIProv); if not(NewSnap.IsHistory or NewSnap.IsSnapshot) then begin RemoveHistoryEntryFromMonitors(NewSnap); // TODO: add user feedback / warning - debugln(['************** Snapshot loaded, but not kept']); + debugln(DBG_VERBOSE, ['************** Snapshot loaded, but not kept']); end; NewSnap.ReleaseReference; end; @@ -5613,9 +5613,9 @@ procedure TIDEBreakPoint.DisableGroups; var n: Integer; begin - {$IFDEF DBG_BREAKPOINT} - DebugLn(['DisableGroups: ', DebugText, ' Cnt=', FDisableGroupList.Count]); - {$ENDIF} +{$IFDEF DBG_BREAKPOINT} + DebugLn(DBG_BREAKPOINT, ['DisableGroups: ', DebugText, ' Cnt=', FDisableGroupList.Count]); +{$ENDIF} for n := 0 to FDisableGroupList.Count - 1 do FDisableGroupList[n].Enabled := False; end; @@ -5650,9 +5650,9 @@ procedure TIDEBreakPoint.EnableGroups; var n: Integer; begin - {$IFDEF DBG_BREAKPOINT} - DebugLn(['EnableGroups: ', DebugText, ' Cnt=', FEnableGroupList.Count]); - {$ENDIF} +{$IFDEF DBG_BREAKPOINT} + DebugLn(DBG_BREAKPOINT, ['EnableGroups: ', DebugText, ' Cnt=', FEnableGroupList.Count]); +{$ENDIF} for n := 0 to FEnableGroupList.Count - 1 do FEnableGroupList[n].Enabled := True; @@ -8346,6 +8346,8 @@ begin end; initialization + DBG_VERBOSE := DebugLogger.FindOrRegisterLogGroup('DBG_VERBOSE' {$IFDEF DBG_VERBOSE} , True {$ENDIF} ); + DBG_BREAKPOINT := DebugLogger.FindOrRegisterLogGroup('DBG_BREAKPOINT' {$IFDEF DBG_BREAKPOINT} , True {$ENDIF} ); DBG_DATA_MONITORS := DebugLogger.FindOrRegisterLogGroup('DBG_DATA_MONITORS' {$IFDEF DBG_DATA_MONITORS} , True {$ENDIF} ); DBG_LOCATION_INFO := DebugLogger.FindOrRegisterLogGroup('DBG_LOCATION_INFO' {$IFDEF DBG_LOCATION_INFO} , True {$ENDIF} );