//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int Event(IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib) { // // Custom event handler. // LoggingUtils.PrintFunction(); try { JavaLangDebuggerEventDelegate eventCallback; LoggingUtils.Print("[JavaLangDebuggerCallback] Event: " + riidEvent.ToString()); if (!m_debuggerCallback.TryGetValue(riidEvent, out eventCallback)) { return(Constants.E_NOTIMPL); } LoggingUtils.RequireOk(eventCallback(m_debugEngine.JavaDebugger)); return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int RemovePort(IDebugPort2 pPort) { // // Removes a port. This method removes the port from the port supplier's internal list of active ports. // LoggingUtils.PrintFunction(); try { Guid portId; LoggingUtils.RequireOk(pPort.GetPortId(out portId)); m_registeredPorts.Remove(portId); return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public Dictionary <string, string> ProjectPropertiesToDictionary() { Dictionary <string, string> evaluatedProperties = new Dictionary <string, string> (); IPropertyPagesCatalog projectPropertyList = ConfiguredProject.Services.PropertyPagesCatalog.GetCatalog("Project"); IEnumerable <string> projectPropertySchemas = projectPropertyList.GetPropertyPagesSchemas(); foreach (string schema in projectPropertySchemas) { IRule schemaRules = projectPropertyList.BindToContext(schema, File, ItemType, ItemName); foreach (IProperty properties in schemaRules.Properties) { try { IEvaluatedProperty evaluatedProperty = (IEvaluatedProperty)properties; string schemaGroupedKey = schema + "." + properties.Name; evaluatedProperties [schemaGroupedKey] = evaluatedProperty.EvaluatedValueAtEnd; } catch (Exception e) { LoggingUtils.HandleException(e); } } } return(evaluatedProperties); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void RefreshBreakpoints() { // // Searches registered pending breakpoints to determine whether their status has changed. // LoggingUtils.PrintFunction(); try { if (m_requiresRefresh) { foreach (var breakpoint in m_pendingBreakpoints) { breakpoint.RefreshBoundBreakpoints(); breakpoint.RefreshErrorBreakpoints(); } m_requiresRefresh = false; } } catch (Exception e) { LoggingUtils.HandleException(e); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public MiVariable CreateVariableFromExpression(CLangDebuggeeStackFrame stackFrame, string expression) { LoggingUtils.PrintFunction(); try { LoggingUtils.RequireOk(stackFrame.GetThread(out IDebugThread2 stackThread)); LoggingUtils.RequireOk(stackThread.GetThreadId(out uint stackThreadId)); string command = string.Format("-var-create --thread {0} --frame {1} - * \"{2}\"", stackThreadId, stackFrame.StackLevel, expression); MiResultRecord resultRecord = m_debugger.GdbClient.SendSyncCommand(command); MiResultRecord.RequireOk(resultRecord, command); return(new MiVariable(expression, resultRecord.Results)); } catch (Exception e) { LoggingUtils.HandleException(e); return(null); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public override int GetLanguageInfo(ref string languageName, ref Guid languageGuid) { // // Gets the language associated with this stack frame. // LoggingUtils.PrintFunction(); try { IDebugDocumentContext2 documentContext; languageGuid = DebugEngineGuids.guidLanguageUnknown; languageName = DebugEngineGuids.GetLanguageName(languageGuid); LoggingUtils.RequireOk(GetDocumentContext(out documentContext)); if (documentContext != null) { LoggingUtils.RequireOk(documentContext.GetLanguageInfo(ref languageName, ref languageGuid)); } return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public virtual int GetState(enum_BP_STATE [] pState) { // // Gets the state of this bound breakpoint. // LoggingUtils.PrintFunction(); try { pState [0] = enum_BP_STATE.BPS_NONE; if (m_breakpointDeleted) { pState [0] = enum_BP_STATE.BPS_DELETED; } else { pState [0] = (m_breakpointEnabled) ? enum_BP_STATE.BPS_ENABLED : enum_BP_STATE.BPS_DISABLED; } return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public DebuggeeCodeContext GetCodeContextForLocation(string location) { LoggingUtils.PrintFunction(); try { if (string.IsNullOrEmpty(location)) { throw new ArgumentNullException("location"); } if (location.StartsWith("0x")) { location = "*" + location; } else if (location.StartsWith("\"")) { location = location.Replace("\\", "/"); location = location.Replace("\"", "\\\""); // required to escape the nested string. } throw new NotImplementedException(); } catch (Exception e) { LoggingUtils.HandleException(e); } return(null); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int OnDetachClient(CLangDebugger debugger) { LoggingUtils.PrintFunction(); try { bool shouldContinue = false; ManualResetEvent detachLock = new ManualResetEvent(false); debugger.RunInterruptOperation(delegate(CLangDebugger _debugger) { _debugger.GdbClient.Detach(); detachLock.Set(); }, shouldContinue); bool detachedSignaled = detachLock.WaitOne(1000); if (!detachedSignaled) { throw new InvalidOperationException("Failed to detach GDB client"); } return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); throw; } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #endregion //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region IDebugEventCallback2 Members //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int Event(IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib) { try { DebuggerEventListenerDelegate callback; LoggingUtils.Print("[DebuggerEventListener] Event: " + riidEvent.ToString()); int handle = VsDebugCommon.Constants.E_NOTIMPL; if (!m_eventCallbacks.TryGetValue(riidEvent, out callback)) { return(handle); } handle = callback(pEngine, pProcess, pProgram, pThread, pEvent, ref riidEvent, dwAttrib); if (handle != VsDebugCommon.Constants.E_NOTIMPL) { LoggingUtils.RequireOk(handle); } return(VSConstants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); return(VSConstants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int OnError(IDebugEngine2 pEngine, IDebugProcess2 pProcess, IDebugProgram2 pProgram, IDebugThread2 pThread, IDebugEvent2 pEvent, ref Guid riidEvent, uint dwAttrib) { LoggingUtils.PrintFunction(); try { DebugEngineEvent.Error errorEvent = pEvent as DebugEngineEvent.Error; enum_MESSAGETYPE [] messageType = new enum_MESSAGETYPE [1]; string errorFormat, errorHelpFileName; int errorReason; uint errorType, errorHelpId; LoggingUtils.RequireOk(errorEvent.GetErrorMessage(messageType, out errorFormat, out errorReason, out errorType, out errorHelpFileName, out errorHelpId)); LoggingUtils.RequireOk(m_debuggerConnectionService.LaunchDialogUpdate(errorFormat, true)); return(VSConstants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); return(VSConstants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private static Assembly LoadAssemblyFromPackagePath(object sender, ResolveEventArgs args) { try { string packagePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string assemblyFilename = args.Name; int i = assemblyFilename.IndexOf(','); if (i != -1) { assemblyFilename = assemblyFilename.Substring(0, i); } string assemblyPath = Path.Combine(packagePath, assemblyFilename + ".dll"); if (!File.Exists(assemblyPath)) { return(null); } Assembly assembly = Assembly.LoadFrom(assemblyPath); return(assembly); } catch (Exception e) { LoggingUtils.HandleException(e); return(null); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int GetCodeLocationId(IDebugCodeContext2 pCodeContext, out ulong puCodeLocationId) { // // Returns a code location identifier for a particular code context. // LoggingUtils.PrintFunction(); try { CONTEXT_INFO [] contextInfoArray = new CONTEXT_INFO [1]; LoggingUtils.RequireOk(pCodeContext.GetInfo(enum_CONTEXT_INFO_FIELDS.CIF_ADDRESSABSOLUTE, contextInfoArray)); if (contextInfoArray [0].bstrAddressAbsolute.StartsWith("0x")) { puCodeLocationId = ulong.Parse(contextInfoArray [0].bstrAddressAbsolute.Substring(2), NumberStyles.HexNumber); } else { puCodeLocationId = ulong.Parse(contextInfoArray [0].bstrAddressAbsolute, NumberStyles.HexNumber); } return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); puCodeLocationId = 0ul; return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int GetCodeContext(ulong uCodeLocationId, out IDebugCodeContext2 ppCodeContext) { // // Returns a code context object corresponding to a specified code location identifier. // LoggingUtils.PrintFunction(); try { string location = string.Format("0x{0:X8}", uCodeLocationId); ppCodeContext = CLangDebuggeeCodeContext.GetCodeContextForLocation(m_debugger, location); if (ppCodeContext == null) { throw new InvalidOperationException(); } return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); ppCodeContext = null; return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void ClearBoundBreakpoints() { // // Remove all of the bound breakpoints for this pending breakpoint. // LoggingUtils.PrintFunction(); try { lock (m_boundBreakpoints) { for (int i = m_boundBreakpoints.Count - 1; i >= 0; --i) { int handle = m_boundBreakpoints [i].Delete(); if (handle != Constants.E_BP_DELETED) { LoggingUtils.RequireOk(handle); } } m_boundBreakpoints.Clear(); } } catch (Exception e) { LoggingUtils.HandleException(e); throw; } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum) { // // Determines whether this pending breakpoint can bind to a code location. // LoggingUtils.PrintFunction(); ppErrorEnum = null; try { if (m_breakpointDeleted) { return(Constants.E_BP_DELETED); } if (m_errorBreakpoints.Count > 0) { LoggingUtils.RequireOk(EnumErrorBreakpoints(enum_BP_ERROR_TYPE.BPET_ALL, out ppErrorEnum)); return(Constants.S_FALSE); } return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public override int EnumProperties(enum_DEBUGPROP_INFO_FLAGS requestedFields, uint radix, ref Guid guidFilter, uint timeout, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumDebugProperty) { LoggingUtils.PrintFunction(); try { if ((guidFilter == DebuggeeProperty.Filters.guidFilterRegisters) || (guidFilter == DebuggeeProperty.Filters.guidFilterAutoRegisters)) { LoggingUtils.RequireOk(QueryRegisters()); } if ((guidFilter == DebuggeeProperty.Filters.guidFilterAllLocals) || (guidFilter == DebuggeeProperty.Filters.guidFilterAllLocalsPlusArgs) || (guidFilter == DebuggeeProperty.Filters.guidFilterArgs) || (guidFilter == DebuggeeProperty.Filters.guidFilterLocals) || (guidFilter == DebuggeeProperty.Filters.guidFilterLocalsPlusArgs)) { LoggingUtils.RequireOk(QueryArgumentsAndLocals()); } LoggingUtils.RequireOk(base.EnumProperties(requestedFields, radix, ref guidFilter, timeout, out elementsReturned, out enumDebugProperty)); return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); elementsReturned = 0; enumDebugProperty = null; return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int Delete() { // // Deletes this pending breakpoint and all breakpoints bound from it. // LoggingUtils.PrintFunction(); try { if (m_breakpointDeleted) { return(Constants.E_BP_DELETED); } ClearBoundBreakpoints(); ClearErrorBreakpoints(); m_breakpointDeleted = true; return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region IDebugBoundBreakpoint2 Members //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public virtual int Delete() { // // Deletes the breakpoint. // LoggingUtils.PrintFunction(); try { if (m_breakpointDeleted) { return(Constants.E_BP_DELETED); } IDebugBreakpointRequest2 breakpointRequest; LoggingUtils.RequireOk(m_pendingBreakpoint.GetBreakpointRequest(out breakpointRequest)); m_breakpointManager.Engine.Broadcast(new DebugEngineEvent.BreakpointUnbound(this), m_breakpointManager.Engine.Program, null); m_breakpointDeleted = true; return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int Enable(int fEnable) { // // Toggles the enabled state of this pending breakpoint. // LoggingUtils.PrintFunction(); try { if (m_breakpointDeleted) { return(Constants.E_BP_DELETED); } m_breakpointEnabled = (fEnable != 0); return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void ClearBreakpoints() { // // Called from the debug engine's Detach method to remove the active (bound) breakpoint instructions. // LoggingUtils.PrintFunction(); try { lock (m_pendingBreakpoints) { for (int i = m_pendingBreakpoints.Count - 1; i >= 0; --i) { int handle = m_pendingBreakpoints [i].Delete(); if (handle != Constants.E_BP_DELETED) { LoggingUtils.RequireOk(handle); } } m_pendingBreakpoints.Clear(); } } catch (Exception e) { LoggingUtils.HandleException(e); throw; } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum) { // // Enumerates all error breakpoints that resulted from this pending breakpoint. // LoggingUtils.PrintFunction(); try { ppEnum = new DebuggeeBreakpointError.Enumerator(m_errorBreakpoints.ToArray()); if (m_breakpointDeleted) { return(Constants.E_BP_DELETED); } return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); ppEnum = null; return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 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 int GetBreakpointRequest(out IDebugBreakpointRequest2 ppBPRequest) { // // Gets the breakpoint request that was used to create this pending breakpoint. // LoggingUtils.PrintFunction(); try { ppBPRequest = m_breakpointRequest; if (m_breakpointDeleted) { return(Constants.E_BP_DELETED); } if (ppBPRequest == null) { throw new InvalidOperationException(); } return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); ppBPRequest = null; return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int GetPort(ref Guid guidPort, out IDebugPort2 ppPort) { // // Gets a port from a port supplier. // LoggingUtils.PrintFunction(); ppPort = null; try { if (!m_registeredPorts.TryGetValue(guidPort, out ppPort)) { return(Constants.E_PORTSUPPLIER_NO_PORT); } return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int GetState(PENDING_BP_STATE_INFO [] pState) { // // Gets the state of this pending breakpoint. // LoggingUtils.PrintFunction(); try { pState [0].state = enum_PENDING_BP_STATE.PBPS_NONE; if (m_breakpointDeleted) { pState [0].state = enum_PENDING_BP_STATE.PBPS_DELETED; } else { pState [0].state = (m_breakpointEnabled) ? enum_PENDING_BP_STATE.PBPS_ENABLED : enum_PENDING_BP_STATE.PBPS_DISABLED; } return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected int CreatePort(IDebugPortRequest2 portRequest, out IDebugPort2 port) { LoggingUtils.PrintFunction(); try { string requestPortName; LoggingUtils.RequireOk(portRequest.GetPortName(out requestPortName)); if (string.IsNullOrWhiteSpace(requestPortName)) { throw new InvalidOperationException("Invalid/empty port name"); } AndroidDevice device = AndroidAdb.GetConnectedDeviceById(requestPortName); if (device == null) { throw new InvalidOperationException("Failed to find a device with the name: " + requestPortName); } port = new DebuggeePort(this, device); return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); port = null; return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int SetPassCount(BP_PASSCOUNT bpPassCount) { // // Sets or changes the pass count associated with this pending breakpoint. // LoggingUtils.PrintFunction(); try { if (m_breakpointDeleted) { return(Constants.E_BP_DELETED); } foreach (DebuggeeBreakpointBound boundBreakpoint in m_boundBreakpoints.ToArray()) { LoggingUtils.RequireOk(boundBreakpoint.SetPassCount(bpPassCount)); } return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #endregion //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region IDebugModule3 Members //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public virtual int GetSymbolInfo(enum_SYMBOL_SEARCH_INFO_FIELDS requestedFields, MODULE_SYMBOL_SEARCH_INFO [] infoArray) { // // Returns a list of paths searched for symbols, and the results of searching path. // LoggingUtils.PrintFunction(); try { if ((requestedFields & enum_SYMBOL_SEARCH_INFO_FIELDS.SSIF_VERBOSE_SEARCH_INFO) != 0) { if (SymbolsLoaded) { infoArray [0].bstrVerboseSearchInfo = string.Format("Symbols loaded for {0} from {1}", Name, SymbolsPath); infoArray [0].dwValidFields = (uint)enum_SYMBOL_SEARCH_INFO_FIELDS.SSIF_VERBOSE_SEARCH_INFO; } } return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int EnumPorts(out IEnumDebugPorts2 ppEnum) { // // Retrieves a list of all the ports supplied by a port supplier. // LoggingUtils.PrintFunction(); try { IDebugPort2 [] ports = new IDebugPort2 [m_registeredPorts.Count]; m_registeredPorts.Values.CopyTo(ports, 0); ppEnum = new DebugPortEnumerator(ports); return(Constants.S_OK); } catch (Exception e) { LoggingUtils.HandleException(e); ppEnum = null; return(Constants.E_FAIL); } }