Ejemplo n.º 1
0
        int IDebugEngine2.Attach(IDebugProgram2[] rgpPrograms, IDebugProgramNode2[] rgpProgramNodes, uint aCeltPrograms, IDebugEventCallback2 ad7Callback, enum_ATTACH_REASON dwReason)
        {
            // Attach the debug engine to a program.
            //
            // Attach can either be called to attach to a new process, or to complete an attach
            // to a launched process.
            // So could we simplify and move code from LaunchSuspended to here and maybe even
            // eliminate the debughost? Although I supposed DebugHost has some other uses as well.

            if (aCeltPrograms != 1)
            {
                System.Diagnostics.Debug.Fail("Cosmos Debugger only supports one debug target at a time.");
                throw new ArgumentException();
            }

            try {
                EngineUtils.RequireOk(rgpPrograms[0].GetProgramId(out mProgramID));

                mProgram = rgpPrograms[0];
                AD7EngineCreateEvent.Send(this);
                AD7ProgramCreateEvent.Send(this);
                AD7ModuleLoadEvent.Send(this, mModule, true);

                // Dummy main thread
                // We dont support threads yet, but the debugger expects threads.
                // So we create a dummy object to represente our only "thread".
                mThread = new AD7Thread(this, mProcess);
                AD7LoadCompleteEvent.Send(this, mThread);
            } catch (Exception e) {
                return(EngineUtils.UnexpectedException(e));
            }
            return(VSConstants.S_OK);
        }
Ejemplo n.º 2
0
    public void OnModuleLoad(AD7Module aModule) {
      // This will get called when the entrypoint breakpoint is fired because the engine sends a mod-load event
      // for the exe.
      //if (m_engine.DebuggedProcess != null) {
      //    System.Diagnostics.Debug.Assert(Worker.CurrentThreadId == m_engine.DebuggedProcess.PollThreadId);
      //}

      AD7ModuleLoadEvent eventObject = new AD7ModuleLoadEvent(aModule, true /* this is a module load */);
      Send(eventObject, AD7ModuleLoadEvent.IID, null);
    }
Ejemplo n.º 3
0
        public void OnModuleLoad(AD7Module aModule)
        {
            // This will get called when the entrypoint breakpoint is fired because the engine sends a mod-load event
            // for the exe.
            //if (m_engine.DebuggedProcess != null) {
            //    System.Diagnostics.Debug.Assert(Worker.CurrentThreadId == m_engine.DebuggedProcess.PollThreadId);
            //}

            AD7ModuleLoadEvent eventObject = new AD7ModuleLoadEvent(aModule, true /* this is a module load */);

            Send(eventObject, AD7ModuleLoadEvent.IID, null);
        }
Ejemplo n.º 4
0
        internal static void Send(AD7Engine engine, AD7Module aModule, bool fLoad)
        {
            var eventObject = new AD7ModuleLoadEvent(aModule, fLoad);

            engine.Callback.Send(eventObject, IID, null);
        }
Ejemplo n.º 5
0
 internal static void Send(AD7Engine engine, AD7Module aModule, bool fLoad)
 {
     var eventObject = new AD7ModuleLoadEvent(aModule, fLoad);
     engine.Callback.Send(eventObject, IID, null);
 }