Beispiel #1
0
        public void RemoveBreakpoint(Breakpoint bp, MethodMirror method, long ilOffset)
        {
            Contract.Requires(method != null, "method is null");

            var resolved = new ResolvedBreakpoint(bp, method, ilOffset);
            lock (m_mutex)
            {
                BreakpointEventRequest request;
                if (m_breakpoints.TryGetValue(resolved, out request))
                {
                    Log.WriteLine(TraceLevel.Info, "Debugger", "Removing breakpoint from {0}:{1:X4}", method.FullName, ilOffset);

                    request.Disable();
                    m_breakpoints.Remove(resolved);
                }
            }

            m_debugger.OnUnresolvedBreakpoint(bp);
        }
Beispiel #2
0
 internal void OnResolvedBreakpoint(ResolvedBreakpoint bp)
 {
     Broadcaster.Invoke("debugger resolved breakpoint", bp);
 }
Beispiel #3
0
        public void AddBreakpoint(Breakpoint bp, MethodMirror method, long ilOffset)
        {
            Contract.Requires(method != null, "method is null");

            var resolved = new ResolvedBreakpoint(bp, method, ilOffset);
            lock (m_mutex)
            {
                if (!m_breakpoints.ContainsKey(resolved))
                {
                    Log.WriteLine(TraceLevel.Info, "Debugger", "Adding breakpoint to {0}:{1:X4}", method.FullName, ilOffset);

                    BreakpointEventRequest request = m_debugger.VM.CreateBreakpointRequest(method, ilOffset);
                    request.Enable();
                    m_breakpoints.Add(resolved, request);
                }
            }

            NSApplication.sharedApplication().BeginInvoke(() => m_debugger.OnResolvedBreakpoint(resolved));
        }
Beispiel #4
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();
            }
        }