Пример #1
0
        public JavaDebugStackFrame(JavaDebugThread thread, IStackFrame stackFrame)
        {
            Contract.Requires<ArgumentNullException>(thread != null, "thread");
            Contract.Requires<ArgumentNullException>(stackFrame != null, "stackFrame");

            _thread = thread;
            _stackFrame = stackFrame;

            _nativeMethod = stackFrame.GetLocation().GetMethod().GetIsNative();
            if (!_nativeMethod)
                _debugProperty = new StackFrameDebugProperty(this);
        }
        public JavaDebugStackFrame(JavaDebugThread thread, IStackFrame stackFrame)
        {
            Contract.Requires <ArgumentNullException>(thread != null, "thread");
            Contract.Requires <ArgumentNullException>(stackFrame != null, "stackFrame");

            _thread     = thread;
            _stackFrame = stackFrame;

            _nativeMethod = stackFrame.GetLocation().GetMethod().GetIsNative();
            if (!_nativeMethod)
            {
                _debugProperty = new StackFrameDebugProperty(this);
            }
        }
        private EvaluatedExpression GetThisObject()
        {
            IMethod method = _stackFrame.GetLocation().GetMethod();

            if (method.GetIsStatic())
            {
                throw new InvalidOperationException("The instance field cannot be accessed from a static method.");
            }

            return(new EvaluatedExpression("this", "this", _stackFrame.GetLocation().GetDeclaringType(), _stackFrame.GetThisObject(), false));
        }
        private bool TryGetLocation(out string location)
        {
#if !HIDE_THREADS
            int frameCount = _thread.GetFrameCount();
            for (int i = 0; i < frameCount; i++)
            {
                IStackFrame frame  = _thread.GetFrame(i);
                IMethod     method = frame.GetLocation().GetMethod();
                if (method.GetIsNative())
                {
                    continue;
                }

                JavaDebugStackFrame stackFrame = new JavaDebugStackFrame(this, frame);
                FRAMEINFO[]         frameInfo  = new FRAMEINFO[1];
                int result = stackFrame.GetInfo(
                    enum_FRAMEINFO_FLAGS.FIF_FUNCNAME
                    | enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS
                    | enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS_NAMES
                    | enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_ARGS_TYPES
                    | enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_OFFSET
                    | enum_FRAMEINFO_FLAGS.FIF_FUNCNAME_LINES,
                    10,
                    frameInfo);
                if (ErrorHandler.Failed(result))
                {
                    break;
                }

                location = frameInfo[0].m_bstrFuncName;
                return(true);
            }
#endif

            location = null;
            return(false);
        }