Example #1
0
 public DebuggerErrorEventArgs(Process process, int hresult,
                               int errorCode, ManagedCallbackType callbackType)
     : base(process, callbackType)
 {
     m_hresult   = hresult;
     m_errorCode = errorCode;
 }
Example #2
0
 public void DispatchEvent(ManagedCallbackType callback, CorEventArgs e)
 {
     try
     {
         if (m_callbackAttachedEvent != null)
         {
             isWaiting = true;
             m_callbackAttachedEvent.WaitOne(); // waits till callbacks are enabled
         }
         var d = m_callbacksArray[callback];
         d(this, e);
     }
     catch (Exception ex)
     {
         var e2 = new ExceptionInCallbackEventArgs(e.Controller, ex);
         Debug.Assert(false, "Exception in callback: " + ex.ToString());
         try
         {
             // we need to dispatch the exceptin in callback error, but we cannot
             // use DispatchEvent since throwing exception in ExceptionInCallback
             // would lead to infinite recursion.
             Debug.Assert(m_callbackAttachedEvent == null);
             var d = m_callbacksArray[ManagedCallbackType.OnExceptionInCallback];
             d(this, e2);
         }
         catch (Exception ex2)
         {
             Debug.Assert(false, "Exception in Exception notification callback: " + ex2.ToString());
             // ignore it -- there is nothing we can do.
         }
         e.Continue = e2.Continue;
     }
 }
Example #3
0
 public StepCompleteEventArgs(AppDomain appDomain, Thread thread,
                              Stepper stepper, CorDebugStepReason stepReason,
                              ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_stepper    = stepper;
     m_stepReason = stepReason;
 }
Example #4
0
 public UpdateModuleSymbolsEventArgs(AppDomain appDomain,
                                     Module managedModule,
                                     IStream stream,
                                     ManagedCallbackType callbackType)
     : base(appDomain, managedModule, callbackType)
 {
     m_stream = stream;
 }
Example #5
0
 public MDAEventArgs(MDA mda, Thread thread, Process proc,
                     ManagedCallbackType callbackType)
     : base(proc, callbackType)
 {
     m_mda  = mda;
     Thread = thread;
     //m_proc = proc;
 }
Example #6
0
 public ExceptionEventArgs(AppDomain appDomain,
                           Thread thread,
                           bool unhandled,
                           ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_unhandled = unhandled;
 }
Example #7
0
 public BreakpointEventArgs(AppDomain appDomain,
                            Thread thread,
                            Breakpoint managedBreakpoint,
                            ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_break = managedBreakpoint;
 }
Example #8
0
 /// <summary>
 /// Adds an MDbgStopOptionPolicy object to the collection of stop option policies,
 /// and registers it for a type of callback
 /// </summary>
 /// <param name="sop">The stop option policy to add.</param>
 /// <param name="callbackType">The type of callback to register the stop option
 /// policy for.</param>
 public void Add(MDbgStopOptionPolicy sop, ManagedCallbackType callbackType)
 {
     if (m_stopOptions[(int)callbackType] == null)
     {
         m_stopOptions[(int)callbackType] = new List <MDbgStopOptionPolicy>();
     }
     m_stopOptions[(int)callbackType].Add(sop);
 }
Example #9
0
 public ExceptionUnwind2EventArgs(AppDomain appDomain, Thread thread,
                                  CorDebugExceptionUnwindCallbackType eventType,
                                  int flags,
                                  ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_eventType = eventType;
     m_flags     = flags;
 }
Example #10
0
 public FunctionRemapCompleteEventArgs(AppDomain appDomain,
                                       Thread thread,
                                       Function managedFunction,
                                       ManagedCallbackType callbackType
                                       )
     : base(appDomain, thread, callbackType)
 {
     m_managedFunction = managedFunction;
 }
Example #11
0
 /// <summary>
 /// Expose direct dispatch logic so that other event dispatchers can
 /// use CorProcess's event handlers.
 /// </summary>
 /// <param name="callback">callback type to dispatch</param>
 /// <param name="e">event arguments used to dispatch</param>
 public void DirectDispatchEvent(ManagedCallbackType callback, CorEventArgs e)
 {
     Debug.Assert(callback == e.CallbackType);
     if (m_callbackAttachedEvent != null)
     {
         m_callbackAttachedEvent.Set();
     }
     DispatchEvent(callback, e);
 }
Example #12
0
 public LogMessageEventArgs(AppDomain appDomain, Thread thread,
                            int level, string logSwitchName, string message,
                            ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_level         = level;
     m_logSwitchName = logSwitchName;
     m_message       = message;
 }
Example #13
0
 public BreakpointSetErrorEventArgs(AppDomain appDomain,
                                    Thread thread,
                                    Breakpoint breakpoint,
                                    int errorCode,
                                    ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_breakpoint = breakpoint;
     m_errorCode  = errorCode;
 }
Example #14
0
 public LogSwitchEventArgs(AppDomain appDomain, Thread 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;
 }
Example #15
0
 public EditAndContinueRemapEventArgs(AppDomain appDomain,
                                      Thread thread,
                                      Function managedFunction,
                                      int accurate,
                                      ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_managedFunction = managedFunction;
     m_accurate        = accurate;
 }
Example #16
0
 public FunctionRemapOpportunityEventArgs(AppDomain appDomain,
                                          Thread thread,
                                          Function oldFunction,
                                          Function newFunction,
                                          int oldILoffset,
                                          ManagedCallbackType callbackType
                                          )
     : base(appDomain, thread, callbackType)
 {
     m_oldFunction = oldFunction;
     m_newFunction = newFunction;
     m_oldILoffset = oldILoffset;
 }
Example #17
0
 public Exception2EventArgs(AppDomain appDomain,
                            Thread thread,
                            Frame 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;
 }
        /// <summary>
        /// Handle the Debug Event of the MDbgProcess.
        /// </summary>
        void MDbgProcess_PostDebugEvent(object sender, CustomPostCallbackEventArgs e)
        {
            this.stopReason = e.CallbackType;

            switch (this.stopReason)
            {
            case ManagedCallbackType.OnException:
                CorExceptionEventArgs exceptionEventArgs =
                    e.CallbackArgs as CorExceptionEventArgs;
                this.isExceptionUnhandled =
                    exceptionEventArgs != null && exceptionEventArgs.Unhandled;
                break;

            default:
                break;
            }
        }
Example #19
0
        internal void DispatchEvent(ManagedCallbackType callback, CorEventArgs e)
        {
            try
            {
                // CorProcess.Continue has an extra abstraction layer.
                // - The fist call just sets m_callbackAttachedEvent
                // - future calls go to ICorDebugProcess::Continue.
                // This ensures that we don't dispatch any callbacks until
                // after CorProcess.Continue() is called.
                if (m_callbackAttachedEvent != null)
                {
                    m_callbackAttachedEvent.WaitOne(); // waits till callbacks are enabled
                }

                Debug.Assert((int)callback >= 0 && (int)callback < m_callbacksArray.Length);
                Delegate d = m_callbacksArray[(int)callback];
                if (d != null)
                {
                    d.DynamicInvoke(new Object[] { this, e });
                }
            }
            catch (Exception ex)
            {
                CorExceptionInCallbackEventArgs e2 = new CorExceptionInCallbackEventArgs(e.Controller, ex);
                Debug.Assert(false, "Exception in callback: " + ex.ToString());
                try
                {
                    // we need to dispatch the exception in callback error, but we cannot
                    // use DispatchEvent since throwing exception in ExceptionInCallback
                    // would lead to infinite recursion.
                    Debug.Assert(m_callbackAttachedEvent == null);
                    Delegate d = m_callbacksArray[(int)ManagedCallbackType.OnExceptionInCallback];
                    if (d != null)
                    {
                        d.DynamicInvoke(new Object[] { this, e2 });
                    }
                }
                catch (Exception ex2)
                {
                    Debug.Assert(false, "Exception in Exception notification callback: " + ex2.ToString());
                    // ignore it -- there is nothing we can do.
                }
                e.Continue = e2.Continue;
            }
        }
Example #20
0
        // when process is first created wait till callbacks are enabled.

        internal void DispatchEvent(ManagedCallbackType callback, CorEventArgs e)
        {
            try
            {
                if (m_callbackAttachedEvent != null)
                {
                    m_callbackAttachedEvent.WaitOne(); // waits till callbacks are enabled
                }
                Debug.Assert((int)callback >= 0 && (int)callback < m_callbacksArray.Length);
                Delegate d = m_callbacksArray[(int)callback];
                if (d != null)
                {
                    d.DynamicInvoke(new Object[] { this, e });
                }
            }
            catch (Exception ex)
            {
                var e2 = new CorExceptionInCallbackEventArgs(e.Controller, ex);

                OriginalMDbgMessages.WriteLine("Exception in callback: " + ex);
                // DC Debug.Assert(false,"Exception in callback: "+ex.ToString());

                try
                {
                    // we need to dispatch the exceptin in callback error, but we cannot
                    // use DispatchEvent since throwing exception in ExceptionInCallback
                    // would lead to infinite recursion.
                    Debug.Assert(m_callbackAttachedEvent == null);
                    Delegate d = m_callbacksArray[(int)ManagedCallbackType.OnExceptionInCallback];
                    if (d != null)
                    {
                        d.DynamicInvoke(new Object[] { this, e2 });
                    }
                }
                catch (Exception ex2)
                {
                    OriginalMDbgMessages.WriteLine("Exception in Exception notification callback: " + ex2);
                    // DC Debug.Assert(false,"Exception in Exception notification callback: "+ex2.ToString());
                    // ignore it -- there is nothing we can do.
                }
                e.Continue = e2.Continue;
            }
        }
Example #21
0
 public CorExceptionUnwind2EventArgs(CorAppDomain appDomain, CorThread thread,
                                     CorDebugExceptionUnwindCallbackType eventType,
                                     int flags,
                                     ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_eventType = eventType;
     m_flags = flags;
 }
Example #22
0
 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;
 }
Example #23
0
 public CorEditAndContinueRemapEventArgs(CorAppDomain appDomain,
                                 CorThread thread,
                                 CorFunction managedFunction,
                                 int accurate,
                                 ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_managedFunction = managedFunction;
     m_accurate = accurate;
 }
Example #24
0
 public CorUpdateModuleSymbolsEventArgs(CorAppDomain appDomain,
                                         CorModule managedModule,
                                         IStream stream,
                                         ManagedCallbackType callbackType)
     : base(appDomain, managedModule, callbackType)
 {
     m_stream = stream;
 }
Example #25
0
 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;
 }
Example #26
0
 public ClassEventArgs(AppDomain appDomain, Class managedClass,
                       ManagedCallbackType callbackType)
     : base(appDomain, callbackType)
 {
     m_class = managedClass;
 }
Example #27
0
 public CorProcessEventArgs(CorProcess process, ManagedCallbackType callbackType)
     : base(process, callbackType)
 {
 }
Example #28
0
 public AppDomainBaseEventArgs(AppDomain ad, ManagedCallbackType callbackType)
     : base(ad, callbackType)
 {
 }
Example #29
0
 public ThreadEventArgs(AppDomain appDomain, Thread thread,
                        ManagedCallbackType callbackType)
     : base(appDomain != null ? appDomain : thread.AppDomain, callbackType)
 {
     Thread = thread;
 }
Example #30
0
 public ExceptionInCallbackEventArgs(Controller controller, Exception exceptionThrown,
                                     ManagedCallbackType callbackType)
     : base(controller, callbackType)
 {
     m_exceptionThrown = exceptionThrown;
 }
Example #31
0
 public CorEventArgs(Controller controller, ManagedCallbackType callbackType)
 {
     m_controller   = controller;
     m_continue     = true;
     m_callbackType = callbackType;
 }
Example #32
0
 public EvalEventArgs(AppDomain appDomain, Thread thread,
                      Eval eval, ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_eval = eval;
 }
Example #33
0
 public ModuleEventArgs(AppDomain appDomain, Module managedModule,
                        ManagedCallbackType callbackType)
     : base(appDomain, callbackType)
 {
     m_managedModule = managedModule;
 }
Example #34
0
 // Derived class overrides this methdos 
 protected abstract void HandleEvent(ManagedCallbackType eventId, CorEventArgs args);
Example #35
0
 protected override void HandleEvent(ManagedCallbackType eventId, CorEventArgs args)
 {
     m_outer.InternalFireEvent(eventId, args);
 }
Example #36
0
 public AppDomainEventArgs(Process process, AppDomain ad,
                           ManagedCallbackType callbackType)
     : base(process, callbackType)
 {
     m_ad = ad;
 }
Example #37
0
 public CorAppDomainBaseEventArgs(CorAppDomain ad, ManagedCallbackType callbackType)
     : base(ad, callbackType)
 {
 }
Example #38
0
 public ProcessEventArgs(Process process, ManagedCallbackType callbackType)
     : base(process, callbackType)
 {
 }
Example #39
0
 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;
 }
Example #40
0
 public CorBreakpointEventArgs(CorAppDomain appDomain,
                                CorThread thread,
                                CorBreakpoint managedBreakpoint,
                                ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_break = managedBreakpoint;
 }
Example #41
0
 public CorMDAEventArgs(CorMDA mda, CorThread thread, CorProcess proc,
     ManagedCallbackType callbackType)
     : base(proc, callbackType)
 {
     m_mda = mda;
     Thread = thread;
     //m_proc = proc;
 }
Example #42
0
 public CorNativeStopEventArgs(CorProcess process,
                               int threadId,
                               IntPtr debugEvent,
                               bool isOutOfBand,
                               ManagedCallbackType callbackType)
     : base(process, callbackType)
 {
     m_threadId = threadId;
     m_debugEvent = debugEvent;
     m_isOutOfBand = isOutOfBand;
 }
Example #43
0
 public CorExceptionInCallbackEventArgs(CorController controller, Exception exceptionThrown,
     ManagedCallbackType callbackType)
     : base(controller, callbackType)
 {
     m_exceptionThrown = exceptionThrown;
 }
Example #44
0
        /**
         * Helper for invoking events.  Checks to make sure that handlers
         * are hooked up to a handler before the handler is invoked.
         *
         * We want to allow maximum flexibility by our callers.  As such,
         * we don't require that they call <code>e.Controller.Continue</code>,
         * nor do we require that this class call it.  <b>Someone</b> needs
         * to call it, however.
         *
         * Consequently, if an exception is thrown and the process is stopped,
         * the process is continued automatically.
         */

        void InternalFireEvent(ManagedCallbackType callbackType, CorEventArgs e)
        {
            CorProcess owner = e.Process;

            Debug.Assert(owner != null);
            try
            {
                owner.DispatchEvent(callbackType, e);
            }
            finally
            {
                // If the callback marked the event to be continued, then call Continue now.
                if (e.Continue)
                {
                    e.Controller.Continue(false);
                }
            }
        }
Example #45
0
 public CorBreakpointSetErrorEventArgs(CorAppDomain appDomain,
                                 CorThread thread,
                                 CorBreakpoint breakpoint,
                                 int errorCode,
                                 ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_breakpoint = breakpoint;
     m_errorCode = errorCode;
 }
Example #46
0
 public CorExceptionEventArgs(CorAppDomain appDomain,
                               CorThread thread,
                               bool unhandled,
                               ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_unhandled = unhandled;
 }
Example #47
0
 public CorFunctionRemapCompleteEventArgs(CorAppDomain appDomain,
                                    CorThread thread,
                                    CorFunction managedFunction,
                                    ManagedCallbackType callbackType
                                    )
     : base(appDomain, thread, callbackType)
 {
     m_managedFunction = managedFunction;
 }
Example #48
0
 public CorEvalEventArgs(CorAppDomain appDomain, CorThread thread,
                          CorEval eval, ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_eval = eval;
 }
Example #49
0
 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;
 }
Example #50
0
 public CorModuleEventArgs(CorAppDomain appDomain, CorModule managedModule,
     ManagedCallbackType callbackType)
     : base(appDomain, callbackType)
 {
     m_managedModule = managedModule;
 }
Example #51
0
        /**
         * Helper for invoking events.  Checks to make sure that handlers
         * are hooked up to a handler before the handler is invoked.
         *
         * We want to allow maximum flexibility by our callers.  As such,
         * we don't require that they call <code>e.Controller.Continue</code>,
         * nor do we require that this class call it.  <b>Someone</b> needs
         * to call it, however.
         *
         * Consequently, if an exception is thrown and the process is stopped,
         * the process is continued automatically.
         */

        void InternalFireEvent(ManagedCallbackType callbackType,CorEventArgs e)
        {
            CorProcess owner;
            CorController c = e.Controller;
            Debug.Assert(c!=null);
            if(c is CorProcess)
                owner = (CorProcess)c ;
            else 
            {
                Debug.Assert(c is CorAppDomain);
                owner = (c as CorAppDomain).Process;
            }
            Debug.Assert(owner!=null);
            try 
            {
                owner.DispatchEvent(callbackType,e);
            }
            finally
            {
                if(e.Continue)
                {
                        e.Controller.Continue(false);
                }
            }
        }
Example #52
0
 public CorClassEventArgs(CorAppDomain appDomain, CorClass managedClass,
     ManagedCallbackType callbackType)
     : base(appDomain, callbackType)
 {
     m_class = managedClass;
 }
Example #53
0
 public CorEventArgs(CorController controller, ManagedCallbackType callbackType)
 {
     m_controller = controller;
     m_continue = true;
     m_callbackType = callbackType;
 }
Example #54
0
 public CorDebuggerErrorEventArgs(CorProcess process, int hresult,
                                   int errorCode, ManagedCallbackType callbackType)
     : base(process, callbackType)
 {
     m_hresult = hresult;
     m_errorCode = errorCode;
 }
Example #55
0
 public CorAppDomainEventArgs(CorProcess process, CorAppDomain ad,
                               ManagedCallbackType callbackType)
     : base(process, callbackType)
 {
     m_ad = ad;
 }
Example #56
0
 public CorAssemblyEventArgs(CorAppDomain appDomain,
                              CorAssembly assembly, ManagedCallbackType callbackType)
     : base(appDomain, callbackType)
 {
     m_assembly = assembly;
 }
Example #57
0
 public CorThreadEventArgs(CorAppDomain appDomain, CorThread thread,
     ManagedCallbackType callbackType)
     : base(appDomain != null ? appDomain : thread.AppDomain, callbackType)
 {
     Thread = thread;
 }
Example #58
0
 public AssemblyEventArgs(AppDomain appDomain,
                          Assembly assembly, ManagedCallbackType callbackType)
     : base(appDomain, callbackType)
 {
     m_assembly = assembly;
 }
Example #59
0
 public CorStepCompleteEventArgs(CorAppDomain appDomain, CorThread thread,
                                  CorStepper stepper, CorDebugStepReason stepReason,
                                  ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_stepper = stepper;
     m_stepReason = stepReason;
 }
Example #60
0
 // constructor
 // Arguments: thread: thread on which the notification occurred
 //            appDomain: appdomain in which the notification occurred
 //            callbackType: the type of the callback for theis event
 public CorCustomNotificationEventArgs(CorThread thread, CorAppDomain appDomain,
                                       ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_thread = thread;
 }