Exemple #1
0
        /**
         * Are there managed callbacks queued up for the requested thread?
         */

        public bool HasQueuedCallbacks(CorThread managedThread)
        {
            int queued = 0;
            m_controller.HasQueuedCallbacks((managedThread == null) ? null : managedThread.GetInterface(),
                                            out queued
                );
            return !(queued == 0);
        }
Exemple #2
0
        /**
         * Are there managed callbacks queued up for the requested thread?
         */

        public bool HasQueuedCallbacks(CorThread managedThread)
        {
            int queued = 0;

            m_controller.HasQueuedCallbacks((managedThread == null) ? null : managedThread.GetInterface(),
                                            out queued
                                            );
            return(!(queued == 0));
        }
        //
        // IEnumerator interface
        //

        #region IEnumerator Members

        public bool MoveNext()
        {
            var a = new ICorDebugThread[1];
            uint c = 0;
            int r = m_enum.Next((uint) a.Length, a, out c);
            if (r == 0 && c == 1) // S_OK && we got 1 new element
                m_th = new CorThread(a[0]);
            else
                m_th = null;
            return m_th != null;
        }
        //
        // IEnumerator interface
        //

        #region IEnumerator Members

        public bool MoveNext()
        {
            var  a = new ICorDebugThread[1];
            uint c = 0;
            int  r = m_enum.Next((uint)a.Length, a, out c);

            if (r == 0 && c == 1) // S_OK && we got 1 new element
            {
                m_th = new CorThread(a[0]);
            }
            else
            {
                m_th = null;
            }
            return(m_th != null);
        }
Exemple #5
0
        private void InternalSignalRuntimeIsStopped(CorThread activeThread, Object stopReason)
        {
            lock (this)
            {
                // we need to be very carefull here. Debugger API is not reentrant.
                // Normally this method is called only from callback to signal to main thread
                // that debuggee has stopped but there is one important exception -- async break.
                // When we do async-break we are calling AsyncStop() method from another thread, which
                // is calling InternalSignalRuntimeIsStopped. Therefore we can be running this function
                // from async-break thread and from managed callback thread. Because this method is
                // calling DebuggerAPI and functions there are not reentrant, bad thinkgs are happening.
                // .

                OriginalMDbgMessages.WriteLine("InternalSignalRuntimeIsStopped (" + stopReason + ")");

                m_stopCount++;
                OriginalMDbgMessages.WriteLine("Increasing StopCount to " + m_stopCount + " (" + stopReason + ")");

                m_stopReason = stopReason;

                if (activeThread != null)
                {
                    if (!m_threadMgr.HaveActive || !m_processAttaching)
                    {
                        m_threadMgr.SetActiveThread(activeThread);
                    }
                    MDbgThread t = m_threadMgr.GetThreadFromThreadId(activeThread.Id);

                    // now check if we are in a special seqence point -- if so than just do another step.
                    try
                    {
                        MDbgSourcePosition sp = t.CurrentSourcePosition;

                        if (sp != null && sp.IsSpecial && (stopReason is StepCompleteStopReason))
                        {
                            // we want to perform antother step when we end-up in special seqence point
                            // only if we are stopped because of StepComplete. If we are stopped for any other
                            // reason (e.g. ExceptionThrown, we should not make any other steps since then we
                            // would receive stop reason for StepComplete and not for ExceptionThrown).

                            OriginalMDbgMessages.WriteLine("Making another step because of special line number (0xfeefee)");

                            StepImpl(false, false);
                            return; // we will be called again
                        }
                    }
                    catch (MDbgNoCurrentFrameException)
                    {
                        // if we don't have current frame, let's ignore it.
                    }
                }
                else
                {
                    m_threadMgr.SetActiveThread(null);
                }

                if (IsAlive)
                    m_engine.Processes.Active = this;

                OriginalMDbgMessages.WriteLine("Signaling Real Stop (" + stopReason + ")");

                m_processAttaching = false;
                Thread.Sleep(100);
                // we are not interested in completing step
                if (m_activeStepper != null)
                    try
                    {
                        m_activeStepper.Deactivate();
                    }
                    catch (COMException)
                    {
                        // let's ignore if we cannot deactivate the stepper
                        // This can happen in cases where the app finishes
                        // (we receive ExitProcess callback) but we have outstanding
                        // stepper.
                    }


                m_stopCounter = g_stopCounter++;
                m_stopEvent.Set();
            }
        }
 public CorEvalEventArgs(CorAppDomain appDomain, CorThread thread,
                         CorEval eval)
     : base(appDomain, thread)
 {
     m_eval = eval;
 }
 public CorExceptionEventArgs(CorAppDomain appDomain,
                              CorThread thread,
                              bool unhandled)
     : base(appDomain, thread)
 {
     m_unhandled = unhandled;
 }
 public CorStepCompleteEventArgs(CorAppDomain appDomain, CorThread thread,
                                 CorStepper stepper, CorDebugStepReason stepReason)
     : base(appDomain, thread)
 {
     m_stepper = stepper;
     m_stepReason = stepReason;
 }
 public CorFunctionRemapOpportunityEventArgs(CorAppDomain appDomain,
                                             CorThread thread,
                                             CorFunction oldFunction,
                                             CorFunction newFunction,
                                             int oldILoffset
     )
     : base(appDomain, thread)
 {
     m_oldFunction = oldFunction;
     m_newFunction = newFunction;
     m_oldILoffset = oldILoffset;
 }
 public CorBreakpointSetErrorEventArgs(CorAppDomain appDomain,
                                       CorThread thread,
                                       CorBreakpoint breakpoint,
                                       int errorCode,
                                       ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_breakpoint = breakpoint;
     m_errorCode = errorCode;
 }
 public CorBreakpointSetErrorEventArgs(CorAppDomain appDomain,
                                       CorThread thread,
                                       CorBreakpoint breakpoint,
                                       int errorCode)
     : base(appDomain, thread)
 {
     m_breakpoint = breakpoint;
     m_errorCode = errorCode;
 }
 public CorEditAndContinueRemapEventArgs(CorAppDomain appDomain,
                                         CorThread thread,
                                         CorFunction managedFunction,
                                         int accurate,
                                         ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_managedFunction = managedFunction;
     m_accurate = accurate;
 }
 public CorMDAEventArgs(CorMDA mda, CorThread thread, CorProcess proc,
                        ManagedCallbackType callbackType)
     : base(proc, callbackType)
 {
     m_mda = mda;
     Thread = thread;
     //m_proc = proc;
 }
 public CorMDAEventArgs(CorMDA mda, CorThread thread, CorProcess proc)
     : base(proc)
 {
     m_mda = mda;
     Thread = thread;
     //m_proc = proc;
 }
 public CorFunctionRemapOpportunityEventArgs(CorAppDomain appDomain,
                                             CorThread thread,
                                             CorFunction oldFunction,
                                             CorFunction newFunction,
                                             int oldILoffset,
                                             ManagedCallbackType callbackType
     )
     : base(appDomain, thread, callbackType)
 {
     m_oldFunction = oldFunction;
     m_newFunction = newFunction;
     m_oldILoffset = oldILoffset;
 }
 public CorLogSwitchEventArgs(CorAppDomain appDomain, CorThread thread,
                              int level, int reason, string logSwitchName, string parentName,
                              ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_level = level;
     m_reason = reason;
     m_logSwitchName = logSwitchName;
     m_parentName = parentName;
 }
 public CorFunctionRemapCompleteEventArgs(CorAppDomain appDomain,
                                          CorThread thread,
                                          CorFunction managedFunction
     )
     : base(appDomain, thread)
 {
     m_managedFunction = managedFunction;
 }
 public CorStepCompleteEventArgs(CorAppDomain appDomain, CorThread thread,
                                 CorStepper stepper, CorDebugStepReason stepReason,
                                 ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_stepper = stepper;
     m_stepReason = stepReason;
 }
 public CorFunctionRemapCompleteEventArgs(CorAppDomain appDomain,
                                          CorThread thread,
                                          CorFunction managedFunction,
                                          ManagedCallbackType callbackType
     )
     : base(appDomain, thread, callbackType)
 {
     m_managedFunction = managedFunction;
 }
 public CorExceptionEventArgs(CorAppDomain appDomain,
                              CorThread thread,
                              bool unhandled,
                              ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_unhandled = unhandled;
 }
 public CorExceptionUnwind2EventArgs(CorAppDomain appDomain, CorThread thread,
                                     CorDebugExceptionUnwindCallbackType eventType,
                                     int flags,
                                     ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_eventType = eventType;
     m_flags = flags;
 }
 public CorEvalEventArgs(CorAppDomain appDomain, CorThread thread,
                         CorEval eval, ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_eval = eval;
 }
 public CorException2EventArgs(CorAppDomain appDomain,
                               CorThread thread,
                               CorFrame frame,
                               int offset,
                               CorDebugExceptionCallbackType eventType,
                               int flags,
                               ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_frame = frame;
     m_offset = offset;
     m_eventType = eventType;
     m_flags = flags;
 }
Exemple #24
0
            void IMDbgProcessController.Stop(CorThread activeThread, object stopReason)
            {
                if (process == null)
                    throw new InvalidOperationException("Process controller is not active anymore");

                if (needAsyncStopCall)
                {
                    process.CorProcess.Stop(int.MaxValue);
                    process.m_stopCount++;
                }
                eventArgs.Continue = false; // signal to CorLayer that we want to stop
                process.InternalSignalRuntimeIsStopped(activeThread, stopReason);
                customStopRequested = true;
            }
 public CorThreadEventArgs(CorAppDomain appDomain, CorThread thread)
     : base(appDomain != null ? appDomain : thread.AppDomain)
 {
     Thread = thread;
 }
Exemple #26
0
 public void SetAllThreadsDebugState(CorDebugThreadState state, CorThread exceptThis)
 {
     m_controller.SetAllThreadsDebugState(state, exceptThis != null ? exceptThis.GetInterface() : null);
 }
 public CorThreadEventArgs(CorAppDomain appDomain, CorThread thread,
                           ManagedCallbackType callbackType)
     : base(appDomain != null ? appDomain : thread.AppDomain, callbackType)
 {
     Thread = thread;
 }
Exemple #28
0
 public void SetAllThreadsDebugState(CorDebugThreadState state, CorThread exceptThis)
 {
     m_controller.SetAllThreadsDebugState(state, exceptThis != null ? exceptThis.GetInterface() : null);
 }
 public CorBreakpointEventArgs(CorAppDomain appDomain,
                               CorThread thread,
                               CorBreakpoint managedBreakpoint)
     : base(appDomain, thread)
 {
     m_break = managedBreakpoint;
 }
 public void Reset()
 {
     m_enum.Reset();
     m_th = null;
 }
 public CorBreakpointEventArgs(CorAppDomain appDomain,
                               CorThread thread,
                               CorBreakpoint managedBreakpoint,
                               ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_break = managedBreakpoint;
 }
 public void Reset()
 {
     m_enum.Reset();
     m_th = null;
 }
 public CorLogMessageEventArgs(CorAppDomain appDomain, CorThread thread,
                               int level, string logSwitchName, string message,
                               ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_level = level;
     m_logSwitchName = logSwitchName;
     m_message = message;
 }