Пример #1
0
        public static DkmProcess GetDkmProcess(StackFrame stackFrame)
        {
            if (null != stackFrame)
            {
                DkmStackFrame dkmStackFrame = DkmStackFrame.ExtractFromDTEObject(stackFrame);
                return(dkmStackFrame.Process);
            }

            return(null);
        }
Пример #2
0
        public int GetCurrentStackFrameNumber(int threadId)
        {
            DkmStackWalkFrame frame = ExecuteOnMainThread(() => DkmStackFrame.ExtractFromDTEObject(VSContext.DTE.Debugger.CurrentStackFrame));

            DkmStackWalkFrame[] frames = threads[threadId].Frames.Value;

            for (int i = 0; i < frames.Length; i++)
            {
                if (frames[i].FrameBase == frame.FrameBase)
                {
                    return(i);
                }
            }
            return(-1);
        }
Пример #3
0
        private bool ReadProcessMemory(ulong nMemoryAddr, out string sReadContent, out string sError)
        {
            sReadContent = "";
            sError       = "";

            try
            {
                DkmStackFrame frame = DkmStackFrame.ExtractFromDTEObject(m_watch.m_dte.Debugger.CurrentStackFrame);
                sReadContent = System.Text.Encoding.ASCII.GetString(
                    frame.Process.ReadMemoryString(nMemoryAddr, DkmReadMemoryFlags.None, 1, s_nMaxReadBufLength));
            }
            catch (System.Exception ex)
            {
                sError = ex.ToString();
                return(false);
            }
            return(true);
        }