//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public DebuggeeBreakpointPending FindPendingBreakpoint(uint id) { LoggingUtils.PrintFunction(); try { DebuggeeBreakpointBound boundBreakpoint = FindBoundBreakpoint(id); if (boundBreakpoint != null) { LoggingUtils.RequireOk(boundBreakpoint.GetPendingBreakpoint(out IDebugPendingBreakpoint2 pendingBreakpoint)); return(pendingBreakpoint as DebuggeeBreakpointPending); } DebuggeeBreakpointError errorBreakpoint = FindErrorBreakpoint(id); if (errorBreakpoint != null) { LoggingUtils.RequireOk(errorBreakpoint.GetPendingBreakpoint(out IDebugPendingBreakpoint2 pendingBreakpoint)); return(pendingBreakpoint as DebuggeeBreakpointPending); } } catch (Exception e) { LoggingUtils.HandleException(e); } return(null); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public DebuggeeBreakpointError FindErrorBreakpoint(uint id) { // // Search all registered pending breakpoints objects for a bound breakpoint matching the requested id. // LoggingUtils.PrintFunction(); try { foreach (var pending in m_pendingBreakpoints) { // // Check for matching 'error' breakpoints. // int handle = pending.EnumErrorBreakpoints(enum_BP_ERROR_TYPE.BPET_ALL, out IEnumDebugErrorBreakpoints2 enumeratedErrorBreakpoints); if (handle == Constants.E_BP_DELETED) { continue; // Skip any deleted breakpoints. } LoggingUtils.RequireOk(handle); LoggingUtils.RequireOk(enumeratedErrorBreakpoints.GetCount(out uint numErrorBreakpoints)); if (numErrorBreakpoints > 0) { DebuggeeBreakpointError [] errorBreakpoints = new DebuggeeBreakpointError [numErrorBreakpoints]; LoggingUtils.RequireOk(enumeratedErrorBreakpoints.Next(numErrorBreakpoints, errorBreakpoints, numErrorBreakpoints)); for (uint i = 0; i < numErrorBreakpoints; ++i) { if (errorBreakpoints [i] is CLangDebuggeeBreakpointError) { CLangDebuggeeBreakpointError error = errorBreakpoints [i] as CLangDebuggeeBreakpointError; if (error.GdbBreakpoint.ID == id) { return(error); } } else { throw new NotImplementedException("Unrecognised error breakpoint type"); } } } } } catch (Exception e) { LoggingUtils.HandleException(e); } return(null); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public virtual int CreateErrorBreakpoint(string errorReason, DebuggeeDocumentContext documentContext, DebuggeeCodeContext codeContext) { // // Create and broadcast a generic (non language-specific) errored breakpoint. // LoggingUtils.PrintFunction(); try { DebuggeeBreakpointError errorBreakpoint = new DebuggeeBreakpointError(m_breakpointManager, this, codeContext, errorReason); lock (m_errorBreakpoints) { m_errorBreakpoints.Add(errorBreakpoint); } uint numDebugPrograms = 1; IEnumDebugPrograms2 debugPrograms; IDebugProgram2 [] debugProgramsArray = new IDebugProgram2 [numDebugPrograms]; LoggingUtils.RequireOk(m_breakpointManager.Engine.EnumPrograms(out debugPrograms)); LoggingUtils.RequireOk(debugPrograms.Next(numDebugPrograms, debugProgramsArray, ref numDebugPrograms)); m_breakpointManager.Engine.Broadcast(new DebugEngineEvent.BreakpointError(errorBreakpoint), debugProgramsArray [0], null); return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); return(Constants.E_FAIL); } }