Inheritance: CorThreadEventArgs
Ejemplo n.º 1
0
		void OnBreakpoint (object sender, CorBreakpointEventArgs e)
		{
			lock (debugLock) {
				if (evaluating) {
					e.Continue = true;
					return;
				}
			}
			OnStopped ();
			e.Continue = false;
			// If a breakpoint is hit while stepping, cancel the stepping operation
			if (stepper != null && stepper.IsActive ())
				stepper.Deactivate ();
			SetActiveThread (e.Thread);
			TargetEventArgs args = new TargetEventArgs (TargetEventType.TargetHitBreakpoint);
			args.Process = GetProcess (process);
			args.Thread = GetThread (e.Thread);
			args.Backtrace = new Backtrace (new CorBacktrace (e.Thread, this));
			OnTargetEvent (args);
		}
		void OnBreakpoint (object sender, CorBreakpointEventArgs e)
		{
			lock (debugLock) {
				if (evaluating) {
					e.Continue = true;
					return;
				}
			}

			BreakEventInfo binfo;
			if (breakpoints.TryGetValue (e.Breakpoint, out binfo)) {
				e.Continue = true;
				Breakpoint bp = (Breakpoint)binfo.BreakEvent;
				
				if (bp.HitCount > 1) {
					// Just update the count and continue
					binfo.UpdateHitCount (bp.HitCount - 1);
					return;
				}
				
				if (!string.IsNullOrEmpty (bp.ConditionExpression)) {
					string res = EvaluateExpression (e.Thread, bp.ConditionExpression);
					if (bp.BreakIfConditionChanges) {
						if (res == bp.LastConditionValue)
							return;
						bp.LastConditionValue = res;
					} else {
						if (res != null && res.ToLower () == "false")
							return;
					}
				}
				switch (bp.HitAction) {
					case HitAction.CustomAction:
						// If custom action returns true, execution must continue
						if (binfo.RunCustomBreakpointAction (bp.CustomActionId))
							return;
						break;
					case HitAction.PrintExpression: {
						string exp = EvaluateTrace (e.Thread, bp.TraceExpression);
						binfo.UpdateLastTraceValue (exp);
						return;
					}
				}
			}
			
			OnStopped ();
			e.Continue = false;
			// If a breakpoint is hit while stepping, cancel the stepping operation
			if (stepper != null && stepper.IsActive ())
				stepper.Deactivate ();
			SetActiveThread (e.Thread);
			TargetEventArgs args = new TargetEventArgs (TargetEventType.TargetHitBreakpoint);
			args.Process = GetProcess (process);
			args.Thread = GetThread (e.Thread);
			args.Backtrace = new Backtrace (new CorBacktrace (e.Thread, this));
			OnTargetEvent (args);
		}
Ejemplo n.º 3
0
 void process_OnBreakpoint(object sender, CorBreakpointEventArgs e)
 {
     e.Continue = false;
     _activeThread = e.Thread;
     _breakEvent.Set();
 }
Ejemplo n.º 4
0
 private void OnBreakpoint(object sender, CorBreakpointEventArgs e)
 {
     subscriber.Published("Hit Breakpoint.");
     Paused(e.Thread);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates a new instance of the CustomBreakpointEventArgs class.
 /// </summary>
 /// <param name="processController"></param>
 /// <param name="callbackArgs"></param>
 public CustomBreakpointEventArgs(IMDbgProcessController processController,
                           CorBreakpointEventArgs callbackArgs)
     : base(processController)
 {
     this.callbackArgs = callbackArgs;
 }
Ejemplo n.º 6
0
        private void BreakpointEventHandler(Object sender, CorBreakpointEventArgs e)
        {
            Trace.WriteLine("ManagedCallback::Breakpoint");
            BeginManagedDebugEvent();
            try
            {
                if (InternalHandleRawMode(ManagedCallbackType.OnBreakpoint, e))
                    return;

                bool fHandled = false;

                // custom breakpoint handling. All normal MDbg shell breakpoints (including our user breakpoint)
                // register their own handlers here, so this is the very common case.
                if (customBreakpoints != null
                    && customBreakpoints.Contains(e.Breakpoint))
                {
                    using (MDbgProcessStopController psc = new MDbgProcessStopController(this, e, false))
                    {
                        CustomBreakpointEventHandler handler = (customBreakpoints[e.Breakpoint] as CustomBreakpointEventHandler);

                        // Invoke custom callback handler. This may stop the shell.
                        handler(this, new CustomBreakpointEventArgs(psc, e));
                    }
                    fHandled = true;
                }

                if (HandleCustomPostCallback(ManagedCallbackType.OnBreakpoint, e))
                {
                    return;
                }

                if (fHandled)
                {
                    return;         // this was custom breakpoint, no additional action necessary.
                }

                // We have an unknown breakpoint that no handler was registered for. This should be a very
                // uncommon case and indicate some bug in MDbg or an extension.
                e.Continue = false;
                InternalSignalRuntimeIsStopped(e.Thread, "Unexpected raw breakpoint hit");
            }
            finally
            {
                EndManagedDebugEvent(e);
            }
        }