Ejemplo n.º 1
0
        internal ICorDebugFrame GetFrameAt(FrameID frameID)
        {
            process.AssertPaused();

            ICorDebugChainEnum corChainEnum = CorThread.EnumerateChains();

            if (frameID.ChainIndex >= corChainEnum.Count)
            {
                throw new ArgumentException("Chain index too big", "chainIndex");
            }
            corChainEnum.Skip(corChainEnum.Count - frameID.ChainIndex - 1);

            ICorDebugChain corChain = corChainEnum.Next();

            if (corChain.IsManaged == 0)
            {
                throw new ArgumentException("Chain is not managed", "chainIndex");
            }

            ICorDebugFrameEnum corFrameEnum = corChain.EnumerateFrames();

            if (frameID.FrameIndex >= corFrameEnum.Count)
            {
                throw new ArgumentException("Frame index too big", "frameIndex");
            }
            corFrameEnum.Skip(corFrameEnum.Count - frameID.FrameIndex - 1);

            return(corFrameEnum.Next());
        }
Ejemplo n.º 2
0
        public static ICorDebugChain Next(this ICorDebugChainEnum corChainEnum)
        {
            ICorDebugChain[] corChains     = new ICorDebugChain[] { null };
            uint             chainsFetched = corChainEnum.Next(1, corChains);

            return(corChains[0]);
        }
Ejemplo n.º 3
0
        int ICorDebugThread.GetActiveChain(out ICorDebugChain ppChain)
        {
            Debug.Assert(!IsVirtualThread);
            ppChain = this.GetLastCorDebugThread().Chain;

            return(Utility.COM_HResults.S_OK);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Get callback, run on worker thread.
        /// </summary>
        /// <returns>An array of the callstack</returns>
        public List <CorFrame> GetFrameList()
        {
            ICorDebugChain ch = null;

            cothread.GetActiveChain(out ch);
            CorChain chain = new CorChain(ch, options);

            List <CorFrame> frameList = new List <CorFrame>();
            CorFrame        corFrame  = chain.ActiveFrame;

            for (int i = 0; i < 20; i++)
            {
                frameList.Add(corFrame);
                ICorDebugFrame caller;
                corFrame.GetFrame().GetCaller(out caller);
                if (null == caller)
                {
                    break;
                }

                corFrame = new CorFrame(caller, options);
            }

            return(frameList);
        }
        int ICorDebugChain.GetPrevious(out ICorDebugChain ppChain)
        {
            CorDebugThread thread = m_thread.NextThread;

            ppChain = (thread != null) ? thread.Chain : null;

            return(COM_HResults.S_OK);
        }
        int ICorDebugChain.GetNext(out ICorDebugChain ppChain)
        {
            //Chains are attached from top of the stack to the bottom.
            //This corresponds to the last virtual thread stack to the first
            CorDebugThread thread = m_thread.PreviousThread;

            ppChain = (thread != null) ? thread.Chain : null;

            return(COM_HResults.S_OK);
        }
Ejemplo n.º 7
0
 //
 // IEnumerator interface
 //
 public bool MoveNext()
 {
     ICorDebugChain[] a = new ICorDebugChain[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_chain = new CorChain (a[0]);
     else
         m_chain = null;
     return m_chain != null;
 }
Ejemplo n.º 8
0
 public static IEnumerable<ICorDebugChain> GetEnumerator(this ICorDebugChainEnum corEnum)
 {
     corEnum.Reset();
     while (true) {
         ICorDebugChain[] corChains = new ICorDebugChain[EnumerateBufferSize];
         uint fetched = corEnum.Next(EnumerateBufferSize, corChains);
         if (fetched == 0)
             yield break;
         for(int i = 0; i < fetched; i++)
             yield return corChains[i];
     }
 }
        //
        // IEnumerator interface
        //

        #region IEnumerator Members

        public bool MoveNext()
        {
            var  a = new ICorDebugChain[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_chain = new CorChain(a[0]);
            }
            else
            {
                m_chain = null;
            }
            return(m_chain != null);
        }
Ejemplo n.º 10
0
 public static IEnumerable <ICorDebugChain> GetEnumerator(this ICorDebugChainEnum corEnum)
 {
     corEnum.Reset();
     while (true)
     {
         ICorDebugChain[] corChains = new ICorDebugChain[EnumerateBufferSize];
         uint             fetched   = corEnum.Next(EnumerateBufferSize, corChains);
         if (fetched == 0)
         {
             yield break;
         }
         for (int i = 0; i < fetched; i++)
         {
             yield return(corChains[i]);
         }
     }
 }
Ejemplo n.º 11
0
        //
        // IEnumerator interface
        //
        public bool MoveNext()
        {
#if I_DONT_WANT_TO
            ICorDebugChain[] a = new ICorDebugChain[1];
            uint             c = 0;
            int r = m_enum.Next(a.Length, a, ref c);
            if (r == 0 && c == 1) // S_OK && we got 1 new element
            {
                m_chain = new Chain(a[0]);
            }
            else
            {
                m_chain = null;
            }
            return(m_chain != null);
#else
            return(false);
#endif
        }
Ejemplo n.º 12
0
        internal StackFrame GetStackFrameAt(uint chainIndex, uint frameIndex)
        {
            process.AssertPaused();

            ICorDebugChainEnum corChainEnum = CorThread.EnumerateChains();

            if (chainIndex >= corChainEnum.GetCount())
            {
                throw new DebuggerException("The requested chain index is too big");
            }
            corChainEnum.Skip(corChainEnum.GetCount() - chainIndex - 1);
            ICorDebugChain corChain = corChainEnum.Next();

            if (corChain.IsManaged() == 0)
            {
                throw new DebuggerException("The requested chain is not managed");
            }

            ICorDebugFrameEnum corFrameEnum = corChain.EnumerateFrames();

            if (frameIndex >= corFrameEnum.GetCount())
            {
                throw new DebuggerException("The requested frame index is too big");
            }
            corFrameEnum.Skip(corFrameEnum.GetCount() - frameIndex - 1);
            ICorDebugFrame corFrame = corFrameEnum.Next();

            if (!(corFrame is ICorDebugILFrame))
            {
                throw new DebuggerException("The rquested frame is not IL frame");
            }

            StackFrame stackFrame = new StackFrame(this, (ICorDebugILFrame)corFrame, chainIndex, frameIndex);

            return(stackFrame);
        }
Ejemplo n.º 13
0
 internal RuntimeChain(RuntimeThread thread, ICorDebugChain comChain)
 {
     _comChain = comChain;
     Thread    = thread;
 }
        int ICorDebugChain.GetCaller(out ICorDebugChain ppChain)
        {
            ppChain = null;

            return(COM_HResults.S_OK);
        }
Ejemplo n.º 15
0
		public static ICorDebugChain Next(this ICorDebugChainEnum corChainEnum)
		{
			ICorDebugChain[] corChains = new ICorDebugChain[] { null };
			uint chainsFetched = corChainEnum.Next(1, corChains);
			return corChains[0];
		}
 internal RuntimeChain (RuntimeThread thread, ICorDebugChain comChain)
 {
     _comChain = comChain;
     Thread = thread;
 }
 int ICorDebugInternalFrame.GetChain(out ICorDebugChain ppChain)
 {
     return(ICorDebugFrame.GetChain(out ppChain));
 }
        //ICorDebugNative is needed for CPDE to back the IP up to the beginning
        //of a sequence point when the user intercepts an exception.
        #region ICorDebugNativeFrame Members

        int ICorDebugNativeFrame.GetChain(out ICorDebugChain ppChain)
        {
            return(((ICorDebugFrame)this).GetChain(out ppChain));
        }
 public static uint Next(this ICorDebugChainEnum instance, uint celt, ICorDebugChain[] chains)
 {
     uint pceltFetched;
     instance.__Next(celt, chains, out pceltFetched);
     return pceltFetched;
 }
Ejemplo n.º 20
0
        int ICorDebugChain. GetCaller( out ICorDebugChain ppChain )
        {
            ppChain = null;

            return Utility.COM_HResults.S_OK;
        }
Ejemplo n.º 21
0
 int ICorDebugInternalFrame.GetChain( out ICorDebugChain ppChain )
 {
     return this.ICorDebugFrame.GetChain( out ppChain );
 }
Ejemplo n.º 22
0
        //ICorDebugNative is needed for CPDE to back the IP up to the beginning
        //of a sequence point when the user intercepts an exception.
        #region ICorDebugNativeFrame Members

        int ICorDebugNativeFrame.GetChain(out ICorDebugChain ppChain)
        {
            return ((ICorDebugFrame)this).GetChain(out ppChain);
        }
Ejemplo n.º 23
0
        int ICorDebugFrame.GetChain (out ICorDebugChain ppChain)
        {
            ppChain = (ICorDebugChain)m_chain;

            return Utility.COM_HResults.S_OK;
        }
Ejemplo n.º 24
0
        int ICorDebugChain. GetNext( out ICorDebugChain ppChain )
        {
            //Chains are attached from top of the stack to the bottom.
            //This corresponds to the last virtual thread stack to the first
            CorDebugThread thread = m_thread.PreviousThread;

            ppChain = (thread != null) ? thread.Chain : null;

            return Utility.COM_HResults.S_OK;
        }
Ejemplo n.º 25
0
        int ICorDebugThread.GetActiveChain(out ICorDebugChain ppChain)
        {
            Debug.Assert(!IsVirtualThread);
            ppChain = this.GetLastCorDebugThread().Chain;

            return Utility.COM_HResults.S_OK;
        }
Ejemplo n.º 26
0
 internal CorChain(ICorDebugChain chain)
     : base(chain)
 {
     m_chain = chain;
 }
Ejemplo n.º 27
0
        int ICorDebugChain. GetPrevious( out ICorDebugChain ppChain )
        {
            CorDebugThread thread = m_thread.NextThread;

            ppChain = (thread != null) ? thread.Chain : null;

            return Utility.COM_HResults.S_OK;
        }
Ejemplo n.º 28
0
        int ICorDebugChain.GetCallee(out ICorDebugChain ppChain)
        {
            ppChain = null;

            return(Utility.COM_HResults.S_OK);
        }
        int ICorDebugFrame.GetChain(out ICorDebugChain ppChain)
        {
            ppChain = (ICorDebugChain)_chain;

            return(COM_HResults.S_OK);
        }
Ejemplo n.º 30
0
 internal CorChain(ICorDebugChain chain)
     : base(chain)
 {
     m_chain = chain;
 }
Ejemplo n.º 31
0
 internal CorChain(ICorDebugChain chain, CorDebuggerOptions options)
     : base(chain, options)
 {
     m_chain = chain;
 }