コード例 #1
0
 public int EnumProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, uint nRadix, ref Guid guidFilter, uint dwTimeout,
     out uint pcelt, out IEnumDebugPropertyInfo2 ppEnum)
 {
     ppEnum = new AD7PropertyInfoEnum(LocalVariables.Select(x => x.GetDebugPropertyInfo(dwFields)).ToArray());
     ppEnum.GetCount(out pcelt);
     return VSConstants.S_OK;
 }
コード例 #2
0
 public int EnumProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, uint nRadix, ref Guid guidFilter, uint dwTimeout,
                           out uint pcelt, out IEnumDebugPropertyInfo2 ppEnum)
 {
     ppEnum = new AD7PropertyInfoEnum(LocalVariables.Select(x => x.GetDebugPropertyInfo(dwFields)).ToArray());
     ppEnum.GetCount(out pcelt);
     return(VSConstants.S_OK);
 }
コード例 #3
0
ファイル: AD7StackFrame.cs プロジェクト: PeezoSlug/PTVS
        // Construct an instance of IEnumDebugPropertyInfo2 for the parameters collection only.
        private void CreateParameterProperties(uint radix, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            elementsReturned = (uint)_parameters.Length;
            DEBUG_PROPERTY_INFO[] propInfo = new DEBUG_PROPERTY_INFO[_parameters.Length];

            for (int i = 0; i < propInfo.Length; i++)
            {
                AD7Property property = new AD7Property(this, _parameters[i], true);
                propInfo[i] = property.ConstructDebugPropertyInfo(radix, enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD);
            }

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
コード例 #4
0
        public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref Guid guidFilter,
            enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout,
            out IEnumDebugPropertyInfo2 ppEnum)
        {
            var typeMirror = variable.Type;
            var properties = typeMirror.GetProperties().Cast<Mirror>();
            var methods = typeMirror.GetMethods();
            var fields = typeMirror.GetFields();
            var children = properties.Concat(methods).Concat(fields).ToList();

            ppEnum = new AD7PropertyInfoEnum(children.Select(x => new MonoProperty(frame, variable, typeMirror, x).GetDebugPropertyInfo(dwFields)).ToArray());
            return VSConstants.S_OK;
        }
コード例 #5
0
ファイル: AD7StackFrame.cs プロジェクト: Strongc/VSLua
        // Construct an instance of IEnumDebugPropertyInfo2 for the locals collection only.
        private void CreateLocalProperties(out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            elementsReturned = (uint)m_numLocals;
            DEBUG_PROPERTY_INFO[] propInfo = new DEBUG_PROPERTY_INFO[m_thread.NumberOfLocals];

            for (int i = 0; i < propInfo.Length; i++)
            {
                AD7Property property = new AD7Property(m_thread.Locals[i]);
                propInfo[i] = property.ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD);
            }

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
コード例 #6
0
        public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref Guid guidFilter,
                                enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout,
                                out IEnumDebugPropertyInfo2 ppEnum)
        {
            var typeMirror = variable.Type;
            var properties = typeMirror.GetProperties().Cast <Mirror>();
            var methods    = typeMirror.GetMethods();
            var fields     = typeMirror.GetFields();
            var children   = properties.Concat(methods).Concat(fields).ToList();

            ppEnum = new AD7PropertyInfoEnum(children.Select(x => new MonoProperty(frame, variable, typeMirror, x).GetDebugPropertyInfo(dwFields)).ToArray());
            return(VSConstants.S_OK);
        }
コード例 #7
0
ファイル: AD7StackFrame.cs プロジェクト: PeezoSlug/PTVS
        // Construct an instance of IEnumDebugPropertyInfo2 for the combined locals and parameters.
        private void CreateLocalsPlusArgsProperties(uint radix, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            elementsReturned = 0;

            int localsLength = 0;

            if (_locals != null)
            {
                localsLength      = _locals.Length;
                elementsReturned += (uint)localsLength;
            }

            if (_parameters != null)
            {
                elementsReturned += (uint)_parameters.Length;
            }
            DEBUG_PROPERTY_INFO[] propInfo = new DEBUG_PROPERTY_INFO[elementsReturned];

            if (_locals != null)
            {
                for (int i = 0; i < _locals.Length; i++)
                {
                    AD7Property property = new AD7Property(this, _locals[i], true);
                    propInfo[i] = property.ConstructDebugPropertyInfo(radix, enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD);
                }
            }

            if (_parameters != null)
            {
                for (int i = 0; i < _parameters.Length; i++)
                {
                    AD7Property property = new AD7Property(this, _parameters[i], true);
                    propInfo[localsLength + i] = property.ConstructDebugPropertyInfo(radix, enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD);
                }
            }

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
コード例 #8
0
ファイル: AD7StackFrame.cs プロジェクト: hkopparru/VSPlugin
        // Construct an instance of IEnumDebugPropertyInfo2 for the parameters collection only.
        private void CreateParameterProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            elementsReturned = (uint)_arguments.Count;
            DEBUG_PROPERTY_INFO[] propInfo = new DEBUG_PROPERTY_INFO[_arguments.Count];

            int i = 0;
            foreach (VariableInfo arg in _arguments)
            {
                AD7Property property = new AD7Property(arg);
                propInfo[i] = property.ConstructDebugPropertyInfo(dwFields);
                i++;
            }

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
コード例 #9
0
ファイル: AD7StackFrame.cs プロジェクト: JamesLinus/Cosmos
    // Construct an instance of IEnumDebugPropertyInfo2 for the parameters collection only.
    private void CreateParameterProperties(out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject) {
      elementsReturned = (uint)mParams.Length;
      var propInfo = new DEBUG_PROPERTY_INFO[mParams.Length];

      for (int i = 0; i < propInfo.Length; i++) {
        AD7Property property = new AD7Property(mParams[i], mProcess, this);
        propInfo[i] = property.ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD);
      }

      propInfo = propInfo.OrderBy(i => i.bstrName).ToArray();
      enumObject = new AD7PropertyInfoEnum(propInfo);
    }
コード例 #10
0
ファイル: AD7StackFrame.cs プロジェクト: JamesLinus/Cosmos
    // Construct an instance of IEnumDebugPropertyInfo2 for the combined locals and parameters.
    private void CreateLocalsPlusArgsProperties(out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject) {
      elementsReturned = 0;

      int localsLength = 0;

      if (mLocals != null) {
        localsLength = mLocals.Length;
        elementsReturned += (uint)localsLength;
      }

      if (mParams != null) {
        elementsReturned += (uint)mParams.Length;
      }
      var propInfo = new DEBUG_PROPERTY_INFO[elementsReturned];

      if (mLocals != null) {
        for (int i = 0; i < mLocals.Length; i++) {
          AD7Property property = new AD7Property(mLocals[i], this.mProcess, this);
          propInfo[i] = property.ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD);
        }
      }

      if (mParams != null) {
        for (int i = 0; i < mParams.Length; i++) {
          AD7Property property = new AD7Property(mParams[i], this.mProcess, this);
          propInfo[localsLength + i] = property.ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD);
        }
      }

      propInfo = propInfo.OrderBy(i => i.bstrName).ToArray();
      enumObject = new AD7PropertyInfoEnum(propInfo);
    }
コード例 #11
0
        // Construct an instance of IEnumDebugPropertyInfo2 for the parameters collection only.
        private void CreateParameterProperties(uint radix, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            elementsReturned = (uint) _parameters.Length;
            var propInfo = new DEBUG_PROPERTY_INFO[_parameters.Length];

            for (int i = 0; i < propInfo.Length; i++)
            {
                var property = new AD7Property(_parameters[i]);
                propInfo[i] = property.ConstructDebugPropertyInfo(radix, enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD);
            }

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
コード例 #12
0
        // Construct an instance of IEnumDebugPropertyInfo2 for the combined locals and parameters.
        private void CreateLocalsPlusArgsProperties(uint radix, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            elementsReturned = 0;

            int localsLength = 0;

            if (_locals != null)
            {
                localsLength = _locals.Length;
                elementsReturned += (uint) localsLength;
            }

            if (_parameters != null)
            {
                elementsReturned += (uint) _parameters.Length;
            }
            var propInfo = new DEBUG_PROPERTY_INFO[elementsReturned];

            if (_locals != null)
            {
                for (int i = 0; i < _locals.Length; i++)
                {
                    var property = new AD7Property(_locals[i]);
                    propInfo[i] = property.ConstructDebugPropertyInfo(radix, enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD);
                }
            }

            if (_parameters != null)
            {
                for (int i = 0; i < _parameters.Length; i++)
                {
                    var property = new AD7Property(_parameters[i]);
                    propInfo[localsLength + i] = property.ConstructDebugPropertyInfo(radix, enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD);
                }
            }

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
コード例 #13
0
ファイル: AD7Property.cs プロジェクト: Microsoft/RTVS
        int IDebugProperty2.EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum) {
            IEnumerable<IREvaluationResultInfo> children = _children.Value;

            if (!RToolsSettings.Current.ShowDotPrefixedVariables) {
                children = children.Where(v => v.Name != null && !v.Name.StartsWithOrdinal("."));
            }

            var infos = children.Select(v => new AD7Property(this, v).GetDebugPropertyInfo(dwRadix, dwFields));

            var valueResult = EvaluationResult as IRValueInfo;
            if (valueResult != null) {
                if (valueResult.HasAttributes() == true) {
                    string attrExpr = Invariant($"base::attributes({valueResult.Expression})");
                    var attrResult = TaskExtensions.RunSynchronouslyOnUIThread(ct => StackFrame.StackFrame.TryEvaluateAndDescribeAsync(attrExpr, "attributes()", PrefetchedProperties, Repr, ct));
                    if (!(attrResult is IRErrorInfo)) {
                        var attrInfo = new AD7Property(this, attrResult, isSynthetic: true).GetDebugPropertyInfo(dwRadix, dwFields);
                        infos = new[] { attrInfo }.Concat(infos);
                    }
                }

                if (valueResult.Flags.HasFlag(RValueFlags.HasParentEnvironment)) {
                    string parentExpr = Invariant($"base::parent.env({valueResult.Expression})");
                    var parentResult = TaskExtensions.RunSynchronouslyOnUIThread(ct => StackFrame.StackFrame.TryEvaluateAndDescribeAsync(parentExpr, "parent.env()", PrefetchedProperties, Repr, ct));
                    if (!(parentResult is IRErrorInfo)) {
                        var parentInfo = new AD7Property(this, parentResult, isSynthetic: true).GetDebugPropertyInfo(dwRadix, dwFields);
                        infos = new[] { parentInfo }.Concat(infos);
                    }
                }
            }

            ppEnum = new AD7PropertyInfoEnum(infos.ToArray());
            return VSConstants.S_OK;
        }
コード例 #14
0
ファイル: AD7StackFrame.cs プロジェクト: robindegen/MIEngine
        // Construct an instance of IEnumDebugPropertyInfo2 for the parameters collection only.
        private void CreateParameterProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            elementsReturned = (uint)_parameters.Count;
            DEBUG_PROPERTY_INFO[] propInfo = new DEBUG_PROPERTY_INFO[_parameters.Count];

            for (int i = 0; i < propInfo.Length; i++)
            {
                AD7Property property = new AD7Property(_parameters[i]);
                propInfo[i] = property.ConstructDebugPropertyInfo(dwFields);
            }

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
コード例 #15
0
ファイル: AD7StackFrame.cs プロジェクト: hkopparru/VSPlugin
        // Construct an instance of IEnumDebugPropertyInfo2 for the combined locals and parameters.
        private void CreateLocalsPlusArgsProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            elementsReturned = 0;
            int localsLength = 0;

            if (_locals != null)
            {
                localsLength = _locals.Count;
                elementsReturned += (uint)localsLength;
            }

            if (_arguments != null)
            {
                elementsReturned += (uint)_arguments.Count;
            }
            DEBUG_PROPERTY_INFO[] propInfo = new DEBUG_PROPERTY_INFO[elementsReturned];

            if (_locals != null)
            {
                int i = 0;
                foreach(VariableInfo var in _locals)
                {
                    AD7Property property = new AD7Property(var);
                    propInfo[i] = property.ConstructDebugPropertyInfo(dwFields);
                    i++;
                }
            }

            if (_arguments != null)
            {
                int i = 0;
                foreach (VariableInfo arg in _arguments)
                {
                    AD7Property property = new AD7Property(arg);
                    propInfo[localsLength + i] = property.ConstructDebugPropertyInfo(dwFields);
                    i++;
                }
            }

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
コード例 #16
0
ファイル: AD7StackFrame.cs プロジェクト: lioaphy/nodejstools
        // Creates an enumerator for properties associated with the stack frame, such as local variables.
        // The sample engine only supports returning locals and parameters. Other possible values include
        // class fields (this pointer), registers, exceptions...
        int IDebugStackFrame2.EnumProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, uint nRadix, ref Guid guidFilter, uint dwTimeout, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject) {
            List<DEBUG_PROPERTY_INFO> properties;
            elementsReturned = 0;
            enumObject = null;

            if (guidFilter == DebuggerConstants.guidFilterLocalsPlusArgs ||
                guidFilter == DebuggerConstants.guidFilterAllLocalsPlusArgs ||
                guidFilter == DebuggerConstants.guidFilterAllLocals) {
                properties = CreateLocalsPlusArgsProperties(nRadix);
            } else if (guidFilter == DebuggerConstants.guidFilterLocals) {
                properties = CreateLocalProperties(nRadix);
            } else if (guidFilter == DebuggerConstants.guidFilterArgs) {
                properties = CreateParameterProperties(nRadix);
            } else {
                return VSConstants.E_NOTIMPL;
            }

            // Select distinct values from arguments and local variables
            properties = properties.GroupBy(p => p.bstrName).Select(p => p.First()).ToList();
            elementsReturned = (uint)properties.Count;

            enumObject = new AD7PropertyInfoEnum(properties.OrderBy(p => p.bstrName, _comparer).ToArray());

            return VSConstants.S_OK;
        }
コード例 #17
0
 // Creates an enumerator for properties associated with the stack frame, such as local variables.
 // The sample engine only supports returning locals and parameters. Other possible values include
 // class fields (this pointer), registers, exceptions...
 int IDebugStackFrame2.EnumProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, uint nRadix, ref Guid guidFilter, uint dwTimeout, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
 {
     int hr;
     elementsReturned = 0;
     enumObject = null;
     try {
         IEnumerable<Property> props = null;
         hr = Constants.S_OK;
         if (guidFilter == AD7Guids.guidFilterLocalsPlusArgs || guidFilter == AD7Guids.guidFilterAllLocalsPlusArgs || guidFilter == AD7Guids.guidFilterAllLocals) {
             props = m_locals.Concat(m_parameters);
         } else if (guidFilter == AD7Guids.guidFilterLocals) {
             props = m_locals;
         } else if (guidFilter == AD7Guids.guidFilterArgs) {
             props = m_parameters;
         } else {
             hr = Constants.E_NOTIMPL;
         }
         if (props != null) {
             var propInfos = props
                 .Select(p => new AD7Property(p).ConstructDebugPropertyInfo(dwFields))
                 .ToArray();
             elementsReturned = (uint)propInfos.Length;
             enumObject = new AD7PropertyInfoEnum(propInfos);
         }
     } catch (Exception e) {
         return EngineUtils.UnexpectedException(e);
     }
     return hr;
 }
コード例 #18
0
ファイル: AD7StackFrame.cs プロジェクト: robindegen/MIEngine
        // Construct an instance of IEnumDebugPropertyInfo2 for the combined locals and parameters.
        private void CreateLocalsPlusArgsProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            elementsReturned = 0;

            int localsLength = 0;

            if (_locals != null)
            {
                localsLength = _locals.Count;
                elementsReturned += (uint)localsLength;
            }

            if (_parameters != null)
            {
                elementsReturned += (uint)_parameters.Count;
            }
            DEBUG_PROPERTY_INFO[] propInfo = new DEBUG_PROPERTY_INFO[elementsReturned];

            if (_locals != null)
            {
                for (int i = 0; i < _locals.Count; i++)
                {
                    AD7Property property = new AD7Property(_locals[i]);
                    propInfo[i] = property.ConstructDebugPropertyInfo(dwFields);
                }
            }

            if (_parameters != null)
            {
                for (int i = 0; i < _parameters.Count; i++)
                {
                    AD7Property property = new AD7Property(_parameters[i]);
                    propInfo[localsLength + i] = property.ConstructDebugPropertyInfo(dwFields);
                }
            }

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
コード例 #19
0
ファイル: AD7StackFrame.cs プロジェクト: wenh123/PTVS
        // Construct an instance of IEnumDebugPropertyInfo2 for the locals collection only.
        private void CreateLocalProperties(uint radix, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject) {
            elementsReturned = (uint)_locals.Length;
            DEBUG_PROPERTY_INFO[] propInfo = new DEBUG_PROPERTY_INFO[_locals.Length];

            for (int i = 0; i < propInfo.Length; i++) {
                AD7Property property = new AD7Property(this, _locals[i], true);
                propInfo[i] = property.ConstructDebugPropertyInfo(radix, enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD);
            }

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
コード例 #20
0
ファイル: AD7StackFrame.cs プロジェクト: robindegen/MIEngine
        private void CreateRegisterContent(enum_DEBUGPROP_INFO_FLAGS dwFields, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            IReadOnlyCollection<RegisterGroup> registerGroups = Engine.DebuggedProcess.GetRegisterGroups();

            elementsReturned = (uint)registerGroups.Count;
            DEBUG_PROPERTY_INFO[] propInfo = new DEBUG_PROPERTY_INFO[elementsReturned];
            Tuple<int, string>[] values = null;
            Engine.DebuggedProcess.WorkerThread.RunOperation(async () =>
            {
                values = await Engine.DebuggedProcess.GetRegisters(Thread.GetDebuggedThread().Id, ThreadContext.Level);
            });
            int i = 0;
            foreach (var grp in registerGroups)
            {
                AD7RegGroupProperty regProp = new AD7RegGroupProperty(dwFields, grp, values);
                propInfo[i] = regProp.PropertyInfo;
                i++;
            }
            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
コード例 #21
0
ファイル: AD7Property.cs プロジェクト: AlexanderSher/RTVS-Old
        int IDebugProperty2.EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum) {
            IEnumerable<DebugEvaluationResult> children = _children.Value;

            if (!RToolsSettings.Current.ShowDotPrefixedVariables) {
                children = children.Where(v => v.Name != null && !v.Name.StartsWith("."));
            }

            if (IsFrameEnvironment) {
                children = children.OrderBy(v => v.Name);
            }

            var infos = children.Select(v => new AD7Property(this, v).GetDebugPropertyInfo(dwRadix, dwFields));

            var valueResult = EvaluationResult as DebugValueEvaluationResult;
            if (valueResult != null && valueResult.HasAttributes == true) {
                string attrExpr = Invariant($"base::attributes({valueResult.Expression})");
                var attrResult = TaskExtensions.RunSynchronouslyOnUIThread(ct => StackFrame.StackFrame.EvaluateAsync(attrExpr, "attributes()", reprMaxLength: ReprMaxLength, cancellationToken:ct));
                if (!(attrResult is DebugErrorEvaluationResult)) {
                    var attrInfo = new AD7Property(this, attrResult, isSynthetic: true).GetDebugPropertyInfo(dwRadix, dwFields);
                    infos = new[] { attrInfo }.Concat(infos);
                }
            }

            ppEnum = new AD7PropertyInfoEnum(infos.ToArray());
            return VSConstants.S_OK;
        }