コード例 #1
0
        public void EnableProfiling()
        {
            m_engine.SetProfilingMode(_WP.Commands.Profiling_Command.ChangeConditionsFlags.c_Enabled, 0);

            //Move IsDeviceInInitializeState(), IsDeviceInExitedState(), GetDeviceState(),EnsureProcessIsInInitializedState() to Debugger.dll?
            uint executionMode = 0;

            m_engine.SetExecutionMode(0, 0, out executionMode);

            //Device should be stopped when we try to build the stack traces.
            System.Diagnostics.Debug.Assert((executionMode & _WP.Commands.Debugging_Execution_ChangeConditions.c_Stopped) != 0);

            uint[] threads = m_engine.GetThreadList();
            if (threads != null)
            {
                for (int i = 0; i < threads.Length; i++)
                {
                    _WP.Commands.Debugging_Thread_Stack.Reply reply = m_engine.GetThreadStack(threads[i]);
                    if (reply != null)
                    {
                        Stack <uint> stack = new Stack <uint>();
                        for (int j = 0; j < reply.m_data.Length; j++)
                        {
                            stack.Push(reply.m_data[j].m_md);
                        }
                        m_threadCallStacks.Add(threads[i], stack);
                    }
                }
            }
        }