Beispiel #1
0
 internal CorStackWalkEx(ICorDebugStackWalk stackwalk, CorThread thread)
     : base(stackwalk, thread)
 {
     m_internalFrameIndex = 0;
     m_internalFrames     = thread.GetActiveInternalFrames();
     m_bEndOfStackFrame   = false;
 }
		public CorBacktrace (CorThread thread, CorDebuggerSession session): base (session.ObjectAdapter)
		{
			this.session = session;
			this.thread = thread;
			threadId = thread.Id;
			frames = new List<CorFrame> (GetFrames (thread));
			evalTimestamp = CorDebuggerSession.EvaluationTimestamp;
		}
		void CheckTimestamp ( )
		{
			if (evalTimestamp != CorDebuggerSession.EvaluationTimestamp) {
				thread = null;
				frame = null;
				corEval = null;
			}
		}
 /**
  * Are there managed callbacks queued up for the requested thread?
  */
 public bool HasQueuedCallbacks (CorThread managedThread)
 {
     int queued = 0;
     m_controller.HasQueuedCallbacks( (managedThread==null)?null:managedThread.GetInterface(),
                                      out queued
                                      );
     return !(queued == 0);
 }
Beispiel #5
0
        /**
         * Are there managed callbacks queued up for the requested thread?
         */
        public bool HasQueuedCallbacks(CorThread managedThread)
        {
            int queued = 0;

            m_controller.HasQueuedCallbacks((managedThread == null)?null:managedThread.GetInterface(),
                                            out queued
                                            );
            return(!(queued == 0));
        }
		internal static IEnumerable<CorFrame> GetFrames (CorThread thread)
		{
			foreach (CorChain chain in thread.Chains) {
                if (!chain.IsManaged)
                    continue;
                foreach (CorFrame frame in chain.Frames)
                    yield return frame;
			}
		}
Beispiel #7
0
 public void Step(CorThread thread)
 {
     _activeThread = thread;
     var stepper = createStepper();
     var mod = _activeThread.ActiveFrame.Function.Module;
     if (hasSymbolReader(mod))
         stepIn(mod, stepper);
     else
         stepOut(stepper);
 }
 //
 // IEnumerator interface
 //
 public bool MoveNext()
 {
     ICorDebugThread[] a = new ICorDebugThread[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_th = new CorThread (a[0]);
     else
         m_th = null;
     return m_th != null;
 }
Beispiel #9
0
        //
        // IEnumerator interface
        //
        public bool MoveNext()
        {
            ICorDebugThread[] a = new ICorDebugThread[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_th = new CorThread(a[0]);
            }
            else
            {
                m_th = null;
            }
            return(m_th != null);
        }
Beispiel #10
0
        //constructors
        /// <summary>
        /// Initialze the StackTrace Class and create all the FrameInfo objects
        /// </summary>
        /// <param name="proc">The thread to get the stack trace of</param>
        internal ThreadInfo(CorThread thread, ProcessInfo procInfo)
        {
            if (thread == null)
            {
                throw new ArgumentNullException("thread");
            }
            if (procInfo == null)
            {
                throw new ArgumentNullException("procInfo");
            }

            this.thread = thread;
            metaImportHash = new Dictionary<string, CorMetadataImport>();
            frameStack = new List<FrameInfo>();
            threadId = thread.Id;
            processInfo = procInfo;
            //get the general thread information object
            generalThreadInfo = procInfo.GeneralThreads[threadId];
        }
 public void Stopped(DllDebugger debugger, CorThread thread)
 {
     Console.ForegroundColor = ConsoleColor.Black;
     Console.BackgroundColor = ConsoleColor.Green;
     Console.Out.Write("Thread [{0}]", thread.Id);
     Console.BackgroundColor = ConsoleColor.Black;
     Console.ForegroundColor = ConsoleColor.Red;
     Console.Out.Write(" (ct=Continue, stov=Step Over, stin=Step In, trc=Stack Trace, det=Detach): ");
     Console.ForegroundColor = ConsoleColor.Green;
     var line = Console.In.ReadLine();
     var transcribed = line.ToLower();
     if (transcribed.Contains("ct")) return;
     if (transcribed.Contains("stov")) debugger.StepOver(thread);
     else if (transcribed.Contains("stin")) debugger.StepInto(thread);
     else if (transcribed.Contains("trc")) debugger.ShowStackTrace(thread);
     else if (transcribed.Contains("locals")) debugger.ShowLocals(thread);
     else if (transcribed.Contains("br")) SetBreakpoint(transcribed, debugger);
     else if (transcribed.Contains("det")) debugger.Detach();
     else Stopped(debugger, thread);
 }
Beispiel #12
0
        /// <summary>
        /// Returns a list of threads waiting for the monitor event associated with this object
        /// </summary>
        /// <returns>The list of waiting threads. The first thread in the list will be released on the
        /// next call to Monitor.Pulse, and each succesive call will release the next thread in the list</returns>
        public CorThread[] GetMonitorEventWaitList()
        {
            if (m_heapVal as ICorDebugHeapValue3 == null)
            {
                throw new NotSupportedException();
            }
            ICorDebugThreadEnum rawThreadEnum;

            (m_heapVal as ICorDebugHeapValue3).GetMonitorEventWaitList(out rawThreadEnum);
            uint threadCount;

            rawThreadEnum.GetCount(out threadCount);
            ICorDebugThread[] rawThreads = new ICorDebugThread[threadCount];
            uint countReceived;

            rawThreadEnum.Next(threadCount, rawThreads, out countReceived);
            Debug.Assert(countReceived == threadCount);
            CorThread[] threads = new CorThread[threadCount];
            for (int i = 0; i < threadCount; i++)
            {
                threads[i] = new CorThread(rawThreads[i]);
            }
            return(threads);
        }
Beispiel #13
0
 public CorFunctionRemapOpportunityEventArgs(CorAppDomain appDomain,
                                    CorThread thread,
                                    CorFunction oldFunction,
                                    CorFunction newFunction,
                                    int oldILoffset
                                    )
     : base(appDomain, thread)
 {
     m_oldFunction = oldFunction;
     m_newFunction = newFunction;
     m_oldILoffset = oldILoffset;
 }
Beispiel #14
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;
 }
Beispiel #15
0
 public CorBreakpointSetErrorEventArgs(CorAppDomain appDomain,
                                 CorThread thread,
                                 CorBreakpoint breakpoint,
                                 int errorCode)
     : base(appDomain, thread)
 {
     m_breakpoint = breakpoint;
     m_errorCode = errorCode;
 }
Beispiel #16
0
 public CorBreakpointSetErrorEventArgs(CorAppDomain appDomain,
                                 CorThread thread,
                                 CorBreakpoint breakpoint,
                                 int errorCode,
                                 ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_breakpoint = breakpoint;
     m_errorCode = errorCode;
 }
Beispiel #17
0
 public CorMDAEventArgs(CorMDA mda, CorThread thread, CorProcess proc,
     ManagedCallbackType callbackType)
     : base(proc, callbackType)
 {
     m_mda = mda;
     Thread = thread;
     //m_proc = proc;
 }
Beispiel #18
0
 public CorEditAndContinueRemapEventArgs(CorAppDomain appDomain,
                                 CorThread thread,
                                 CorFunction managedFunction,
                                 int accurate,
                                 ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_managedFunction = managedFunction;
     m_accurate = accurate;
 }
Beispiel #19
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;
 }
Beispiel #20
0
 internal CorStackWalk(ICorDebugStackWalk stackwalk, CorThread thread)
     : base(stackwalk)
 {
     m_th = thread;
     m_sw = stackwalk;
 }
Beispiel #21
0
 public CorStepCompleteEventArgs(CorAppDomain appDomain, CorThread thread,
                                  CorStepper stepper, CorDebugStepReason stepReason)
     : base(appDomain, thread)
 {
     m_stepper = stepper;
     m_stepReason = stepReason;
 }
Beispiel #22
0
 public void SetAllThreadsDebugState(CorDebugThreadState state, CorThread exceptThis)
 {
     m_controller.SetAllThreadsDebugState(state, exceptThis != null ? exceptThis.GetInterface() : null);
 }
Beispiel #23
0
 public CorBreakpointEventArgs(CorAppDomain appDomain,
                                CorThread thread,
                                CorBreakpoint managedBreakpoint)
     : base(appDomain, thread)
 {
     m_break = managedBreakpoint;
 }
Beispiel #24
0
 public CorThreadEventArgs(CorAppDomain appDomain, CorThread thread)
     : base(appDomain != null ? appDomain : thread.AppDomain)
 {
     Thread = thread;
 }
Beispiel #25
0
 public CorExceptionUnwind2EventArgs(CorAppDomain appDomain, CorThread thread,
                                     CorDebugExceptionUnwindCallbackType eventType,
                                     int flags,
                                     ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_eventType = eventType;
     m_flags = flags;
 }
Beispiel #26
0
 public CorFunctionRemapCompleteEventArgs(CorAppDomain appDomain,
                                    CorThread thread,
                                    CorFunction managedFunction
                                    )
     : base(appDomain, thread)
 {
     m_managedFunction = managedFunction;
 }
Beispiel #27
0
 // Thread may be null.
 public CorMDAEventArgs(CorMDA mda, CorThread thread, CorProcess proc)
     : base(proc)
 {
     m_mda = mda;
     Thread = thread;
     //m_proc = proc;
 }
Beispiel #28
0
 public CorFunctionRemapCompleteEventArgs(CorAppDomain appDomain,
                                    CorThread thread,
                                    CorFunction managedFunction,
                                    ManagedCallbackType callbackType
                                    )
     : base(appDomain, thread, callbackType)
 {
     m_managedFunction = managedFunction;
 }
Beispiel #29
0
 public void Reset()
 {
     m_enum.Reset();
     m_th = null;
 }
Beispiel #30
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;
 }
Beispiel #31
0
 public CorExceptionEventArgs(CorAppDomain appDomain,
                               CorThread thread,
                               bool unhandled,
                               ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_unhandled = unhandled;
 }
Beispiel #32
0
 public CorThreadEventArgs(CorAppDomain appDomain, CorThread thread,
     ManagedCallbackType callbackType)
     : base(appDomain != null ? appDomain : thread.AppDomain, callbackType)
 {
     Thread = thread;
 }
Beispiel #33
0
 public CorEvalEventArgs(CorAppDomain appDomain, CorThread thread,
                          CorEval eval)
     : base(appDomain, thread)
 {
     m_eval = eval;
 }
Beispiel #34
0
 public CorBreakpointEventArgs(CorAppDomain appDomain,
                                CorThread thread,
                                CorBreakpoint managedBreakpoint,
                                ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_break = managedBreakpoint;
 }
Beispiel #35
0
 public CorEvalEventArgs(CorAppDomain appDomain, CorThread thread,
                          CorEval eval, ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_eval = eval;
 }
Beispiel #36
0
 public CorStepCompleteEventArgs(CorAppDomain appDomain, CorThread thread,
                                  CorStepper stepper, CorDebugStepReason stepReason,
                                  ManagedCallbackType callbackType)
     : base(appDomain, thread, callbackType)
 {
     m_stepper = stepper;
     m_stepReason = stepReason;
 }
Beispiel #37
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;
 }