//
 // IEnumerator interface
 //
 public bool MoveNext ()
 {
     ICorDebugStepper[] a = new ICorDebugStepper[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_step = new CorStepper (a[0]);
     else
         m_step = null;
     return m_step != null;
 }
        //
        // IEnumerator interface
        //
        public bool MoveNext()
        {
            ICorDebugStepper[] a = new ICorDebugStepper[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_step = new CorStepper(a[0]);
            }
            else
            {
                m_step = null;
            }
            return(m_step != null);
        }
Beispiel #3
0
 public CorStepCompleteEventArgs(CorAppDomain appDomain, CorThread thread,
                                  CorStepper stepper, CorDebugStepReason stepReason,
                                  ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_stepper = stepper;
     m_stepReason = stepReason;
 }
Beispiel #4
0
 public CorStepCompleteEventArgs(CorAppDomain appDomain, CorThread thread,
                                  CorStepper stepper, CorDebugStepReason stepReason)
     : base(appDomain, thread)
 {
     m_stepper = stepper;
     m_stepReason = stepReason;
 }
		void SetActiveThread (CorThread t)
		{
			activeThread = t;
			stepper = activeThread.CreateStepper (); 
			stepper.SetUnmappedStopMask (CorDebugUnmappedStop.STOP_NONE);
			stepper.SetJMC (true);
		}
		protected override void OnSetActiveThread (long processId, long threadId)
		{
			activeThread = null;
			stepper = null;
			foreach (CorThread t in process.Threads) {
				if (t.Id == threadId) {
					SetActiveThread (t);
					break;
				}
			}
		}
Beispiel #7
0
 public StepCompleteStopReason(CorStepper stepper, CorDebugStepReason stepReason)
 {
     Debug.Assert(stepper != null);
     m_stepReason = stepReason;
     m_stepper = stepper;
 }
 public void Reset()
 {
     m_enum.Reset();
     m_step = null;
 }
 public void Reset ()
 {
     m_enum.Reset ();
     m_step= null;
 }
Beispiel #10
0
 private void OnStepComplete(object sender, CorStepCompleteEventArgs e)
 {
     try
     {
         Paused(e.Thread);
     }
     catch (NoDebugInfo i)
     {
         subscriber.Published("There is no debug info for this point. Stepping out of debug lock to continue...");
         stepper = Stepper(e.Thread);
         stepper.StepOut();
     }
 }
Beispiel #11
0
 private void Paused(CorThread thread)
 {
     stepper = Stepper(thread);
     SequencePoints points = SequencePointsFor(thread);
     uint currentOffset = CurrentOffset(thread);
     SequencePoint sequencePoint = points.PointAt(currentOffset);
     string source = new FileReader().Read(sequencePoint.Document.URL, sequencePoint.StartLine,
                                           sequencePoint.StartColumn, sequencePoint.EndLine,
                                           sequencePoint.EndColumn);
     subscriber.Published("Stopped at:");
     subscriber.PublishedSource(source);
     subscriber.Stopped(this, thread);
 }
Beispiel #12
0
 private void stepOut(CorStepper stepper)
 {
     stepper.Step(false);
 }
Beispiel #13
0
 private void stepIn(CorModule mod, CorStepper stepper)
 {
     var range = tryGetStepRanges(_activeThread, _symbolReaders.Find(r => r.Key.Equals(mod.Name)).Value);
     stepper.StepRange(true, range);
 }
Beispiel #14
0
        private void StepCompleteEventHandler(Object sender, CorStepCompleteEventArgs e)
        {
            Trace.WriteLine("ManagedCallback::StepComplete");
            BeginManagedDebugEvent();
            try
            {
                if (InternalHandleRawMode(ManagedCallbackType.OnStepComplete, e))
                    return;

                // custom stepper handling
                if (customSteppers != null
                    && customSteppers.Contains(e.Stepper))
                {
                    using (MDbgProcessStopController psc = new MDbgProcessStopController(this, e, false))
                    {
                        CustomStepperEventHandler handler = (customSteppers[e.Stepper] as CustomStepperEventHandler);
                        customSteppers.Remove(e.Stepper);
                        handler(this, new CustomStepCompleteEventArgs(psc, e));
                    }

                    return;         // this was custom stepper, no additional action necessary.
                }

                // we need to deliver step complete for cordbg skin, so that we can print
                // enhanced diagnostics.
                if (HandleCustomPostCallback(ManagedCallbackType.OnStepComplete, e))
                    return;

                // we will stop only if this callback is from our own stepper.
                if (e.Stepper == m_activeStepper)
                {
                    m_activeStepper = null;
                    e.Continue = false;
                    InternalSignalRuntimeIsStopped(e.Thread, new StepCompleteStopReason(e.Stepper, e.StepReason));
                }
            }
            finally
            {
                EndManagedDebugEvent(e);
            }
        }
Beispiel #15
0
        /// <summary>
        /// Sets a stepper for the process. Process will stop with step complete,
        /// once this stepper completes the step.
        /// This function just sets the active stepper, but it doesn't continue the process.
        /// Once the stepper is set, a Go() command needs to be called.
        /// The 'active stepper' is also exclusive with registering a custom stepper.
        /// </summary>
        public void SetActiveStepper(CorStepper activeStepper)
        {
            // we are not interested in finishing old step.
            if (m_activeStepper != null)
            {
                m_activeStepper.Deactivate();
            }

            m_activeStepper = activeStepper;
        }
Beispiel #16
0
 /// <summary>
 /// Registers a Custom Stepper
 /// Registrations are valid only for one callback, i.e. the object is
 /// automatically deregistered after the callback is fired. If the user wishes to
 /// receive additional callback, the registration has to be done again in the
 /// callback.
 /// </summary>
 /// <param name="stepper">The CorStepper to run.</param>
 /// <param name="handler">The CustomStepperEventHandler to use.</param>
 public void RegisterCustomStepper(CorStepper stepper, CustomStepperEventHandler handler)
 {
     Debug.Assert(stepper != null);
     if (stepper == null)
         throw new ArgumentException("cannot be null", "stepper");
     if (handler == null)
     {
         // explicit deregistration
         if (customSteppers != null)
             customSteppers.Remove(stepper);
     }
     else
     {
         // adding registration
         if (customSteppers == null)
             customSteppers = new ListDictionary();
         else
             if (customSteppers.Contains(stepper))
                 throw new InvalidOperationException("Handler alrady registered for the custom stepper");
         customSteppers.Add(stepper, handler);
     }
 }