Exemplo n.º 1
0
        internal void OnStep(StepEvent e)
        {
            var frame = e.Thread.GetFrames()[0];		// in mono 2.6.7 we could get the location from the event, but that no longer works with mono 2.8
            Location location = frame.Location;
            if (location != null)
                Log.WriteLine(TraceLevel.Info, "Debugger", "Stepped to {0}:{1:X4} in {2}:{3}", e.Method.FullName, frame.ILOffset, location.SourceFile, location.LineNumber);
            else
                Log.WriteLine(TraceLevel.Info, "Debugger", "Stepped to {0}:{1:X4}", e.Method.FullName, frame.ILOffset);

            m_currentThread = e.Thread;
            m_stepRequest.Disable();
            m_stepRequest = null;

            var context = new Context(e.Thread, e.Method, frame.ILOffset);
            Broadcaster.Invoke("debugger processed step event", context);
        }
Exemplo n.º 2
0
        internal void OnBreakpoint(BreakpointEvent e, ResolvedBreakpoint bp)
        {
            m_currentThread = e.Thread;

            var frames = new LiveStack(m_currentThread);

            Contract.Assert(BreakpointCondition != null, "BreakpointCondition is null");
            DebuggerThread.HandlerAction action = BreakpointCondition(frames[0], bp.BreakPoint);
            if (action == DebuggerThread.HandlerAction.Suspend)
            {
                if (m_stepRequest != null)
                {
                    m_stepRequest.Disable();
                    m_stepRequest = null;
                }

                Log.WriteLine(TraceLevel.Info, "Debugger", "Hit breakpoint at {0}:{1:X4}", e.Method.FullName, bp.Offset);
                var context = new Context(e.Thread, e.Method, bp.Offset);
                Broadcaster.Invoke("debugger processed breakpoint event", context);

                if (!NSApplication.sharedApplication().isActive())
                    NSApplication.sharedApplication().activateIgnoringOtherApps(true);
            }
            else
            {
                Log.WriteLine(TraceLevel.Info, "Debugger", "ignoring breakpoint at {0}:{1:X4} (condition evaluated to false)", e.Method.FullName, bp.Offset);
                m_thread.Resume();
            }
        }
Exemplo n.º 3
0
        internal void OnException(ExceptionEvent e)
        {
            var frames = new LiveStack(e.Thread);
            LiveStackFrame frame = frames[0];

            Boss boss = ObjectModel.Create("Application");
            var exceptions = boss.Get<IExceptions>();
            if (!DoIsIgnoredException(e.Exception.Type, exceptions.Ignored, frame.Method.Name))
            {
                m_currentThread = e.Thread;

                if (m_stepRequest != null)
                {
                    m_stepRequest.Disable();
                    m_stepRequest = null;
                }

                if (DebuggerWindows.WriteEvents)
                    m_transcript.WriteLine(Output.Normal, "{0} exception was thrown at {1}:{2:X4}", e.Exception.Type.FullName, frame.Method.FullName, frame.ILOffset);
                var context = new Context(e.Thread, frame.Method, frame.ILOffset);
                Broadcaster.Invoke("debugger thrown exception", context);
            }
            else
            {
                m_transcript.WriteLine(Output.Normal, "Ignoring {0} in {1}:{2}", e.Exception.Type.FullName, frame.Method.DeclaringType.Name, frame.Method.Name);
                m_thread.Resume();
            }
        }
Exemplo n.º 4
0
        internal void OnBreakAll()
        {
            IList<ThreadMirror> threads = VM.GetThreads();
            ThreadMirror main = threads.Single(t => t.Id == 1);
            var frame = main.GetFrames()[0];
            var context = new Context(main, frame.Method, frame.ILOffset);
            Broadcaster.Invoke("debugger break all", context);

            if (!NSApplication.sharedApplication().isActive())
                NSApplication.sharedApplication().activateIgnoringOtherApps(true);
        }