// Obtains information about programs running, filtered in a variety of ways. int IDebugProgramProvider2.GetProviderProcessData(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 port, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA[] processArray) { processArray[0] = new PROVIDER_PROCESS_DATA(); if (Flags.HasFlag(enum_PROVIDER_FLAGS.PFLAG_GET_PROGRAM_NODES)) { // The debugger is asking the engine to return the program nodes it can debug. The // sample engine claims that it can debug all processes, and returns exsactly one // program node for each process. A full-featured debugger may wish to examine the // target process and determine if it understands how to debug it. var node = (IDebugProgramNode2)(new AD7ProgramNode(ProcessId.guidProcessId)); IntPtr[] programNodes = { Marshal.GetComInterfaceForObject(node, typeof(IDebugProgramNode2)) }; IntPtr destinationArray = Marshal.AllocCoTaskMem(IntPtr.Size * programNodes.Length); Marshal.Copy(programNodes, 0, destinationArray, programNodes.Length); processArray[0].Fields = enum_PROVIDER_FIELDS.PFIELD_PROGRAM_NODES; processArray[0].ProgramNodes.Members = destinationArray; processArray[0].ProgramNodes.dwCount = (uint)programNodes.Length; return VSConstants.S_OK; } return VSConstants.S_FALSE; }
public int GetProviderProgramNode(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, ref Guid guidEngine, ulong programId, out IDebugProgramNode2 ppProgramNode) { DebugHelper.TraceEnteringMethod(); ppProgramNode = null; return VSConstants.S_OK; }
public int GetProviderProcessData(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA[] pProcess) { Log.Debug("ProgramProvider: GetProviderProcessData"); if (Flags.HasFlag(enum_PROVIDER_FLAGS.PFLAG_GET_PROGRAM_NODES)) { var process = Process.GetProcessById((int) ProcessId.dwProcessId); foreach (ProcessModule module in process.Modules) { if (module.ModuleName.StartsWith("System.Management.Automation", StringComparison.OrdinalIgnoreCase)) { var node = new ScriptProgramNode(new ScriptDebugProcess(pPort, ProcessId.dwProcessId)); var programNodes = new[] { Marshal.GetComInterfaceForObject(node, typeof(IDebugProgramNode2)) }; var destinationArray = Marshal.AllocCoTaskMem(IntPtr.Size * programNodes.Length); Marshal.Copy(programNodes, 0, destinationArray, programNodes.Length); pProcess[0].Fields = enum_PROVIDER_FIELDS.PFIELD_PROGRAM_NODES; pProcess[0].ProgramNodes.Members = destinationArray; pProcess[0].ProgramNodes.dwCount = (uint)programNodes.Length; return VSConstants.S_OK; } } } return VSConstants.S_FALSE; }
/// <summary> /// Retrieves a list of running programs from a specified process. /// </summary> /// <param name="Flags"> /// A combination of flags from the PROVIDER_FLAGS enumeration. The following flags are typical for this call: /// /// Flag Description /// PFLAG_REMOTE_PORT Caller is running on remote machine. /// PFLAG_DEBUGGEE Caller is currently being debugged (additional information about marshalling will be returned for each node). /// PFLAG_ATTACHED_TO_DEBUGGEE Caller was attached to but not launched by the debugger. /// PFLAG_GET_PROGRAM_NODES Caller is asking for a list of program nodes to be returned. /// </param> /// <param name="pPort">The port the calling process is running on.</param> /// <param name="ProcessId">An AD_PROCESS_ID structure holding the ID of the process that contains the program in question.</param> /// <param name="EngineFilter">An array of GUIDs for debug engines assigned to debug this process (these will be used to filter the programs that are actually returned based on what the supplied engines support; if no engines are specified, then all programs will be returned).</param> /// <param name="pProcess">A PROVIDER_PROCESS_DATA structure that is filled in with the requested information.</param> /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns> /// <remarks>This method is normally called by a process to obtain a list of programs running in that process. The returned information is a list of IDebugProgramNode2 objects.</remarks> public virtual int GetProviderProcessData( enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA[] pProcess) { Logger.Debug( string.Empty ); return VSConstants.E_NOTIMPL; }
/// <summary> /// Retrieves the program node for a specific program. /// </summary> /// <param name="Flags"> /// A combination of flags from the PROVIDER_FLAGS enumeration. The following flags are typical for this call: /// /// Flag Description /// PFLAG_REMOTE_PORT Caller is running on remote machine. /// PFLAG_DEBUGGEE Caller is currently being debugged (additional information about marshalling will be returned for each node). /// PFLAG_ATTACHED_TO_DEBUGGEE Caller was attached to but not launched by the debugger. /// </param> /// <param name="pPort">The port the calling process is running on.</param> /// <param name="ProcessId">An AD_PROCESS_ID structure holding the ID of the process that contains the program in question.</param> /// <param name="guidEngine">GUID of the debug engine that the program is attached to (if any).</param> /// <param name="programId">ID of the program for which to get the program node.</param> /// <param name="ppProgramNode">An IDebugProgramNode2 object representing the requested program node.</param> /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns> public virtual int GetProviderProgramNode( enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, ref Guid guidEngine, ulong programId, out IDebugProgramNode2 ppProgramNode) { Logger.Debug( string.Empty ); ppProgramNode = null; return VSConstants.E_NOTIMPL; }
// Obtains information about programs running, filtered in a variety of ways. int IDebugProgramProvider2.GetProviderProcessData(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 port, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA[] processArray) { processArray[0] = new PROVIDER_PROCESS_DATA(); // we handle creation of the remote program provider ourselves. This is because we always load our program provider locally which keeps // attach working when developing Python Tools and running/debugging from within VS and in the experimental hive. When we are installed // we install into the GAC so these types are available to create and then remote debugging works as well. When we're running in the // experimental hive we are not in the GAC so if we're created outside of VS (e.g. in msvsmon on the local machine) then we can't get // at our program provider and debug->attach doesn't work. if (port != null && port.QueryIsLocal() == VSConstants.S_FALSE) { IDebugCoreServer3 server; if (ErrorHandler.Succeeded(port.GetServer(out server))) { IDebugCoreServer90 dbgServer = server as IDebugCoreServer90; if (dbgServer != null) { Guid g = typeof(IDebugProgramProvider2).GUID; IntPtr remoteProviderPunk; int hr = dbgServer.CreateManagedInstanceInServer(typeof(AD7ProgramProvider).FullName, typeof(AD7ProgramProvider).Assembly.FullName, 0, ref g, out remoteProviderPunk); try { if (ErrorHandler.Succeeded(hr)) { var remoteProvider = (IDebugProgramProvider2)Marshal.GetObjectForIUnknown(remoteProviderPunk); return remoteProvider.GetProviderProcessData(Flags, null, ProcessId, EngineFilter, processArray); } } finally { if (remoteProviderPunk != IntPtr.Zero) { Marshal.Release(remoteProviderPunk); } } } } } else if ((Flags & enum_PROVIDER_FLAGS.PFLAG_GET_PROGRAM_NODES) != 0 ) { // The debugger is asking the engine to return the program nodes it can debug. We check // each process if it has a python##.dll or python##_d.dll loaded and if it does // then we report the program as being a Python process. if (DebugAttach.IsPythonProcess((int)ProcessId.dwProcessId)) { IDebugProgramNode2 node = new AD7ProgramNode((int)ProcessId.dwProcessId); IntPtr[] programNodes = { Marshal.GetComInterfaceForObject(node, typeof(IDebugProgramNode2)) }; IntPtr destinationArray = Marshal.AllocCoTaskMem(IntPtr.Size * programNodes.Length); Marshal.Copy(programNodes, 0, destinationArray, programNodes.Length); processArray[0].Fields = enum_PROVIDER_FIELDS.PFIELD_PROGRAM_NODES; processArray[0].ProgramNodes.Members = destinationArray; processArray[0].ProgramNodes.dwCount = (uint)programNodes.Length; return VSConstants.S_OK; } } return VSConstants.S_FALSE; }
// Establishes a callback to watch for provider events associated with specific kinds of processes int IDebugProgramProvider2.WatchForProviderEvents(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 port, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, ref Guid guidLaunchingEngine, IDebugPortNotify2 ad7EventCallback) { // The sample debug engine is a native debugger, and can therefore always provide a program node // in GetProviderProcessData. Non-native debuggers may wish to implement this method as a way // of monitoring the process before code for their runtime starts. For example, if implementing a // 'foo script' debug engine, one could attach to a process which might eventually run 'foo script' // before this 'foo script' started. // // To implement this method, an engine would monitor the target process and call AddProgramNode // when the target process started running code which was debuggable by the engine. The // enum_PROVIDER_FLAGS.PFLAG_ATTACHED_TO_DEBUGGEE flag indicates if the request is to start // or stop watching the process. return VSConstants.S_OK; }
// Establishes a callback to watch for provider events associated with specific kinds of processes int IDebugProgramProvider2.WatchForProviderEvents(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 port, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, ref Guid guidLaunchingEngine, IDebugPortNotify2 ad7EventCallback) { // The sample debug engine is a native debugger, and can therefore always provide a program node // in GetProviderProcessData. Non-native debuggers may wish to implement this method as a way // of monitoring the process before code for their runtime starts. For example, if implementing a // 'foo script' debug engine, one could attach to a process which might eventually run 'foo script' // before this 'foo script' started. // // To implement this method, an engine would monitor the target process and call AddProgramNode // when the target process started running code which was debuggable by the engine. The // enum_PROVIDER_FLAGS.PFLAG_ATTACHED_TO_DEBUGGEE flag indicates if the request is to start // or stop watching the process. return(VSConstants.S_OK); }
public int ResumeProcess(IDebugProcess2 process) { IDebugPort2 port; EngineUtils.RequireOk(process.GetPort(out port)); IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port; IDebugPortNotify2 portNotify; EngineUtils.RequireOk(defaultPort.GetPortNotify(out portNotify)); EngineUtils.RequireOk(portNotify.AddProgramNode(new MonoProgramNode(processId))); return(VSConstants.S_OK); }
public int ResumeProcess(IDebugProcess2 process) { IDebugPort2 port; EngineUtils.RequireOk(process.GetPort(out port)); IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port; IDebugPortNotify2 portNotify; EngineUtils.RequireOk(defaultPort.GetPortNotify(out portNotify)); EngineUtils.RequireOk(portNotify.AddProgramNode(_program)); Debug.WriteLine("IDebugEngineLaunch2.ResumeProcess: returning S_OK"); return(VSConstants.S_OK); }
public int ResumeProcess(IDebugProcess2 pProcess) { IDebugPort2 port; Guid id; pProcess.GetPort(out port); pProcess.GetProcessId(out id); IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port; IDebugPortNotify2 notify; defaultPort.GetPortNotify(out notify); return(notify.AddProgramNode(new MonoProgramNode(id))); }
// Resume a process launched by IDebugEngineLaunch2.LaunchSuspended int IDebugEngineLaunch2.ResumeProcess(IDebugProcess2 process) { Debug.Assert(_pollThread != null); Debug.Assert(_engineCallback != null); Debug.Assert(_debuggedProcess != null); Debug.Assert(_ad7ProgramId == Guid.Empty); try { AD_PROCESS_ID processId = EngineUtils.GetProcessId(process); if (!EngineUtils.ProcIdEquals(processId, _debuggedProcess.Id)) { return(Constants.S_FALSE); } // Send a program node to the SDM. This will cause the SDM to turn around and call IDebugEngine2.Attach // which will complete the hookup with AD7 IDebugPort2 port; EngineUtils.RequireOk(process.GetPort(out port)); IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port; IDebugPortNotify2 portNotify; EngineUtils.RequireOk(defaultPort.GetPortNotify(out portNotify)); EngineUtils.RequireOk(portNotify.AddProgramNode(new AD7ProgramNode(_debuggedProcess.Id, _engineGuid))); if (_ad7ProgramId == Guid.Empty) { Debug.Fail("Unexpected problem -- IDebugEngine2.Attach wasn't called"); return(Constants.E_FAIL); } // NOTE: We wait for the program create event to be continued before we really resume the process return(Constants.S_OK); } catch (MIException e) { return(e.HResult); } catch (Exception e) when(ExceptionHelper.BeforeCatch(e, Logger, reportOnlyCorrupting: true)) { return(EngineUtils.UnexpectedException(e)); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region IDebugProgramProvider2 Members //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int GetProviderProcessData(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 port, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA [] processArray) { // // Retrieves a list of running programs from a specified process. // LoggingUtils.PrintFunction(); try { processArray [0] = new PROVIDER_PROCESS_DATA(); if ((Flags & enum_PROVIDER_FLAGS.PFLAG_GET_PROGRAM_NODES) != 0) { // The debugger is asking the engine to return the program nodes it can debug. The // sample engine claims that it can debug all processes, and returns exactly one // program node for each process. A full-featured debugger may wish to examine the // target process and determine if it understands how to debug it. IDebugProgramNode2 node = (IDebugProgramNode2)(new DebuggeeProgram(null)); IntPtr [] programNodes = { Marshal.GetComInterfaceForObject(node, typeof(IDebugProgramNode2)) }; IntPtr destinationArray = Marshal.AllocCoTaskMem(IntPtr.Size * programNodes.Length); Marshal.Copy(programNodes, 0, destinationArray, programNodes.Length); processArray [0].Fields = enum_PROVIDER_FIELDS.PFIELD_PROGRAM_NODES; processArray [0].ProgramNodes.Members = destinationArray; processArray [0].ProgramNodes.dwCount = (uint)programNodes.Length; return(Constants.S_OK); } return(Constants.S_FALSE); } catch (Exception e) { LoggingUtils.HandleException(e); return(Constants.E_FAIL); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #region IDebugProgramProvider2 Members //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int GetProviderProcessData (enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 port, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA [] processArray) { // // Retrieves a list of running programs from a specified process. // LoggingUtils.PrintFunction (); try { processArray [0] = new PROVIDER_PROCESS_DATA (); if ((Flags & enum_PROVIDER_FLAGS.PFLAG_GET_PROGRAM_NODES) != 0) { // The debugger is asking the engine to return the program nodes it can debug. The // sample engine claims that it can debug all processes, and returns exactly one // program node for each process. A full-featured debugger may wish to examine the // target process and determine if it understands how to debug it. IDebugProgramNode2 node = (IDebugProgramNode2)(new DebuggeeProgram (null)); IntPtr [] programNodes = { Marshal.GetComInterfaceForObject (node, typeof (IDebugProgramNode2)) }; IntPtr destinationArray = Marshal.AllocCoTaskMem (IntPtr.Size * programNodes.Length); Marshal.Copy (programNodes, 0, destinationArray, programNodes.Length); processArray [0].Fields = enum_PROVIDER_FIELDS.PFIELD_PROGRAM_NODES; processArray [0].ProgramNodes.Members = destinationArray; processArray [0].ProgramNodes.dwCount = (uint)programNodes.Length; return Constants.S_OK; } return Constants.S_FALSE; } catch (Exception e) { LoggingUtils.HandleException (e); return Constants.E_FAIL; } }
/// <summary> /// Retrieves a list of running programs from a specified process. /// </summary> /// <param name="flags">A combination of flags from the <see cref="PROVIDER_FLAGS"/> enumeration.</param> /// <param name="port">The port the calling process is running on.</param> /// <param name="processId">An <see cref="AD_PROCESS_ID"/> structure holding the ID of the process that contains the program in question.</param> /// <param name="engineFilter">An array of GUIDs for debug engines assigned to debug this process (these will be used to filter the programs that are actually returned based on what the supplied engines support; if no engines are specified, then all programs will be returned).</param> /// <param name="process">A <see cref="PROVIDER_PROCESS_DATA"/> structure that is filled in with the requested information.</param> /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns> /// <remarks> /// This method is normally called by a process to obtain a list of programs running in that process. The returned information is a list of <see cref="IDebugProgramNode2"/> objects. /// </remarks> public int GetProviderProcessData(enum_PROVIDER_FLAGS flags, IDebugDefaultPort2 port, AD_PROCESS_ID processId, CONST_GUID_ARRAY engineFilter, PROVIDER_PROCESS_DATA[] process) { /* The following flags are typical for this call: * * PFLAG_REMOTE_PORT: Caller is running on remote machine. * PFLAG_DEBUGGEE: Caller is currently being debugged (additional information about marshalling is returned for each node). * PFLAG_ATTACHED_TO_DEBUGGEE: Caller was attached to but not launched by the debugger. * PFLAG_GET_PROGRAM_NODES: Caller is asking for a list of program nodes to be returned. */ #if false // make sure this request is relevant to this debug engine if (!engineFilter.AsEnumerable().Contains(JavaDebuggerConstants.JavaDebugEngineGuid)) { return(VSConstants.E_INVALIDARG); } #endif return(VSConstants.S_FALSE); }
int IDebugEngineLaunch2.ResumeProcess(IDebugProcess2 process) { var program = process as Program; if (program == null) { return(VSConstants.E_FAIL); } IDebugPort2 port; if (process.GetPort(out port) != VSConstants.S_OK) { return(VSConstants.E_FAIL); } string portName; port.GetPortName(out portName); Guid guidPort; port.GetPortId(out guidPort); IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port; IDebugPortNotify2 portNotify; if (defaultPort.GetPortNotify(out portNotify) != VSConstants.S_OK) { return(VSConstants.E_FAIL); } if (portNotify.AddProgramNode(program) != VSConstants.S_OK) { return(VSConstants.E_FAIL); } return(VSConstants.S_OK); }
int IDebugProgramProvider2.GetProviderProcessData(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA[] pProcess) { throw new NotImplementedException(); }
int IDebugProgramProvider2.GetProviderProgramNode(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, ref Guid guidEngine, ulong programId, out IDebugProgramNode2 ppProgramNode) { throw new NotImplementedException(); }
// Gets a program node, given a specific process ID. int IDebugProgramProvider2.GetProviderProgramNode(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 port, AD_PROCESS_ID ProcessId, ref Guid guidEngine, ulong programId, out IDebugProgramNode2 programNode) { // This method is used for Just-In-Time debugging support, which this program provider does not support programNode = null; return VSConstants.E_NOTIMPL; }
public int GetProviderProgramNode(uint Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, ref Guid guidEngine, ulong programId, out IDebugProgramNode2 ppProgramNode) { ppProgramNode = null; return(S_FALSE); }
public int GetProviderProgramNode(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, ref Guid guidEngine, ulong programId, out IDebugProgramNode2 ppProgramNode) { Log.Debug("ProgramProvider: GetProviderProgramNode"); ppProgramNode = null; return VSConstants.S_OK; }
// Gets a program node, given a specific process ID. int IDebugProgramProvider2.GetProviderProgramNode(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 port, AD_PROCESS_ID ProcessId, ref Guid guidEngine, ulong programId, out IDebugProgramNode2 programNode) { // This method is used for Just-In-Time debugging support, which this program provider does not support programNode = null; return(VSConstants.E_NOTIMPL); }
public int WatchForProviderEvents(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, ref Guid guidLaunchingEngine, IDebugPortNotify2 pEventCallback) { DebugHelper.TraceEnteringMethod(); return(VSConstants.S_OK); }
/// <summary> /// Obtains information about programs running, filtered in a variety of ways. /// </summary> /// <param name="flags">The flags.</param> /// <param name="port">The port.</param> /// <param name="processId">The process identifier.</param> /// <param name="engineFilter">The engine filter.</param> /// <param name="process">The process.</param> /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns> public int GetProviderProcessData(enum_PROVIDER_FLAGS flags, IDebugDefaultPort2 port, AD_PROCESS_ID processId, CONST_GUID_ARRAY engineFilter, PROVIDER_PROCESS_DATA[] process) { return(S_FALSE); }
// Resume a process launched by IDebugEngineLaunch2.LaunchSuspended int IDebugEngineLaunch2.ResumeProcess(IDebugProcess2 process) { Debug.WriteLine("Python Debugger ResumeProcess Begin"); AssertMainThread(); if (_events == null) { // process failed to start Debug.WriteLine("ResumeProcess fails, no events"); return(VSConstants.E_FAIL); } Debug.Assert(_events != null); Debug.Assert(_process != null); Debug.Assert(_process != null); Debug.Assert(_ad7ProgramId == Guid.Empty); int processId = EngineUtils.GetProcessId(process); if (processId != _process.Id) { Debug.WriteLine("ResumeProcess fails, wrong process"); return(VSConstants.S_FALSE); } // Send a program node to the SDM. This will cause the SDM to turn around and call IDebugEngine2.Attach // which will complete the hookup with AD7 IDebugPort2 port; EngineUtils.RequireOk(process.GetPort(out port)); IDebugDefaultPort2 defaultPort = (IDebugDefaultPort2)port; IDebugPortNotify2 portNotify; EngineUtils.RequireOk(defaultPort.GetPortNotify(out portNotify)); EngineUtils.RequireOk(portNotify.AddProgramNode(new AD7ProgramNode(_process.Id))); if (_ad7ProgramId == Guid.Empty) { Debug.WriteLine("ResumeProcess fails, empty program guid"); Debug.Fail("Unexpected problem -- IDebugEngine2.Attach wasn't called"); return(VSConstants.E_FAIL); } // wait for the load event to complete, and pump messages while (!_process.HasExited && !_loadComplete.WaitOne(100)) { Debug.WriteLine("ResumeProcess waiting for load complete"); } // Resume the threads in the debuggee process if (_process.HasExited) { Debug.WriteLine("ResumeProcess resume all"); _process.Resume(); } else { // return failure? Debug.WriteLine("Process exited"); } Debug.WriteLine("ResumeProcess return S_OK"); return(VSConstants.S_OK); }
int IDebugProgramProvider2.GetProviderProcessData(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA[] pProcess) { return(VSConstants.S_FALSE); }
public int GetProviderProgramNode(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, ref Guid guidEngine, ulong programId, out IDebugProgramNode2 ppProgramNode) { ppProgramNode = null; return 0; }
public int GetProviderProcessData(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA[] pProcess) { pProcess[0] = new PROVIDER_PROCESS_DATA(); return VSConstants.S_OK; }
/// <summary> /// Gets a program node, given a specific process ID. /// </summary> /// <param name="flags">The flags.</param> /// <param name="port">The port.</param> /// <param name="processId">The process identifier.</param> /// <param name="guidEngine">The unique identifier engine.</param> /// <param name="programId">The program identifier.</param> /// <param name="programNode">The program node.</param> /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns> public int GetProviderProgramNode(enum_PROVIDER_FLAGS flags, IDebugDefaultPort2 port, AD_PROCESS_ID processId, ref Guid guidEngine, ulong programId, out IDebugProgramNode2 programNode) { programNode = null; return(S_FALSE); }
int IDebugProgramProvider2.WatchForProviderEvents(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, ref Guid guidLaunchingEngine, IDebugPortNotify2 pEventCallback) { return VSConstants.S_OK; }
public int GetProviderProgramNode(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, ref Guid guidEngine, ulong programId, out IDebugProgramNode2 ppProgramNode) { throw new NotImplementedException(); }
/// <summary> /// Allows the process to be notified of port events. /// </summary> /// <param name="Flags"> /// A combination of flags from the PROVIDER_FLAGS enumeration. The following flags are typical for this call: /// /// Flag Description /// PFLAG_REMOTE_PORT Caller is running on remote machine. /// PFLAG_DEBUGGEE Caller is currently being debugged (additional information about marshalling is returned for each node). /// PFLAG_ATTACHED_TO_DEBUGGEE Caller was attached to but not launched by the debugger. /// PFLAG_REASON_WATCH Caller wants to watch for events. If this flag is not set. then the callback event is removed and the caller no longer receives notifications. /// </param> /// <param name="pPort">The port the calling process is running on.</param> /// <param name="ProcessId">An AD_PROCESS_ID structure holding the ID of the process that contains the program in question.</param> /// <param name="EngineFilter">An array of GUIDs of debug engines associated with the process.</param> /// <param name="guidLaunchingEngine">GUID of the debug engine that launched this process (if any).</param> /// <param name="pEventCallback">An IDebugPortNotify2 object that receives the event notifications.</param> /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns> /// <remarks>When a caller wants to remove an event handler that was established with a previous call to this method, the caller passes the same parameters as it did the first time but leaves off the PFLAG_REASON_WATCH flag.</remarks> public virtual int WatchForProviderEvents( enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, ref Guid guidLaunchingEngine, IDebugPortNotify2 pEventCallback) { Logger.Debug( string.Empty ); return VSConstants.E_NOTIMPL; }
int IDebugProgramProvider2.GetProviderProgramNode(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, ref Guid guidEngine, ulong programId, out IDebugProgramNode2 ppProgramNode) { ppProgramNode = null; return(VSConstants.E_NOTIMPL); }
public int GetProviderProcessData(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA[] pProcess) { DebugHelper.TraceEnteringMethod(); return(VSConstants.S_OK); }
public int GetProviderProgramNode(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, ref Guid guidEngine, ulong programId, out IDebugProgramNode2 ppProgramNode) { Log.Debug("ProgramProvider: GetProviderProgramNode"); ppProgramNode = null; return(VSConstants.S_OK); }
public int GetProviderProcessData(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA[] pProcess) { throw new NotImplementedException(); }
public int WatchForProviderEvents(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, ref Guid guidLaunchingEngine, IDebugPortNotify2 pEventCallback) { Log.Debug("ProgramProvider: WatchForProviderEvents"); return(VSConstants.S_OK); }
public int WatchForProviderEvents(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, ref Guid guidLaunchingEngine, IDebugPortNotify2 pEventCallback) { return(0); }
public int GetProviderProcessData(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA[] pProcess) { DebugHelper.TraceEnteringMethod(); return VSConstants.S_OK; }
// Obtains information about programs running, filtered in a variety of ways. int IDebugProgramProvider2.GetProviderProcessData(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 port, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA[] processArray) { processArray[0] = new PROVIDER_PROCESS_DATA(); // we handle creation of the remote program provider ourselves. This is because we always load our program provider locally which keeps // attach working when developing Python Tools and running/debugging from within VS and in the experimental hive. When we are installed // we install into the GAC so these types are available to create and then remote debugging works as well. When we're running in the // experimental hive we are not in the GAC so if we're created outside of VS (e.g. in msvsmon on the local machine) then we can't get // at our program provider and debug->attach doesn't work. if (port != null && port.QueryIsLocal() == VSConstants.S_FALSE) { if (ErrorHandler.Succeeded(port.GetServer(out var server))) { var dbgServer = server as IDebugCoreServer90; if (dbgServer != null) { var g = typeof(IDebugProgramProvider2).GUID; var hr = dbgServer.CreateManagedInstanceInServer(typeof(AD7ProgramProvider).FullName, typeof(AD7ProgramProvider).Assembly.FullName, 0, ref g, out var remoteProviderPunk); try { if (ErrorHandler.Succeeded(hr)) { var remoteProvider = (IDebugProgramProvider2)Marshal.GetObjectForIUnknown(remoteProviderPunk); return(remoteProvider.GetProviderProcessData(Flags, null, ProcessId, EngineFilter, processArray)); } } finally { if (remoteProviderPunk != IntPtr.Zero) { Marshal.Release(remoteProviderPunk); } } } } } else if ((Flags & enum_PROVIDER_FLAGS.PFLAG_GET_PROGRAM_NODES) != 0) { // The debugger is asking the engine to return the program nodes it can debug. We check // each process if it has a python##.dll or python##_d.dll loaded and if it does // then we report the program as being a Python process. /* * if (DebugAttach.IsPythonProcess((int)ProcessId.dwProcessId)) { * IDebugProgramNode2 node = new AD7ProgramNode((int)ProcessId.dwProcessId); * * IntPtr[] programNodes = { Marshal.GetComInterfaceForObject(node, typeof(IDebugProgramNode2)) }; * * IntPtr destinationArray = Marshal.AllocCoTaskMem(IntPtr.Size * programNodes.Length); * Marshal.Copy(programNodes, 0, destinationArray, programNodes.Length); * * processArray[0].Fields = enum_PROVIDER_FIELDS.PFIELD_PROGRAM_NODES; * processArray[0].ProgramNodes.Members = destinationArray; * processArray[0].ProgramNodes.dwCount = (uint)programNodes.Length; * * return VSConstants.S_OK; * }*/ } return(VSConstants.S_FALSE); }
public int GetProviderProcessData(uint Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA[] pProcess) { return(S_FALSE); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public int GetProviderProgramNode (enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, ref Guid guidEngine, ulong programId, out IDebugProgramNode2 ppProgramNode) { // // Retrieves the program node for a specific program. Not implemented. // LoggingUtils.PrintFunction (); ppProgramNode = null; // This method is used for Just-In-Time debugging support, which this program provider does not support return Constants.E_NOTIMPL; }
public int WatchForProviderEvents(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, ref Guid guidLaunchingEngine, IDebugPortNotify2 pEventCallback) { DebugHelper.TraceEnteringMethod(); return VSConstants.S_OK; }
public int GetProviderProcessData(enum_PROVIDER_FLAGS Flags, IDebugDefaultPort2 pPort, AD_PROCESS_ID ProcessId, CONST_GUID_ARRAY EngineFilter, PROVIDER_PROCESS_DATA[] pProcess) { pProcess[0] = new PROVIDER_PROCESS_DATA(); return(VSConstants.S_OK); }
public int WatchForProviderEvents(enum_PROVIDER_FLAGS flags, IDebugDefaultPort2 port, AD_PROCESS_ID processId, CONST_GUID_ARRAY engineFilter, ref Guid guidLaunchingEngine, IDebugPortNotify2 eventCallback) { return(VSConstants.S_OK); }