コード例 #1
0
        /// <summary>
        /// This method evaluates the expression synchronously.
        /// </summary>
        public int EvaluateSync(enum_EVALFLAGS dwFlags, uint dwTimeout, IDebugEventCallback2 pExprCallback,
                                out IDebugProperty2 ppResult)
        {
            ppResult = null;

            if (string.IsNullOrEmpty(_castExpr))
            {
                var reg = _stackFrame.GetRegistersAsync().Await((int)dwTimeout)
                          .FirstOrDefault(r => r.Name == _registerType + _index);
                if (reg != null)
                {
                    ppResult = new DebugStackFrameValueProperty(reg, null, _stackFrame);
                    return(VSConstants.S_OK);
                }
            }
            else
            {
                var tag = GetTagFromString(_castExpr);

                if (!tag.IsPrimitive() && (dwFlags & enum_EVALFLAGS.EVAL_NOSIDEEFFECTS) != 0)
                {
                    // this evaluation has "side effects" in that it might crash the VM
                    // if the cast is to "object" or "string", but the register does not
                    // hold an object or string.
                    ppResult = new DebugConstProperty(_expression, "(this cast might crash a DalvikVM if the register is not of the casted type)", _castExpr, null)
                    {
                        HasSideEffects = true
                    };
                    return(VSConstants.E_FAIL);
                }

                var regNames = _stackFrame.GetRegisterNamesAsync().Await((int)dwTimeout);
                var vmIdx    = regNames.GetVmIndex(_registerType == "p", _index);

                if (vmIdx < 0)
                {
                    return(VSConstants.E_FAIL);
                }

                var reg = _stackFrame.GetRegistersAsync(false, tag, vmIdx).Await((int)dwTimeout);

                if (reg != null && reg.Count > 0)
                {
                    ppResult = new DebugStackFrameValueProperty(reg[0], null, _stackFrame, _expression)
                    {
                        HasSideEffects = !tag.IsPrimitive()
                    };
                    return(VSConstants.S_OK);
                }
            }

            return(VSConstants.E_FAIL);
        }
コード例 #2
0
        /// <summary>
        /// Create all child properties
        /// </summary>
        protected override List <DebugProperty> CreateChildren()
        {
            List <DebugProperty> list = new List <DebugProperty>();

            var registers = _stackFrame.GetRegistersAsync().Await(DalvikProcess.VmTimeout);

            foreach (var value in registers)
            {
                list.Insert(0, new DebugStackFrameValueProperty(value, this, _stackFrame)
                {
                    ForceHexDisplay = _forceHexDisplay
                });
            }
            list.Reverse();
            return(list);
        }