public CorDebugFrame(CorDebugChain chain, WireProtocol.Commands.Debugging_Thread_Stack.Reply.Call call, uint depth)
 {
     _chain        = chain;
     _depthnanoCLR = depth;
     _call         = call;
     _IP           = IP_NOT_INITIALIZED;
 }
        public static uint AppDomainIdFromCall(Engine engine, WireProtocol.Commands.Debugging_Thread_Stack.Reply.Call call)
        {
            uint appDomainId = CorDebugAppDomain.c_AppDomainId_ForNoAppDomainSupport;

            if (engine.Capabilities.AppDomains)
            {
                WireProtocol.Commands.Debugging_Thread_Stack.Reply.CallEx callEx = call as WireProtocol.Commands.Debugging_Thread_Stack.Reply.CallEx;

                appDomainId = callEx.m_appDomainID;
            }

            return(appDomainId);
        }
        public CorDebugChain(CorDebugThread thread, WireProtocol.Commands.Debugging_Thread_Stack.Reply.Call [] calls)
        {
            m_thread = thread;

            ArrayList frames = new ArrayList(calls.Length);
            bool      lastFrameWasUnmanaged = false;

            if (thread.IsVirtualThread)
            {
                frames.Add(new CorDebugInternalFrame(this, CorDebugInternalFrameType.STUBFRAME_FUNC_EVAL));
            }

            for (uint i = 0; i < calls.Length; i++)
            {
                WireProtocol.Commands.Debugging_Thread_Stack.Reply.Call   call   = calls[i];
                WireProtocol.Commands.Debugging_Thread_Stack.Reply.CallEx callEx = call as WireProtocol.Commands.Debugging_Thread_Stack.Reply.CallEx;

                if (callEx != null)
                {
                    if ((callEx.m_flags & WireProtocol.Commands.Debugging_Thread_Stack.Reply.c_AppDomainTransition) != 0)
                    {
                        //No internal frame is used in the nanoCLR.  This is simply to display the AppDomain transition
                        //in the callstack of Visual Studio.
                        frames.Add(new CorDebugInternalFrame(this, CorDebugInternalFrameType.STUBFRAME_APPDOMAIN_TRANSITION));
                    }

                    if ((callEx.m_flags & WireProtocol.Commands.Debugging_Thread_Stack.Reply.c_PseudoStackFrameForFilter) != 0)
                    {
                        //No internal frame is used in the nanoCLR for filters.  This is simply to display the transition
                        //in the callstack of Visual Studio.
                        frames.Add(new CorDebugInternalFrame(this, CorDebugInternalFrameType.STUBFRAME_M2U));
                        frames.Add(new CorDebugInternalFrame(this, CorDebugInternalFrameType.STUBFRAME_U2M));
                    }

                    if ((callEx.m_flags & WireProtocol.Commands.Debugging_Thread_Stack.Reply.c_MethodKind_Interpreted) != 0)
                    {
                        if (lastFrameWasUnmanaged)
                        {
                            frames.Add(new CorDebugInternalFrame(this, CorDebugInternalFrameType.STUBFRAME_U2M));
                        }

                        lastFrameWasUnmanaged = false;
                    }
                    else
                    {
                        if (!lastFrameWasUnmanaged)
                        {
                            frames.Add(new CorDebugInternalFrame(this, CorDebugInternalFrameType.STUBFRAME_M2U));
                        }

                        lastFrameWasUnmanaged = true;
                    }
                }


                frames.Add(new CorDebugFrame(this, call, i));
            }

            m_frames = (CorDebugFrame[])frames.ToArray(typeof(CorDebugFrame));

            uint depthCLR = 0;

            for (int iFrame = m_frames.Length - 1; iFrame >= 0; iFrame--)
            {
                m_frames[iFrame]._depthCLR = depthCLR;
                depthCLR++;
            }
        }