コード例 #1
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)
 {
     ppEnum = null;
     return(Constants.S_OK);
 }
コード例 #2
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)
        {
            uint thId;

            thread.GetThreadId(out thId);
            var children = engine.DebuggedProcess.EnumChildren(GetVariableReference(), (int)thId, dwTimeout);

            DEBUG_PROPERTY_INFO[] info = new DEBUG_PROPERTY_INFO[children.Length];
            for (int i = 0; i < children.Length; i++)
            {
                var        vi   = children[i];
                ILProperty prop = new ILProperty(engine, thread, vi);
                if (vi.Type == VariableTypes.IndexAccess)
                {
                    prop.Parameters = new VariableReference[] { VariableReference.GetInteger(vi.Offset) }
                }
                ;
                prop.Parent = this;
                info[i]     = prop.GetDebugPropertyInfo(dwFields);
            }
            ppEnum = new AD7PropertyInfoEnum(info);
            return(Constants.S_OK);
        }
コード例 #3
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;
        }
コード例 #4
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;
        }
コード例 #5
0
ファイル: AD7RegProperty.cs プロジェクト: lsgxeva/MIEngine
 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)
 {
     DEBUG_PROPERTY_INFO[] properties = new DEBUG_PROPERTY_INFO[_group.Count];
     int i = 0;
     foreach (var reg in _engine.DebuggedProcess.GetRegisterDescriptions())
     {
         if (reg.Group == _group)
         {
             properties[i].dwFields = 0;
             if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0)
             {
                 properties[i].bstrName = reg.Name;
                 properties[i].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME;
             }
             if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE) != 0)
             {
                 var desc = Array.Find(_values, (v) => { return v.Item1 == reg.Index; });
                 properties[i].bstrValue = desc == null ? "??" : desc.Item2;
                 properties[i].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE;
             }
             if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0)
             {
                 properties[i].dwAttrib = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY;
                 properties[i].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB;
             }
             i++;
         }
     }
     Debug.Assert(i == _group.Count, "Failed to find registers in group.");
     ppEnum = new AD7PropertyEnum(properties);
     return Constants.S_OK;
 }
コード例 #6
0
 public int EnumChildren(
     enum_DEBUGPROP_INFO_FLAGS fields, uint radix, ref Guid guidFilter,
     enum_DBG_ATTRIB_FLAGS attribFilter, string nameFilter, uint timeout,
     out IEnumDebugPropertyInfo2 infoEnum)
 {
     infoEnum = null;
     return(VSConstants.E_NOTIMPL);
 }
コード例 #7
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)
        {
            string error         = null;
            var    attributeInfo = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_NONE;
            Value  value         = _arrayValue ?? GetValue(_currentMirror, out attributeInfo, out error);

            //System.Diagnostics.Debug.WriteLine($"--- EnumChildren from Type {_currentMirror?.GetType().FullName} - _arrayValue: {_arrayValue != null} ValueInternalType: {value?.GetType().FullName}");

            if (value is ArrayMirror)
            {
                var array = ((ArrayMirror)value);
                if (array.Rank == 1)
                {
                    ppEnum = new AD7PropertyEnum(array.GetValues(0, array.Length).Select((x, i) => new MonoProperty(_stackFrame, _currentMirror, array.Type.GetElementType(), x, i.ToString()).GetDebugPropertyInfo(dwFields)).ToArray());
                }
                else
                {
                    // multidim array [,,]
                    DEBUG_PROPERTY_INFO[] arrayValues = CreateMultiDimArrayPropertyInfos(dwFields, array);
                    ppEnum = new AD7PropertyEnum(arrayValues);
                }
                return(VSConstants.S_OK);
            }
            else if (value is StructMirror)
            {
                var obj = value as StructMirror;

                var properties = obj.Type.GetProperties().Cast <Mirror>();
                var fields     = obj.Type.GetFields();
                var children   = properties.Concat(fields).ToList();

                ppEnum = new AD7PropertyEnum(children.Select(x => new MonoProperty(_stackFrame, x, obj).GetDebugPropertyInfo(dwFields)).ToArray());

                return(VSConstants.S_OK);
            }
            else if (value is ObjectMirror)
            {
                var obj = value as ObjectMirror;

                var properties = obj.Type.GetProperties().Cast <Mirror>();
                var fields     = obj.Type.GetFields();

                var children = properties.Concat(fields).ToList();

                ppEnum = new AD7PropertyEnum(children.Select(x => new MonoProperty(_stackFrame, x, obj).GetDebugPropertyInfo(dwFields)).ToArray());
                return(VSConstants.S_OK);
            }
            else
            {
                //TODO
            }

            //TODO
            ppEnum = new AD7PropertyEnum(new DEBUG_PROPERTY_INFO[0]);
            return(VSConstants.S_OK);
        }
コード例 #8
0
 public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS fields, uint radix, ref Guid guidFilter,
                         enum_DBG_ATTRIB_FLAGS attributeFilter, string nameFilter,
                         uint timeout, out IEnumDebugPropertyInfo2 propertyEnum)
 {
     // Converts |guidFilter| to a non ref type arg so that Castle DynamicProxy doesn't fail
     // to assign values back to it.  See (internal) for more info.
     return(Self.EnumChildrenImpl(fields, radix, guidFilter, attributeFilter, nameFilter,
                                  timeout, out propertyEnum));
 }
コード例 #9
0
 /// <summary>
 /// Retrieves a list of the children of the property.
 /// </summary>
 /// <param name="dwFields">A combination of flags from the DEBUGPROP_INFO_FLAGS enumeration that specifies which fields in the enumerated DEBUG_PROPERTY_INFO structures are to be filled in.</param>
 /// <param name="dwRadix">Specifies the radix to be used in formatting any numerical information.</param>
 /// <param name="guidFilter">GUID of the filter used with the dwAttribFilter and pszNameFilter parameters to select which DEBUG_PROPERTY_INFO children are to be enumerated. For example, guidFilterLocals filters for local variables.</param>
 /// <param name="dwAttribFilter">A combination of flags from the DBG_ATTRIB_FLAGS enumeration that specifies what type of objects to enumerate, for example DBG_ATTRIB_METHOD for all methods that might be children of this property. Used in combination with the guidFilter and pszNameFilter parameters.</param>
 /// <param name="pszNameFilter">The name of the filter used with the guidFilter and dwAttribFilter parameters to select which DEBUG_PROPERTY_INFO children are to be enumerated. For example, setting this parameter to "MyX" filters for all children with the name "MyX."</param>
 /// <param name="dwTimeout">Specifies the maximum time, in milliseconds, to wait before returning from this method. Use INFINITE to wait indefinitely.</param>
 /// <param name="ppEnum">Returns an IEnumDebugPropertyInfo2 object containing a list of the child properties.</param>
 /// <returns>If successful, returns S_OK; otherwise returns error code.</returns>
 public virtual int EnumChildren( enum_DEBUGPROP_INFO_FLAGS dwFields,
     uint dwRadix,
     ref Guid guidFilter,
     enum_DBG_ATTRIB_FLAGS dwAttribFilter,
     string pszNameFilter,
     uint dwTimeout,
     out IEnumDebugPropertyInfo2 ppEnum)
 {
     Logger.Debug( string.Empty );
     ppEnum = null;
     return VSConstants.E_NOTIMPL;
 }
コード例 #10
0
 /// <summary>
 /// Retrieves a list of the children of the property.
 /// </summary>
 /// <param name="dwFields">A combination of flags from the DEBUGPROP_INFO_FLAGS enumeration that specifies which fields in the enumerated DEBUG_PROPERTY_INFO structures are to be filled in.</param>
 /// <param name="dwRadix">Specifies the radix to be used in formatting any numerical information.</param>
 /// <param name="guidFilter">GUID of the filter used with the dwAttribFilter and pszNameFilter parameters to select which DEBUG_PROPERTY_INFO children are to be enumerated. For example, guidFilterLocals filters for local variables.</param>
 /// <param name="dwAttribFilter">A combination of flags from the DBG_ATTRIB_FLAGS enumeration that specifies what type of objects to enumerate, for example DBG_ATTRIB_METHOD for all methods that might be children of this property. Used in combination with the guidFilter and pszNameFilter parameters.</param>
 /// <param name="pszNameFilter">The name of the filter used with the guidFilter and dwAttribFilter parameters to select which DEBUG_PROPERTY_INFO children are to be enumerated. For example, setting this parameter to "MyX" filters for all children with the name "MyX."</param>
 /// <param name="dwTimeout">Specifies the maximum time, in milliseconds, to wait before returning from this method. Use INFINITE to wait indefinitely.</param>
 /// <param name="ppEnum">Returns an IEnumDebugPropertyInfo2 object containing a list of the child properties.</param>
 /// <returns>If successful, returns S_OK; otherwise returns error code.</returns>
 public virtual int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields,
                                 uint dwRadix,
                                 ref Guid guidFilter,
                                 enum_DBG_ATTRIB_FLAGS dwAttribFilter,
                                 string pszNameFilter,
                                 uint dwTimeout,
                                 out IEnumDebugPropertyInfo2 ppEnum)
 {
     Logger.Debug(string.Empty);
     ppEnum = null;
     return(VSConstants.E_NOTIMPL);
 }
コード例 #11
0
 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)
 {
     return(((IDebugStackFrame2)this)
            .EnumProperties(dwFields, dwRadix, guidFilter, dwTimeout, out _, out ppEnum));
 }
コード例 #12
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);
        }
コード例 #13
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;
        }
コード例 #14
0
ファイル: AD7Property.cs プロジェクト: Strongc/VSLua
        // Enumerates the children of a property. This provides support for dereferencing pointers, displaying members of an array, or fields of a class or struct.
        // The sample debugger only supports pointer dereferencing as children. This means there is only ever one child.
        public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref System.Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum)
        {
            ppEnum = null;

            if (this.m_variableInformation.HasChildren())
            {
                DEBUG_PROPERTY_INFO[] properties = new DEBUG_PROPERTY_INFO[1];
                properties[0] = (new AD7Property(this.m_variableInformation.Children[0])).ConstructDebugPropertyInfo(dwFields);
                ppEnum = new AD7PropertyEnum(properties);
                return VSConstants.S_OK;
            }

            return VSConstants.S_FALSE;
        }
コード例 #15
0
ファイル: DebugProperty.cs プロジェクト: rfcclub/dot42
        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)
        {
            ppEnum = null;
            if (!HasChildren)
                return VSConstants.E_FAIL;

            if (children == null)
            {
                children = CreateChildren();
            }

            ppEnum = new PropertyInfoEnum(children.Select(x => x.ConstructDebugPropertyInfo(dwFields)));
            return VSConstants.S_OK;
        }
コード例 #16
0
        public int EnumChildrenImpl(enum_DEBUGPROP_INFO_FLAGS fields, uint radix, Guid guidFilter,
                                    enum_DBG_ATTRIB_FLAGS attributeFilter, string nameFilter,
                                    uint timeout, out IEnumDebugPropertyInfo2 propertyEnum)
        {
            propertyEnum = _taskExecutor.Run(() =>
            {
                _varInfo.FallbackValueFormat       = GetFallbackValueFormat(radix);
                IVariableInformation cachedVarInfo = _varInfo.GetCachedView();
                IChildrenProvider childrenProvider =
                    _childrenProviderFactory.Create(cachedVarInfo.GetChildAdapter(), fields, radix);

                return(_varInfoEnumFactory.Create(childrenProvider));
            });

            return(VSConstants.S_OK);
        }
コード例 #17
0
        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)
        {
            ppEnum = null;
            if (guidFilter != Guid.Empty && !Filter.LocalsSelected(ref guidFilter))
            {
                return(VSConstants.S_OK);
            }

            if (JsValue is JsObjectRef)
            {
                var obj = Debugger.Lookup(FrameNumber, ScopeNumber, JsValue as JsObjectRef);
                if (obj == null)
                {
                    return(VSConstants.S_OK);
                }

                JsValue = obj;
                foreach (JsValue objProp in obj.Properties.Where(x => x.HasData))
                {
                    Children[GetChildKey(objProp.Name)]
                        = Create(StackFrame, ScopeNumber, objProp, this);
                }
            }

            if (!Children.Any())
            {
                return(VSConstants.S_OK);
            }

            ppEnum = PropertyEnum.Create(Children.Select(x =>
            {
                var info = new DEBUG_PROPERTY_INFO[1];
                (x.Value as IDebugProperty2).GetPropertyInfo(dwFields, dwRadix, 0,
                                                             new IDebugReference2[0], 0, info);
                return(info[0]);
            }));
            return(VSConstants.S_OK);
        }
コード例 #18
0
        /// <summary>
        ///     Enumerates the children of a property.
        /// </summary>
        /// <param name="fields">The fields.</param>
        /// <param name="radix">The radix.</param>
        /// <param name="guidFilter">The unique identifier filter.</param>
        /// <param name="attributeFilter">The attribute filter.</param>
        /// <param name="filter">The filter.</param>
        /// <param name="timeout">The timeout.</param>
        /// <param name="enumerator">The enumerator.</param>
        /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
        public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS fields, uint radix, ref Guid guidFilter,
                                enum_DBG_ATTRIB_FLAGS attributeFilter, string filter, uint timeout, out IEnumDebugPropertyInfo2 enumerator)
        {
            enumerator = null;

            if (_value.HasChildren)
            {
                var children   = _value.GetAllChildren();
                var properties = new DEBUG_PROPERTY_INFO[children.Length];
                for (var i = 0; i < children.Length; i++)
                {
                    var child = children[i];
                    properties[i] = new MonoProperty(_expression, child, this).ConstructDebugPropertyInfo(fields);
                }
                enumerator = new MonoPropertyEnumerator(properties);
                return(S_OK);
            }

            return(S_FALSE);
        }
コード例 #19
0
        private enum_DBG_ATTRIB_FLAGS GetAttributeInfo(MethodAttributes attributes)
        {
            enum_DBG_ATTRIB_FLAGS attributeInfo = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_NONE;

            if (attributes.HasFlag(MethodAttributes.Private))
            {
                attributeInfo |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PRIVATE;
            }
            if (attributes.HasFlag(MethodAttributes.Public))
            {
                attributeInfo |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PUBLIC;
            }
            if (attributes.HasFlag(MethodAttributes.Family))
            {
                attributeInfo |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PROTECTED;
            }
            if (attributes.HasFlag(MethodAttributes.Static))
            {
                attributeInfo |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_STORAGE_STATIC;
            }

            return(attributeInfo);
        }
コード例 #20
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        #region IDebugProperty2 Members

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public virtual int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum)
        {
            //
            // Enumerates the children of a property. This provides support for dereferencing pointers, displaying members of an array, or fields of a class or struct.
            //

            LoggingUtils.PrintFunction();

            try
            {
                List <DEBUG_PROPERTY_INFO> childPropertyInfo = new List <DEBUG_PROPERTY_INFO> ();

                List <DebuggeeProperty> childRegisterProperties = new List <DebuggeeProperty> ();

                foreach (DebuggeeProperty child in m_children)
                {
                    bool displayProperty = false;

                    DEBUG_PROPERTY_INFO [] infoArray = new DEBUG_PROPERTY_INFO [1];

                    LoggingUtils.RequireOk(child.GetPropertyInfo(dwFields, dwRadix, dwTimeout, null, 0, infoArray));

                    if ((guidFilter == DebuggeeProperty.Filters.guidFilterRegisters) ||
                        (guidFilter == DebuggeeProperty.Filters.guidFilterAutoRegisters))
                    {
                        if ((infoArray [0].dwAttrib & enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_STORAGE_REGISTER) != 0)
                        {
                            childRegisterProperties.Add(child);
                        }
                    }
                    else if ((guidFilter == DebuggeeProperty.Filters.guidFilterArgs) ||
                             (guidFilter == DebuggeeProperty.Filters.guidFilterAllLocalsPlusArgs) ||
                             (guidFilter == DebuggeeProperty.Filters.guidFilterLocalsPlusArgs))
                    {
                        displayProperty |= ((infoArray [0].dwAttrib & enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_DATA) != 0);
                    }
                    else if ((guidFilter == DebuggeeProperty.Filters.guidFilterAllLocals) ||
                             (guidFilter == DebuggeeProperty.Filters.guidFilterAllLocalsPlusArgs) ||
                             (guidFilter == DebuggeeProperty.Filters.guidFilterLocals) ||
                             (guidFilter == DebuggeeProperty.Filters.guidFilterLocalsPlusArgs))
                    {
                        displayProperty |= ((infoArray [0].dwAttrib & enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_DATA) != 0);
                    }
                    else
                    {
                        displayProperty = true;
                    }

                    /*if ((infoArray [0].dwAttrib & dwAttribFilter) != 0)
                     * {
                     * displayProperty = false;
                     * }*/

                    if (displayProperty)
                    {
                        childPropertyInfo.Add(infoArray [0]);
                    }
                }

                if ((guidFilter == DebuggeeProperty.Filters.guidFilterRegisters) ||
                    (guidFilter == DebuggeeProperty.Filters.guidFilterAutoRegisters))
                {
                    //
                    //
                    // Registers must be specified in a collection/list as children of a 'CPU' property.
                    //
                    // Other types documented: https://msdn.microsoft.com/en-us/library/aa290860(v=vs.71).aspx
                    //

                    DebuggeeProperty registersProperty = new DebuggeeProperty(m_debugEngine, m_stackFrame, "CPU", string.Empty);

                    LoggingUtils.RequireOk(registersProperty.AddChildren(childRegisterProperties.ToArray()));

                    DEBUG_PROPERTY_INFO [] infoArray = new DEBUG_PROPERTY_INFO [1];

                    LoggingUtils.RequireOk(registersProperty.GetPropertyInfo(dwFields, dwRadix, dwTimeout, null, 0, infoArray));

                    childPropertyInfo.Add(infoArray [0]);
                }

                ppEnum = new DebuggeeProperty.Enumerator(childPropertyInfo);

                return(Constants.S_OK);
            }
            catch (Exception e)
            {
                LoggingUtils.HandleException(e);

                ppEnum = null;

                return(Constants.E_FAIL);
            }
        }
コード例 #21
0
ファイル: AD7Property.cs プロジェクト: AlexanderSher/RTVS-Old
 int IDebugProperty3.EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum) {
     return IDebugProperty2.EnumChildren(dwFields, dwRadix, guidFilter, dwAttribFilter, pszNameFilter, dwTimeout, out ppEnum);
 }
コード例 #22
0
ファイル: DebugProperty.cs プロジェクト: luozhiping1987/dot42
        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)
        {
            ppEnum = null;
            if (!HasChildren)
            {
                return(VSConstants.E_FAIL);
            }

            if (children == null)
            {
                children = CreateChildren();
            }

            ppEnum = new PropertyInfoEnum(children.Select(x => x.ConstructDebugPropertyInfo(dwFields, dwRadix)));
            return(VSConstants.S_OK);
        }
コード例 #23
0
ファイル: AD7Property.cs プロジェクト: robindegen/MIEngine
 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)
 {
     ppEnum = null;
     return Constants.S_FALSE;
 }
コード例 #24
0
ファイル: AD7Property.cs プロジェクト: blackberry/VSPlugin
        /// <summary>
        /// Enumerates the children of a property. This provides support for dereferencing pointers, displaying members of an array, or 
        /// fields of a class or struct. (http://msdn.microsoft.com/en-us/library/bb161791.aspx)
        /// </summary>
        /// <param name="dwFields"> A combination of flags from the DEBUGPROP_INFO_FLAGS enumeration that specifies which fields in 
        /// the enumerated DEBUG_PROPERTY_INFO structures are to be filled in. </param>
        /// <param name="dwRadix"> Specifies the radix to be used in formatting any numerical information. </param>
        /// <param name="guidFilter"> GUID of the filter used with the dwAttribFilter and pszNameFilter parameters to select which 
        /// DEBUG_PROPERTY_INFO children are to be enumerated. For example, guidFilterLocals filters for local variables. </param>
        /// <param name="dwAttribFilter"> A combination of flags from the DBG_ATTRIB_FLAGS enumeration that specifies what type of 
        /// objects to enumerate, for example DBG_ATTRIB_METHOD for all methods that might be children of this property. Used in 
        /// combination with the guidFilter and pszNameFilter parameters. </param>
        /// <param name="pszNameFilter"> The name of the filter used with the guidFilter and dwAttribFilter parameters to select which 
        /// DEBUG_PROPERTY_INFO children are to be enumerated. For example, setting this parameter to "MyX" filters for all children 
        /// with the name "MyX." </param>
        /// <param name="dwTimeout"> Specifies the maximum time, in milliseconds, to wait before returning from this method. Use 
        /// INFINITE to wait indefinitely. </param>
        /// <param name="ppEnum"> Returns an IEnumDebugPropertyInfo2 object containing a list of the child properties. </param>
        /// <returns> If successful, returns S_OK; otherwise returns S_FALSE. </returns>
        public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref System.Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum)
        {
            ppEnum = null;

            if (_variableInfo != null)
            {
                if (_variableInfo._children != null)
                {
                    if (_variableInfo._children.Count == 0)
                    {
                        // This is an array, struct, union, or pointer.
                        // Create a variable object so we can list this variable's children.

                        /// Some VS variable names cannot be used by GDB. When that happens, it is added the prefix VsNdK_ to the GDB variable
                        /// name and it is stored in the GDBNames array. At the same time, the VS name is stored in the VSNames array using the
                        /// same index position. This bool variable just indicate if this prefix is used or not.
                        bool hasVsNdK_ = false;

                        string numChildren = AD7StackFrame.m_dispatcher.createVar(_variableInfo._name, ref hasVsNdK_);

                        ArrayList GDBNames = new ArrayList();
                        ArrayList VSNames = new ArrayList();

                        if (hasVsNdK_)
                        {
                            _variableInfo._GDBName = "VsNdK_" + _variableInfo._name;
                            GDBNames.Add("VsNdK_" + _variableInfo._name);
                            VSNames.Add(_variableInfo._name);
                        }

                        try // Catch non-numerical data
                        {
                            if (Convert.ToInt32(numChildren) > 0) // If the variable has children evaluate
                            {
                                if (_variableInfo._type.Contains("struct"))
                                    if (_variableInfo._type[_variableInfo._type.Length - 1] == '*')
                                        _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "*", GDBNames, VSNames, hasVsNdK_, null);
                                    else if (_variableInfo._type.Contains("["))
                                        _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "struct[]", GDBNames, VSNames, hasVsNdK_, null);
                                    else
                                        _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "struct", GDBNames, VSNames, hasVsNdK_, null);
                                else if (_variableInfo._type.Contains("["))
                                    _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "[]", GDBNames, VSNames, hasVsNdK_, null);
                                else if (_variableInfo._type.Contains("*"))
                                    _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "*", GDBNames, VSNames, hasVsNdK_, null);
                                else
                                    _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "", GDBNames, VSNames, hasVsNdK_, null);

                            }
                        }
                        catch (FormatException e)
                        {
                        }
                        AD7StackFrame.m_dispatcher.deleteVar(_variableInfo._name, hasVsNdK_);
                    }
                    DEBUG_PROPERTY_INFO[] properties = new DEBUG_PROPERTY_INFO[_variableInfo._children.Count];
                    int i = 0;
                    foreach (VariableInfo child in _variableInfo._children)
                    {
                        VariableInfo.evaluateExpression(child._name, ref child._value, child._GDBName);
                        properties[i] = new AD7Property(child).ConstructDebugPropertyInfo(dwFields);
                        i++;
                    }
                    ppEnum = new AD7PropertyEnum(properties);
                    return VSConstants.S_OK;
                }
            }
            else if (_stackFrame != null)
            {
                uint elementsReturned = 0;
                _stackFrame.CreateLocalsPlusArgsProperties(dwFields, out elementsReturned, out ppEnum);
                return VSConstants.S_OK;
            }

            return VSConstants.S_FALSE;
        }
コード例 #25
0
ファイル: AD7Property.cs プロジェクト: PeezoSlug/PTVS
        // Enumerates the children of a property. This provides support for dereferencing pointers, displaying members of an array, or fields of a class or struct.
        // The sample debugger only supports pointer dereferencing as children. This means there is only ever one child.
        public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref System.Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum)
        {
            ppEnum = null;
            try
            {
                var children = TaskHelpers.RunSynchronouslyOnUIThread(ct =>
                {
                    var timeoutToken = CancellationTokens.GetToken(TimeSpan.FromMilliseconds(dwTimeout));
                    var linkedSource = CancellationTokenSource.CreateLinkedTokenSource(ct, timeoutToken);
                    return(_evalResult.GetChildrenAsync(linkedSource.Token));
                });

                if (children != null)
                {
                    DEBUG_PROPERTY_INFO[] properties = new DEBUG_PROPERTY_INFO[children.Length];
                    for (int i = 0; i < children.Length; i++)
                    {
                        properties[i] = new AD7Property(_frame, children[i], true).ConstructDebugPropertyInfo(dwRadix, dwFields);
                    }
                    ppEnum = new AD7PropertyEnum(properties);
                    return(VSConstants.S_OK);
                }
                return(VSConstants.S_FALSE);
            }
            catch (OperationCanceledException)
            {
                return(VSConstants.S_FALSE);
            }
        }
コード例 #26
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)
        {
            ppEnum = null;

            bool getFullName = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME) != 0;
            bool getName = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0;
            bool getType = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE) != 0;
            bool getValue = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE) != 0;
            bool getAttributes = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0;
            bool getProperty = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP) != 0;

            bool useAutoExpandValue = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE_AUTOEXPAND) != 0;
            bool noFormatting = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE_RAW) != 0;
            bool noToString = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE_NO_TOSTRING) != 0;

            List<DEBUG_PROPERTY_INFO> properties = new List<DEBUG_PROPERTY_INFO>();
            DEBUG_PROPERTY_INFO[] propertyInfo = new DEBUG_PROPERTY_INFO[1];

            IList<IField> fields = _fields;
            if (fields == null)
            {
                ReadOnlyCollection<IField> allFields = _referenceType.GetFields(false);
                fields = new List<IField>(allFields.Where(i => i.GetIsStatic()));
            }

            string typeName = _referenceType.GetName();

            foreach (var field in fields)
            {
                propertyInfo[0] = default(DEBUG_PROPERTY_INFO);

                if (getValue || getProperty)
                {
                    IDebugProperty2 property;
                    try
                    {
                        string name = field.GetName();
                        IType propertyType = field.GetFieldType();
                        IValue value = _referenceType.GetValue(field);
                        property = new JavaDebugProperty(this, name, typeName + "." + name, propertyType, value, false, field);
                        ErrorHandler.ThrowOnFailure(property.GetPropertyInfo(dwFields, dwRadix, dwTimeout, null, 0, propertyInfo));
                    }
                    catch (Exception e)
                    {
                        if (ErrorHandler.IsCriticalException(e))
                            throw;

                        string name = field.GetName();
                        IType propertyType = field.GetFieldType();
                        IValue value = field.GetVirtualMachine().GetMirrorOf(0);
                        property = new JavaDebugProperty(this, name, typeName + "." + name, propertyType, value, false, field);
                        ErrorHandler.ThrowOnFailure(property.GetPropertyInfo(dwFields, dwRadix, dwTimeout, null, 0, propertyInfo));
                    }
                }
                else
                {
                    if (getFullName)
                    {
                        propertyInfo[0].bstrFullName = typeName + "." + field.GetName();
                        propertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME;
                    }

                    if (getName)
                    {
                        propertyInfo[0].bstrName = field.GetName();
                        propertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME;
                    }

                    if (getType)
                    {
                        propertyInfo[0].bstrType = field.GetFieldTypeName();
                        propertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE;
                    }

                    if (getAttributes)
                    {
                        if (field.GetIsStatic())
                            propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_STORAGE_STATIC;
                        if (field.GetIsPrivate())
                            propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PRIVATE;
                        if (field.GetIsProtected())
                            propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PROTECTED;
                        if (field.GetIsPublic())
                            propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PUBLIC;

                        propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY;
                        propertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB;
#if false
                            bool expandable;
                            bool hasId;
                            bool canHaveId;
                            bool readOnly;
                            bool error;
                            bool sideEffect;
                            bool overloadedContainer;
                            bool boolean;
                            bool booleanTrue;
                            bool invalid;
                            bool notAThing;
                            bool autoExpanded;
                            bool timeout;
                            bool rawString;
                            bool customViewer;

                            bool accessNone;
                            bool accessPrivate;
                            bool accessProtected;
                            bool accessPublic;

                            bool storageNone;
                            bool storageGlobal;
                            bool storageStatic;
                            bool storageRegister;

                            bool noModifiers;
                            bool @virtual;
                            bool constant;
                            bool synchronized;
                            bool @volatile;

                            bool dataField;
                            bool method;
                            bool property;
                            bool @class;
                            bool baseClass;
                            bool @interface;
                            bool innerClass;
                            bool mostDerived;

                            bool multiCustomViewers;
#endif
                    }
                }

                properties.Add(propertyInfo[0]);
                continue;
            }

            ppEnum = new EnumDebugPropertyInfo(properties);
            return VSConstants.S_OK;
        }
コード例 #27
0
ファイル: AD7StackFrame.cs プロジェクト: wenh123/PTVS
        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) {
            int hr;

            uint elementsReturned = 0;
            ppEnum = null;

            if (guidFilter == DebuggerConstants.guidFilterLocalsPlusArgs ||
                    guidFilter == DebuggerConstants.guidFilterAllLocalsPlusArgs ||
                    guidFilter == DebuggerConstants.guidFilterAllLocals) {
                        CreateLocalsPlusArgsProperties(dwRadix, out elementsReturned, out ppEnum);
                hr = VSConstants.S_OK;
            } else if (guidFilter == DebuggerConstants.guidFilterLocals) {
                CreateLocalProperties(dwRadix, out elementsReturned, out ppEnum);
                hr = VSConstants.S_OK;
            } else if (guidFilter == DebuggerConstants.guidFilterArgs) {
                CreateParameterProperties(dwRadix, out elementsReturned, out ppEnum);
                hr = VSConstants.S_OK;
            } else {
                hr = VSConstants.E_NOTIMPL;
            }
            return hr;
        }
コード例 #28
0
ファイル: AD7Property.cs プロジェクト: nomada2/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 <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()", PrefetchedFields, ReprMaxLength, 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);
        }
コード例 #29
0
ファイル: AD7Property.cs プロジェクト: hkopparru/VSPlugin
        // Enumerates the children of a property. This provides support for dereferencing pointers, displaying members of an array, or fields of a class or struct.
        // The sample debugger only supports pointer dereferencing as children. This means there is only ever one child.
        public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref System.Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum)
        {
            ppEnum = null;

            if (_variableInfo._children != null)
            {
                if (_variableInfo._children.Count == 0)
                {
                    // This is an array, struct, union, or pointer.
                    // Create a variable object so we can list this variable's children.
                    bool hasVsNdK_ = false;

                    string numChildren = AD7StackFrame.m_dispatcher.createVar(_variableInfo._name, ref hasVsNdK_);

                    ArrayList GDBNames = new ArrayList();
                    ArrayList VSNames = new ArrayList();

                    if (hasVsNdK_)
                    {
                        _variableInfo._GDBName = "VsNdK_" + _variableInfo._name;
                        GDBNames.Add("VsNdK_" + _variableInfo._name);
                        VSNames.Add(_variableInfo._name);
                    }

                    try // Catch non-numerical data
                    {
                        if (Convert.ToInt32(numChildren) > 0) // If the variable has children evaluate
                        {
                            if (_variableInfo._type.Contains("struct"))
                                if (_variableInfo._type[_variableInfo._type.Length - 1] == '*')
                                    _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "*", GDBNames, VSNames, hasVsNdK_, null);
                                else if (_variableInfo._type.Contains("["))
                                    _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "struct[]", GDBNames, VSNames, hasVsNdK_, null);
                                else
                                    _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "struct", GDBNames, VSNames, hasVsNdK_, null);
                            else if (_variableInfo._type.Contains("["))
                                _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "[]", GDBNames, VSNames, hasVsNdK_, null);
                            else if (_variableInfo._type.Contains("*"))
                                _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "*", GDBNames, VSNames, hasVsNdK_, null);
                            else
                                _variableInfo.listChildren(AD7StackFrame.m_dispatcher, "", GDBNames, VSNames, hasVsNdK_, null);

                        }
                    }
                    catch (FormatException e)
                    {
                    }
                    AD7StackFrame.m_dispatcher.deleteVar(_variableInfo._name, hasVsNdK_);
                }
                DEBUG_PROPERTY_INFO[] properties = new DEBUG_PROPERTY_INFO[_variableInfo._children.Count];
                int i = 0;
                foreach (VariableInfo child in _variableInfo._children)
                {
                    VariableInfo.evaluateExpression(child._name, ref child._value, child._GDBName);
                    properties[i] = new AD7Property(child).ConstructDebugPropertyInfo(dwFields);
                    i++;
                }
                ppEnum = new AD7PropertyEnum(properties);
                return VSConstants.S_OK;
            }

            return VSConstants.S_FALSE;
        }
コード例 #30
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)
        {
            DEBUG_PROPERTY_INFO[] properties = new DEBUG_PROPERTY_INFO[_group.Count];
            int i = 0;

            foreach (var reg in DebuggedProcess.g_Process.GetRegisterDescriptions())
            {
                if (reg.Group == _group)
                {
                    properties[i].dwFields = 0;
                    if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0)
                    {
                        properties[i].bstrName  = reg.Name;
                        properties[i].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME;
                    }
                    if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE) != 0)
                    {
                        var desc = Array.Find(_values, (v) => { return(v.Item1 == reg.Index); });
                        properties[i].bstrValue = desc == null ? "??" : desc.Item2;
                        properties[i].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE;
                    }
                    if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0)
                    {
                        properties[i].dwAttrib  = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY;
                        properties[i].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB;
                    }
                    i++;
                }
            }
            Debug.Assert(i == _group.Count, "Failed to find registers in group.");
            ppEnum = new AD7PropertyEnum(properties);
            return(Constants.S_OK);
        }
コード例 #31
0
ファイル: AD7Property.cs プロジェクト: DavidFeng/BabeLua
 // Enumerates the children of a property. This provides support for dereferencing pointers, displaying members of an array, or fields of a class or struct.
 // The sample debugger only supports pointer dereferencing as children. This means there is only ever one child.
 public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref System.Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum) {
     ppEnum = null;
     var children = _evalResult.GetChildren((int)dwTimeout);
     if (children != null) {
         DEBUG_PROPERTY_INFO[] properties = new DEBUG_PROPERTY_INFO[children.Length];
         for (int i = 0; i < children.Length; i++) {
             properties[i] = new AD7Property(_frame, children[i], true).ConstructDebugPropertyInfo(dwRadix, dwFields);
         }
         ppEnum = new AD7PropertyEnum(properties);
         return VSConstants.S_OK;
     }
     return VSConstants.S_FALSE;
 }
コード例 #32
0
        // Enumerates the children of a property. This provides support for dereferencing pointers, displaying members of an array, or fields of a class or struct.
        // The sample debugger only supports pointer dereferencing as children. This means there is only ever one child.
        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 timeout     = TimeSpan.FromMilliseconds(dwTimeout);
            var tokenSource = new CancellationTokenSource(timeout);

            var children = this._evaluationResult.GetChildrenAsync(tokenSource.Token)
                           .WaitAsync(timeout, tokenSource.Token).Result;

            DEBUG_PROPERTY_INFO[] properties;
            if (children == null || children.Count == 0)
            {
                properties = new[] { new DEBUG_PROPERTY_INFO {
                                         dwFields = enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME, bstrValue = "No children"
                                     } };
            }
            else
            {
                properties = new DEBUG_PROPERTY_INFO[children.Count];
                for (var i = 0; i < children.Count; i++)
                {
                    properties[i] = new AD7Property(this._frame, children[i], this).ConstructDebugPropertyInfo(dwRadix, dwFields);
                }
            }

            if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME))
            {
                properties = properties.OrderBy(p => p.bstrName, this._comparer).ToArray();
            }

            ppEnum = new AD7PropertyEnum(properties);
            return(VSConstants.S_OK);
        }
コード例 #33
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)
        {
            Stopwatch stopwatch = Stopwatch.StartNew();
            bool infinite = dwTimeout == unchecked((uint)Timeout.Infinite);
            TimeSpan timeout = infinite ? TimeSpan.Zero : TimeSpan.FromMilliseconds(dwTimeout);

            IObjectReference objectReference = _evaluatedExpression.Value as IObjectReference;
            IReferenceType referenceType = _evaluatedExpression.ValueType as IReferenceType;
            if (objectReference == null || referenceType == null)
            {
                ppEnum = new EnumDebugPropertyInfo(Enumerable.Empty<DEBUG_PROPERTY_INFO>());
                return VSConstants.S_OK;
            }

            ppEnum = null;

            bool getFullName = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME) != 0;
            bool getName = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0;
            bool getType = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE) != 0;
            bool getValue = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE) != 0;
            bool getAttributes = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0;
            bool getProperty = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP) != 0;

            bool useAutoExpandValue = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE_AUTOEXPAND) != 0;
            bool noFormatting = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE_RAW) != 0;
            bool noToString = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE_NO_TOSTRING) != 0;

            List<DEBUG_PROPERTY_INFO> properties = new List<DEBUG_PROPERTY_INFO>();
            DEBUG_PROPERTY_INFO[] propertyInfo = new DEBUG_PROPERTY_INFO[1];

            bool isCollection = false;
            int collectionSize = 0;
            bool haveCollectionValues = false;
            ReadOnlyCollection<IValue> collectionValues = null;
            IType componentType = null;

            if (!_useRawValues)
            {
                isCollection = TryGetCollectionSize(objectReference, out collectionSize);

                if (isCollection && (getValue || getProperty))
                {
                    haveCollectionValues = TryGetCollectionValues(objectReference, out collectionValues, out componentType);
                }
            }

            if (isCollection)
            {
                for (int i = 0; i < collectionSize; i++)
                {
                    propertyInfo[0] = default(DEBUG_PROPERTY_INFO);

                    if (haveCollectionValues)
                    {
                        string name = "[" + i + "]";
                        IType propertyType = componentType;
                        IValue value = collectionValues[i];
                        JavaDebugProperty property = new JavaDebugProperty(this, name, _evaluatedExpression.FullName + name, propertyType, value, _evaluatedExpression.HasSideEffects);

                        bool timedout = !infinite && timeout < stopwatch.Elapsed;
                        enum_DEBUGPROP_INFO_FLAGS fields = dwFields;
                        if (timedout)
                            fields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE_NO_TOSTRING;

                        int hr = property.GetPropertyInfo(fields, dwRadix, dwTimeout, null, 0, propertyInfo);
                        if (ErrorHandler.Failed(hr))
                            return hr;

                        if (timedout)
                            propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_TIMEOUT;

                        properties.Add(propertyInfo[0]);
                        continue;
                    }
                    else
                    {
                        if (getFullName)
                        {
                            propertyInfo[0].bstrFullName = _evaluatedExpression.FullName + "[" + i + "]";
                            propertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME;
                        }

                        if (getName)
                        {
                            propertyInfo[0].bstrName = "[" + i + "]";
                            propertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME;
                        }

                        if (getType)
                        {
                            propertyInfo[0].bstrType = componentType.GetName();
                            propertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE;
                        }

                        if (getAttributes)
                        {
                            propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_AUTOEXPANDED;
                            propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY;
                            if (_evaluatedExpression.HasSideEffects)
                                propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_SIDE_EFFECT;

                            propertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB;
                        }
                    }
                }

                bool useRawValues = referenceType is IClassType;
                if (useRawValues)
                {
                    if (_rawValuesProperty == null)
                    {
                        _rawValuesProperty = new JavaDebugProperty(this, "Raw Values")
                            {
                                _useRawValues = true
                            };
                    }

                    propertyInfo[0] = default(DEBUG_PROPERTY_INFO);
                    ErrorHandler.ThrowOnFailure(_rawValuesProperty.GetPropertyInfo(dwFields, dwRadix, dwTimeout, null, 0, propertyInfo));
                    properties.Add(propertyInfo[0]);
                }
            }
            else
            {
                ReadOnlyCollection<IField> fields = referenceType.GetFields(false);
                List<IField> staticFields = new List<IField>(fields.Where(i => i.GetIsStatic()));

                bool useMostDerived = !_preventMostDerived && _evaluatedExpression.Value != null && !_evaluatedExpression.Value.GetValueType().Equals(referenceType);
                if (useMostDerived)
                {
                    if (_mostDerivedProperty == null)
                    {
                        _mostDerivedProperty = new JavaDebugProperty(this, string.Format("[{0}]", _evaluatedExpression.Value.GetValueType().GetName()), _evaluatedExpression.Value.GetValueType())
                            {
                                _preventMostDerived = true
                            };
                    }

                    propertyInfo[0] = default(DEBUG_PROPERTY_INFO);
                    ErrorHandler.ThrowOnFailure(_mostDerivedProperty.GetPropertyInfo(dwFields, dwRadix, dwTimeout, null, 0, propertyInfo));
                    properties.Add(propertyInfo[0]);
                }

                bool useSuper = false;
                if (!useMostDerived)
                {
                    IClassType valueType = _evaluatedExpression.ValueType as IClassType;
                    if (valueType != null)
                    {
                        IClassType superClass = valueType.GetSuperclass();
                        useSuper = superClass != null && superClass.GetName() != "java.lang.Object";

                        if (useSuper)
                        {
                            if (_superProperty == null)
                            {
                                _superProperty = new JavaDebugProperty(this, "[super]", superClass)
                                    {
                                        _preventMostDerived = true
                                    };
                            }

                            propertyInfo[0] = default(DEBUG_PROPERTY_INFO);
                            ErrorHandler.ThrowOnFailure(_superProperty.GetPropertyInfo(dwFields, dwRadix, dwTimeout, null, 0, propertyInfo));
                            properties.Add(propertyInfo[0]);
                        }
                    }
                }

                foreach (var field in fields)
                {
                    if (field.GetIsStatic())
                        continue;

                    propertyInfo[0] = default(DEBUG_PROPERTY_INFO);

                    if (getValue || getProperty)
                    {
                        IDebugProperty2 property;
                        try
                        {
                            string name = field.GetName();
                            IType propertyType = field.GetFieldType();
                            IValue value = objectReference.GetValue(field);
                            property = new JavaDebugProperty(this, name, _evaluatedExpression.FullName + "." + name, propertyType, value, _evaluatedExpression.HasSideEffects, field);
                            ErrorHandler.ThrowOnFailure(property.GetPropertyInfo(dwFields, dwRadix, dwTimeout, null, 0, propertyInfo));
                        }
                        catch (Exception e)
                        {
                            if (ErrorHandler.IsCriticalException(e))
                                throw;

                            string name = field.GetName();
                            IType propertyType = field.GetFieldType();
                            IValue value = field.GetVirtualMachine().GetMirrorOf(0);
                            property = new JavaDebugProperty(this, name, _evaluatedExpression.FullName + "." + name, propertyType, value, _evaluatedExpression.HasSideEffects, field);
                            ErrorHandler.ThrowOnFailure(property.GetPropertyInfo(dwFields, dwRadix, dwTimeout, null, 0, propertyInfo));
                        }
                    }
                    else
                    {
                        if (getFullName)
                        {
                            propertyInfo[0].bstrFullName = _evaluatedExpression.FullName + "." + field.GetName();
                            propertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME;
                        }

                        if (getName)
                        {
                            propertyInfo[0].bstrName = field.GetName();
                            propertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME;
                        }

                        if (getType)
                        {
                            propertyInfo[0].bstrType = field.GetFieldTypeName();
                            propertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE;
                        }

                        if (getAttributes)
                        {
                            if (field.GetIsStatic())
                                propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_STORAGE_STATIC;
                            if (field.GetIsPrivate())
                                propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PRIVATE;
                            if (field.GetIsProtected())
                                propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PROTECTED;
                            if (field.GetIsPublic())
                                propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PUBLIC;

                            propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY;
                            propertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB;
#if false
                            bool expandable;
                            bool hasId;
                            bool canHaveId;
                            bool readOnly;
                            bool error;
                            bool sideEffect;
                            bool overloadedContainer;
                            bool boolean;
                            bool booleanTrue;
                            bool invalid;
                            bool notAThing;
                            bool autoExpanded;
                            bool timeout;
                            bool rawString;
                            bool customViewer;

                            bool accessNone;
                            bool accessPrivate;
                            bool accessProtected;
                            bool accessPublic;

                            bool storageNone;
                            bool storageGlobal;
                            bool storageStatic;
                            bool storageRegister;

                            bool noModifiers;
                            bool @virtual;
                            bool constant;
                            bool synchronized;
                            bool @volatile;

                            bool dataField;
                            bool method;
                            bool property;
                            bool @class;
                            bool baseClass;
                            bool @interface;
                            bool innerClass;
                            bool mostDerived;

                            bool multiCustomViewers;
#endif
                        }
                    }

                    properties.Add(propertyInfo[0]);
                    continue;
                }

                if (staticFields.Count > 0)
                {
                    propertyInfo[0] = default(DEBUG_PROPERTY_INFO);

                    JavaDebugStaticMembersPseudoProperty property = new JavaDebugStaticMembersPseudoProperty(this, referenceType, staticFields);
                    ErrorHandler.ThrowOnFailure(property.GetPropertyInfo(dwFields, dwRadix, dwTimeout, null, 0, propertyInfo));
                    properties.Add(propertyInfo[0]);
                }
            }

            ppEnum = new EnumDebugPropertyInfo(properties);
            return VSConstants.S_OK;
        }
コード例 #34
0
ファイル: AD7Property.cs プロジェクト: lauxjpn/mysql-for-vs
 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)
 {
     Debug.WriteLine("AD7Property - IDebugProperty2::EnumChildren");
     ppEnum = new AD7PropertyCollection(_node, _rs);
     return(VSConstants.S_OK);
 }
コード例 #35
0
ファイル: Variables.cs プロジェクト: u20024804/MIEngine
        private async Task InternalFetchChildren()
        {
            this.VerifyNotDisposed();

            Results results = await _engine.DebuggedProcess.MICommandFactory.VarListChildren(_internalName, PropertyInfoFlags, ResultClass.None);

            if (results.ResultClass == ResultClass.done)
            {
                TupleValue[] children = results.Contains("children")
                    ? results.Find <ResultListValue>("children").FindAll <TupleValue>("child")
                    : new TupleValue[0];
                int  i       = 0;
                bool isArray = IsArrayType();
                if (isArray)
                {
                    CountChildren = results.FindUint("numchild");
                    Children      = new VariableInformation[CountChildren];
                    foreach (var c in children)
                    {
                        Children[i] = new VariableInformation(c, this);
                        i++;
                    }
                }
                else if (IsMapType())
                {
                    //
                    // support for gdb's pretty-printing built-in displayHint "map", from the gdb docs:
                    //      'Indicate that the object being printed is “map-like”, and that the
                    //      children of this value can be assumed to alternate between keys and values.'
                    //
                    List <VariableInformation> listChildren = new List <VariableInformation>();
                    for (int p = 0; p + 1 < children.Length; p += 2)
                    {
                        // One Variable is created for each pair returned with the first element (p) being the name of the child
                        // and the second element (p+1) becoming the value.
                        string name     = children[p].FindString("value");
                        var    variable = new VariableInformation(children[p + 1], this, '[' + name + ']');
                        listChildren.Add(variable);
                    }
                    Children      = listChildren.ToArray();
                    CountChildren = (uint)Children.Length;
                }
                else
                {
                    List <VariableInformation> listChildren = new List <VariableInformation>();
                    foreach (var c in children)
                    {
                        var variable = new VariableInformation(c, this);
                        enum_DBG_ATTRIB_FLAGS access = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_NONE;
                        if (variable.Name == "public")
                        {
                            access = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PUBLIC;
                            variable.VariableNodeType = NodeType.AccessQualifier;
                        }
                        else if (variable.Name == "private")
                        {
                            access = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PRIVATE;
                            variable.VariableNodeType = NodeType.AccessQualifier;
                        }
                        else if (variable.Name == "protected")
                        {
                            access = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PROTECTED;
                            variable.VariableNodeType = NodeType.AccessQualifier;
                        }
                        if (access != enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_NONE)
                        {
                            // Add this child's children
                            await variable.InternalFetchChildren();

                            foreach (var child in variable.Children)
                            {
                                ((VariableInformation)child).Access = access;
                                listChildren.Add(child);
                            }
                        }
                        else
                        {
                            listChildren.Add(variable);
                        }
                    }
                    Children      = listChildren.ToArray();
                    CountChildren = (uint)Children.Length;
                }
            }
            else
            {
                Children      = new VariableInformation[0];
                CountChildren = 0;
            }
            if (_format != null)
            {
                foreach (var child in Children)
                {
                    await child.Format();
                }
            }
        }
コード例 #36
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)
 {
     uint count;
     return _stackFrame.EnumProperties(dwFields, dwRadix, ref guidFilter, dwTimeout, out count, out ppEnum);
 }
コード例 #37
0
ファイル: AD7Property.cs プロジェクト: lioaphy/nodejstools
        // Enumerates the children of a property. This provides support for dereferencing pointers, displaying members of an array, or fields of a class or struct.
        // The sample debugger only supports pointer dereferencing as children. This means there is only ever one child.
        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) {
            TimeSpan timeout = TimeSpan.FromMilliseconds(dwTimeout);
            var tokenSource = new CancellationTokenSource(timeout);

            List<NodeEvaluationResult> children = _evaluationResult.GetChildrenAsync(tokenSource.Token)
                .WaitAsync(timeout, tokenSource.Token).Result;

            DEBUG_PROPERTY_INFO[] properties;
            if (children == null || children.Count == 0) {
                properties = new[] { new DEBUG_PROPERTY_INFO { dwFields = enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME, bstrValue = "No children" } };
            } else {
                properties = new DEBUG_PROPERTY_INFO[children.Count];
                for (int i = 0; i < children.Count; i++) {
                    properties[i] = new AD7Property(_frame, children[i], this).ConstructDebugPropertyInfo(dwRadix, dwFields);
                }
            }

            if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME)) {
                properties = properties.OrderBy(p => p.bstrName, _comparer).ToArray();
            }

            ppEnum = new AD7PropertyEnum(properties);
            return VSConstants.S_OK;
        }
コード例 #38
0
ファイル: AD7Property.cs プロジェクト: borota/JTVS
 // Enumerates the children of a property. This provides support for dereferencing pointers, displaying members of an array, or fields of a class or struct.
 // The sample debugger only supports pointer dereferencing as children. This means there is only ever one child.
 public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref System.Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum)
 {
     ppEnum = null;
     var children = _evalResult.GetChildren((int)dwTimeout);
     if (children != null) {
         DEBUG_PROPERTY_INFO[] properties = new DEBUG_PROPERTY_INFO[children.Length];
         for (int i = 0; i < children.Length; i++) {
             properties[i] = new AD7Property(_frame, children[i], true).ConstructDebugPropertyInfo(dwRadix, dwFields);
         }
         ppEnum = new AD7PropertyEnum(properties);
         return VSConstants.S_OK;
     }
     return VSConstants.S_FALSE;
 }
コード例 #39
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)
        {
            DEBUG_PROPERTY_INFO[] properties = new DEBUG_PROPERTY_INFO[_group.Count];

            ppEnum = new AD7PropertyEnum(properties);
            return(VSConstants.S_OK);
        }
コード例 #40
0
ファイル: AD7Property.cs プロジェクト: robindegen/MIEngine
        // Enumerates the children of a property. This provides support for dereferencing pointers, displaying members of an array, or fields of a class or struct.
        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)
        {
            ppEnum = null;

            _variableInformation.EnsureChildren();

            if (_variableInformation.CountChildren != 0)
            {
                try
                {
                    DebuggedProcess.g_Process.Natvis.WaitDialog.ShowWaitDialog(_variableInformation.Name);
                    var children = DebuggedProcess.g_Process.Natvis.Expand(_variableInformation);
                    DEBUG_PROPERTY_INFO[] properties = new DEBUG_PROPERTY_INFO[children.Length];
                    for (int i = 0; i < children.Length; i++)
                    {
                        properties[i] = (new AD7Property(children[i])).ConstructDebugPropertyInfo(dwFields);
                    }
                    ppEnum = new AD7PropertyEnum(properties);
                    return Constants.S_OK;
                }
                finally
                {
                    DebuggedProcess.g_Process.Natvis.WaitDialog.EndWaitDialog();
                }
            }

            return Constants.S_FALSE;
        }
コード例 #41
0
ファイル: AD7StackFrame.cs プロジェクト: lioaphy/nodejstools
 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) {
     uint pcelt;
     return ((IDebugStackFrame2)this).EnumProperties(dwFields, dwRadix, ref guidFilter, dwTimeout, out pcelt, out ppEnum);
 }
コード例 #42
0
 public int EnumChildren(enum_DEBUGREF_INFO_FLAGS dwFields, uint dwRadix, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugReferenceInfo2 ppEnum)
 {
     throw new NotImplementedException();
 }
コード例 #43
0
ファイル: AD7Property.cs プロジェクト: zachwieja/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);
        }
コード例 #44
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)
        {
            Stopwatch stopwatch = Stopwatch.StartNew();
            bool      infinite  = dwTimeout == unchecked ((uint)Timeout.Infinite);
            TimeSpan  timeout   = infinite ? TimeSpan.Zero : TimeSpan.FromMilliseconds(dwTimeout);

            IObjectReference objectReference = _evaluatedExpression.Value as IObjectReference;
            IReferenceType   referenceType   = _evaluatedExpression.ValueType as IReferenceType;

            if (objectReference == null || referenceType == null)
            {
                ppEnum = new EnumDebugPropertyInfo(Enumerable.Empty <DEBUG_PROPERTY_INFO>());
                return(VSConstants.S_OK);
            }

            ppEnum = null;

            bool getFullName   = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME) != 0;
            bool getName       = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0;
            bool getType       = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE) != 0;
            bool getValue      = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE) != 0;
            bool getAttributes = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0;
            bool getProperty   = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP) != 0;

            bool useAutoExpandValue = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE_AUTOEXPAND) != 0;
            bool noFormatting       = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE_RAW) != 0;
            bool noToString         = (dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE_NO_TOSTRING) != 0;

            List <DEBUG_PROPERTY_INFO> properties = new List <DEBUG_PROPERTY_INFO>();

            DEBUG_PROPERTY_INFO[] propertyInfo = new DEBUG_PROPERTY_INFO[1];

            bool isCollection         = false;
            int  collectionSize       = 0;
            bool haveCollectionValues = false;
            ReadOnlyCollection <IValue> collectionValues = null;
            IType componentType = null;

            if (!_useRawValues)
            {
                isCollection = TryGetCollectionSize(objectReference, out collectionSize);

                if (isCollection && (getValue || getProperty))
                {
                    haveCollectionValues = TryGetCollectionValues(objectReference, out collectionValues, out componentType);
                }
            }

            if (isCollection)
            {
                for (int i = 0; i < collectionSize; i++)
                {
                    propertyInfo[0] = default(DEBUG_PROPERTY_INFO);

                    if (haveCollectionValues)
                    {
                        string            name         = "[" + i + "]";
                        IType             propertyType = componentType;
                        IValue            value        = collectionValues[i];
                        JavaDebugProperty property     = new JavaDebugProperty(this, name, _evaluatedExpression.FullName + name, propertyType, value, _evaluatedExpression.HasSideEffects);

                        bool timedout = !infinite && timeout < stopwatch.Elapsed;
                        enum_DEBUGPROP_INFO_FLAGS fields = dwFields;
                        if (timedout)
                        {
                            fields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE_NO_TOSTRING;
                        }

                        int hr = property.GetPropertyInfo(fields, dwRadix, dwTimeout, null, 0, propertyInfo);
                        if (ErrorHandler.Failed(hr))
                        {
                            return(hr);
                        }

                        if (timedout)
                        {
                            propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_TIMEOUT;
                        }

                        properties.Add(propertyInfo[0]);
                        continue;
                    }
                    else
                    {
                        if (getFullName)
                        {
                            propertyInfo[0].bstrFullName = _evaluatedExpression.FullName + "[" + i + "]";
                            propertyInfo[0].dwFields    |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME;
                        }

                        if (getName)
                        {
                            propertyInfo[0].bstrName  = "[" + i + "]";
                            propertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME;
                        }

                        if (getType)
                        {
                            propertyInfo[0].bstrType  = componentType.GetName();
                            propertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE;
                        }

                        if (getAttributes)
                        {
                            propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_AUTOEXPANDED;
                            propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY;
                            if (_evaluatedExpression.HasSideEffects)
                            {
                                propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_SIDE_EFFECT;
                            }

                            propertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB;
                        }
                    }
                }

                bool useRawValues = referenceType is IClassType;
                if (useRawValues)
                {
                    if (_rawValuesProperty == null)
                    {
                        _rawValuesProperty = new JavaDebugProperty(this, "Raw Values")
                        {
                            _useRawValues = true
                        };
                    }

                    propertyInfo[0] = default(DEBUG_PROPERTY_INFO);
                    ErrorHandler.ThrowOnFailure(_rawValuesProperty.GetPropertyInfo(dwFields, dwRadix, dwTimeout, null, 0, propertyInfo));
                    properties.Add(propertyInfo[0]);
                }
            }
            else
            {
                ReadOnlyCollection <IField> fields = referenceType.GetFields(false);
                List <IField> staticFields         = new List <IField>(fields.Where(i => i.GetIsStatic()));

                bool useMostDerived = !_preventMostDerived && _evaluatedExpression.Value != null && !_evaluatedExpression.Value.GetValueType().Equals(referenceType);
                if (useMostDerived)
                {
                    if (_mostDerivedProperty == null)
                    {
                        _mostDerivedProperty = new JavaDebugProperty(this, string.Format("[{0}]", _evaluatedExpression.Value.GetValueType().GetName()), _evaluatedExpression.Value.GetValueType())
                        {
                            _preventMostDerived = true
                        };
                    }

                    propertyInfo[0] = default(DEBUG_PROPERTY_INFO);
                    ErrorHandler.ThrowOnFailure(_mostDerivedProperty.GetPropertyInfo(dwFields, dwRadix, dwTimeout, null, 0, propertyInfo));
                    properties.Add(propertyInfo[0]);
                }

                bool useSuper = false;
                if (!useMostDerived)
                {
                    IClassType valueType = _evaluatedExpression.ValueType as IClassType;
                    if (valueType != null)
                    {
                        IClassType superClass = valueType.GetSuperclass();
                        useSuper = superClass != null && superClass.GetName() != "java.lang.Object";

                        if (useSuper)
                        {
                            if (_superProperty == null)
                            {
                                _superProperty = new JavaDebugProperty(this, "[super]", superClass)
                                {
                                    _preventMostDerived = true
                                };
                            }

                            propertyInfo[0] = default(DEBUG_PROPERTY_INFO);
                            ErrorHandler.ThrowOnFailure(_superProperty.GetPropertyInfo(dwFields, dwRadix, dwTimeout, null, 0, propertyInfo));
                            properties.Add(propertyInfo[0]);
                        }
                    }
                }

                foreach (var field in fields)
                {
                    if (field.GetIsStatic())
                    {
                        continue;
                    }

                    propertyInfo[0] = default(DEBUG_PROPERTY_INFO);

                    if (getValue || getProperty)
                    {
                        IDebugProperty2 property;
                        try
                        {
                            string name         = field.GetName();
                            IType  propertyType = field.GetFieldType();
                            IValue value        = objectReference.GetValue(field);
                            property = new JavaDebugProperty(this, name, _evaluatedExpression.FullName + "." + name, propertyType, value, _evaluatedExpression.HasSideEffects, field);
                            ErrorHandler.ThrowOnFailure(property.GetPropertyInfo(dwFields, dwRadix, dwTimeout, null, 0, propertyInfo));
                        }
                        catch (Exception e)
                        {
                            if (ErrorHandler.IsCriticalException(e))
                            {
                                throw;
                            }

                            string name         = field.GetName();
                            IType  propertyType = field.GetFieldType();
                            IValue value        = field.GetVirtualMachine().GetMirrorOf(0);
                            property = new JavaDebugProperty(this, name, _evaluatedExpression.FullName + "." + name, propertyType, value, _evaluatedExpression.HasSideEffects, field);
                            ErrorHandler.ThrowOnFailure(property.GetPropertyInfo(dwFields, dwRadix, dwTimeout, null, 0, propertyInfo));
                        }
                    }
                    else
                    {
                        if (getFullName)
                        {
                            propertyInfo[0].bstrFullName = _evaluatedExpression.FullName + "." + field.GetName();
                            propertyInfo[0].dwFields    |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME;
                        }

                        if (getName)
                        {
                            propertyInfo[0].bstrName  = field.GetName();
                            propertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME;
                        }

                        if (getType)
                        {
                            propertyInfo[0].bstrType  = field.GetFieldTypeName();
                            propertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE;
                        }

                        if (getAttributes)
                        {
                            if (field.GetIsStatic())
                            {
                                propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_STORAGE_STATIC;
                            }
                            if (field.GetIsPrivate())
                            {
                                propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PRIVATE;
                            }
                            if (field.GetIsProtected())
                            {
                                propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PROTECTED;
                            }
                            if (field.GetIsPublic())
                            {
                                propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PUBLIC;
                            }

                            propertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY;
                            propertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB;
#if false
                            bool expandable;
                            bool hasId;
                            bool canHaveId;
                            bool readOnly;
                            bool error;
                            bool sideEffect;
                            bool overloadedContainer;
                            bool boolean;
                            bool booleanTrue;
                            bool invalid;
                            bool notAThing;
                            bool autoExpanded;
                            bool timeout;
                            bool rawString;
                            bool customViewer;

                            bool accessNone;
                            bool accessPrivate;
                            bool accessProtected;
                            bool accessPublic;

                            bool storageNone;
                            bool storageGlobal;
                            bool storageStatic;
                            bool storageRegister;

                            bool noModifiers;
                            bool @virtual;
                            bool constant;
                            bool synchronized;
                            bool @volatile;

                            bool dataField;
                            bool method;
                            bool property;
                            bool @class;
                            bool baseClass;
                            bool @interface;
                            bool innerClass;
                            bool mostDerived;

                            bool multiCustomViewers;
#endif
                        }
                    }

                    properties.Add(propertyInfo[0]);
                    continue;
                }

                if (staticFields.Count > 0)
                {
                    propertyInfo[0] = default(DEBUG_PROPERTY_INFO);

                    JavaDebugStaticMembersPseudoProperty property = new JavaDebugStaticMembersPseudoProperty(this, referenceType, staticFields);
                    ErrorHandler.ThrowOnFailure(property.GetPropertyInfo(dwFields, dwRadix, dwTimeout, null, 0, propertyInfo));
                    properties.Add(propertyInfo[0]);
                }
            }

            ppEnum = new EnumDebugPropertyInfo(properties);
            return(VSConstants.S_OK);
        }
コード例 #45
0
ファイル: AD7Property.cs プロジェクト: bagobor/NodeVsDebugger
 // Enumerates the children of a property. This provides support for dereferencing pointers, displaying members of an array, or fields of a class or struct.
 // The sample debugger only supports pointer dereferencing as children. This means there is only ever one child.
 public int EnumChildren(DIF dwFields, uint dwRadix, ref System.Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum)
 {
     ppEnum = null;
     try {
         ppEnum = new AD7PropertyEnum(m_variableInformation
             .GetChildren().OrderBy(v => v.m_name)
             .Select(v => new AD7Property(v).ConstructDebugPropertyInfo(dwFields))
         );
         return Constants.S_OK;
     } catch {
         return Constants.S_FALSE;
     }
 }
コード例 #46
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)
            {
                uint count;

                return(_stackFrame.EnumProperties(dwFields, dwRadix, ref guidFilter, dwTimeout, out count, out ppEnum));
            }
コード例 #47
0
        private Value GetValue(Mirror mirror, out enum_DBG_ATTRIB_FLAGS attributeInfo, out string errorMessage)
        {
            Value value = null;

            attributeInfo = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_NONE;
            errorMessage  = null;

            try
            {
                if (mirror is LocalVariable)
                {
                    var localMirror = mirror as LocalVariable;
                    value = _stackFrame.GetValue(localMirror);
                }
                else if (mirror is FieldInfoMirror)
                {
                    var fieldMirror = mirror as FieldInfoMirror;
                    attributeInfo = GetAttributeInfo(fieldMirror.Attributes);

                    if (fieldMirror.IsStatic)
                    {
                        value = fieldMirror.DeclaringType?.GetValue(fieldMirror);
                    }
                    else if (_parentStructMirror != null)
                    {
                        value = _parentStructMirror[fieldMirror.Name];
                    }
                    else
                    {
                        var obj = _parentMirror ?? _stackFrame.GetThis() as ObjectMirror;
                        if (obj != null)
                        {
                            value = obj.GetValue(fieldMirror);
                        }
                        else
                        {
                            System.Diagnostics.Debug.WriteLine($"FieldInfoMirror - not static - this unknown: {obj?.GetType().FullName}");
                            errorMessage = $"Field is not in scope!";
                        }
                    }
                }
                else if (mirror is PropertyInfoMirror)
                {
                    var propertyMirror = mirror as PropertyInfoMirror;
                    var getMethod      = propertyMirror.GetGetMethod(true);

                    if (getMethod == null)
                    {
                        System.Diagnostics.Debug.WriteLine($"--- GetValue getMethod is NULL!!!: {propertyMirror?.GetType().Name} ");
                        errorMessage = $"Error: GetMethod is null!";
                    }
                    else
                    {
                        attributeInfo = GetAttributeInfo(getMethod.Attributes);

                        var getMethodParams = getMethod.GetParameters();
                        if (getMethodParams.Length > 0)
                        {
                            System.Diagnostics.Debug.WriteLine($"getMethodParams.Length = {getMethodParams.Length} - not supported!");
                            errorMessage = $"Index property is not supported!";
                        }
                        else if (getMethod.IsStatic)
                        {
                            value = propertyMirror.DeclaringType?.InvokeMethod(_stackFrame.Thread, getMethod, Enumerable.Empty <Value>().ToList());
                        }
                        else if (_parentStructMirror != null)
                        {
                            value = _parentStructMirror.InvokeMethod(_stackFrame.Thread, getMethod, Enumerable.Empty <Value>().ToList());
                        }
                        else
                        {
                            var obj = _parentMirror ?? _stackFrame.GetThis() as ObjectMirror;
                            if (obj != null)
                            {
                                value = obj.InvokeMethod(_stackFrame.Thread, getMethod, Enumerable.Empty <Value>().ToList());
                            }
                            else
                            {
                                System.Diagnostics.Debug.WriteLine($"PropertyInfoMirror - not static - this unknown: {obj?.GetType().FullName}");
                                errorMessage = $"Property is not in scope!";
                            }
                        }
                    }
                }
                else if (mirror is Value)
                {
                    value = mirror as Value;
                }
                else if (mirror != null)
                {
                    errorMessage = $"Error: Mirror is not supported ({mirror?.GetType().FullName})";
                }
                else
                {
                    errorMessage = $"Error: Mirror is null!";
                }
            }
            catch (Exception ex)
            {
                errorMessage = $"Value error: {ex.Message}";
            }
            return(value);
        }
コード例 #48
0
        // Enumerates the children of a property. This provides support for dereferencing pointers, displaying members of an array, or fields of a class or struct.
        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)
        {
            ppEnum = null;

            _variableInformation.PropertyInfoFlags = dwFields;
            _variableInformation.EnsureChildren();

            if (_variableInformation.CountChildren != 0)
            {
                try
                {
                    _engine.DebuggedProcess.Natvis.WaitDialog.ShowWaitDialog(_variableInformation.Name);
                    var children = _engine.DebuggedProcess.Natvis.Expand(_variableInformation);
                    DEBUG_PROPERTY_INFO[] properties = new DEBUG_PROPERTY_INFO[children.Length];
                    for (int i = 0; i < children.Length; i++)
                    {
                        properties[i] = (new AD7Property(_engine, children[i])).ConstructDebugPropertyInfo(dwFields);
                    }
                    ppEnum = new AD7PropertyEnum(properties);
                    return(Constants.S_OK);
                }
                finally
                {
                    _engine.DebuggedProcess.Natvis.WaitDialog.EndWaitDialog();
                }
            }

            return(Constants.S_FALSE);
        }
コード例 #49
0
        // Enumerates the children of a property. This provides support for dereferencing pointers, displaying members of an array, or fields of a class or struct.
        // The sample debugger only supports pointer dereferencing as children. This means there is only ever one child.
        public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref System.Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum)
        {
            ppEnum = null;

            if (this.m_variableInformation.child != null)
            {
                DEBUG_PROPERTY_INFO[] properties = new DEBUG_PROPERTY_INFO[1];
                properties[0] = (new AD7Property(this.m_variableInformation.child)).ConstructDebugPropertyInfo(dwFields);
                ppEnum        = new AD7PropertyEnum(properties);
                return(Constants.S_OK);
            }

            return(Constants.S_FALSE);
        }
コード例 #50
0
ファイル: AD7Property.cs プロジェクト: KM198912/PatchedCosmos
        // Enumerates the children of a property. This provides support for dereferencing pointers, displaying members of an array, or fields of a class or struct.
        // The sample debugger only supports pointer dereferencing as children. This means there is only ever one child.
        public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref System.Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum)
        {
            ppEnum = null;

            if (m_variableInformation.Children.Count > 0)
            {
                var infs = new List <DEBUG_PROPERTY_INFO>();
                foreach (AD7Property dp in m_variableInformation.Children)
                {
                    infs.Add(dp.ConstructDebugPropertyInfo(dwFields));
                }
                ppEnum = new AD7PropertyEnum(infs.ToArray());
                return(VSConstants.S_OK);
            }
            //if (this.m_variableInformation.child != null)
            //{
            //    DEBUG_PROPERTY_INFO[] properties = new DEBUG_PROPERTY_INFO[1];
            //    properties[0] = (new AD7Property(this.m_variableInformation.child)).ConstructDebugPropertyInfo(dwFields);
            //    ppEnum = new AD7PropertyEnum(properties);
            //    return VSConstants.S_OK;
            //}

            return(VSConstants.S_FALSE);
        }
コード例 #51
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    #region IDebugProperty2 Members

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public override int EnumChildren (enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum)
    {
      // 
      // Enumerates the children of a property. This provides support for dereferencing pointers, displaying members of an array, or fields of a class or struct.
      // 

      LoggingUtils.PrintFunction ();

      try
      {
        if (m_gdbVariable != null)
        {
          if (m_gdbVariable.HasChildren && (m_gdbVariable.Children.Count == 0))
          {
            m_debugger.VariableManager.CreateChildVariables (m_gdbVariable, 1);
          }

          if (m_gdbVariable.Children.Count != m_children.Count)
          {
            // TODO: Dispose the properties as appropriate.

            m_children.Clear ();

            foreach (MiVariable childVariable in m_gdbVariable.Children.Values)
            {
              if (childVariable.IsPseudoChild)
              {
                CLangDebuggeeProperty pseudoChildProperty = m_debugger.VariableManager.CreatePropertyFromVariable (m_stackFrame as CLangDebuggeeStackFrame, childVariable);

                CLangDebuggeeProperty [] childSubProperties = m_debugger.VariableManager.GetChildProperties (m_stackFrame as CLangDebuggeeStackFrame, pseudoChildProperty);

                m_children.AddRange (childSubProperties);
              }
              else
              {
                CLangDebuggeeProperty childProperty = m_debugger.VariableManager.CreatePropertyFromVariable (m_stackFrame as CLangDebuggeeStackFrame, childVariable);

                if (childProperty == null)
                {
                  throw new InvalidOperationException ();
                }

                m_children.Add (childProperty);
              }
            }
          }
        }

        LoggingUtils.RequireOk (base.EnumChildren (dwFields, dwRadix, ref guidFilter, dwAttribFilter, pszNameFilter, dwTimeout, out ppEnum));

        return Constants.S_OK;
      }
      catch (Exception e)
      {
        LoggingUtils.HandleException (e);

        ppEnum = null;

        return Constants.E_FAIL;
      }
    }
コード例 #52
0
ファイル: Variables.cs プロジェクト: wiktork/MIEngine
        private async Task InternalFetchChildren()
        {
            Results results = await _engine.DebuggedProcess.CmdAsync(string.Format("-var-list-children --simple-values \"{0}\"", _internalName), ResultClass.None);

            if (results.ResultClass == ResultClass.done)
            {
                TupleValue[] children          = results.Find <ResultListValue>("children").FindAll <TupleValue>("child");
                int          i                 = 0;
                bool         isArray           = IsArrayType();
                bool         elementIsReadonly = false;
                if (isArray)
                {
                    CountChildren = results.FindUint("numchild");
                    Children      = new VariableInformation[CountChildren];
                    //if (k.Length > 0)    // perform attrib check on first array child, apply to all elements
                    //{
                    //    MICore.Debugger.Results childResults = MICore.Debugger.DecodeResults(k[0]);
                    //    string name = childResults.Find("name");
                    //    Debug.Assert(!string.IsNullOrEmpty(name));
                    //    string attribute = await m_engine.DebuggedProcess.MICommandFactory.VarShowAttributes(name);
                    //    elementIsReadonly = (attribute != "editable");
                    //}
                    foreach (var c in children)
                    {
                        Children[i] = new VariableInformation(c, this, elementIsReadonly);
                        i++;
                    }
                }
                else
                {
                    List <VariableInformation> listChildren = new List <VariableInformation>();
                    foreach (var c in children)
                    {
                        var variable = new VariableInformation(c, this);
                        enum_DBG_ATTRIB_FLAGS access = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_NONE;
                        if (variable.Name == "public")
                        {
                            access = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PUBLIC;
                            variable.VariableNodeType = NodeType.AccessQualifier;
                        }
                        else if (variable.Name == "private")
                        {
                            access = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PRIVATE;
                            variable.VariableNodeType = NodeType.AccessQualifier;
                        }
                        else if (variable.Name == "protected")
                        {
                            access = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PROTECTED;
                            variable.VariableNodeType = NodeType.AccessQualifier;
                        }
                        if (access != enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_NONE)
                        {
                            // Add this child's children
                            await variable.InternalFetchChildren();

                            foreach (var child in variable.Children)
                            {
                                ((VariableInformation)child).Access = access;
                                listChildren.Add(child);
                            }
                        }
                        else
                        {
                            listChildren.Add(variable);
                        }
                    }
                    Children      = listChildren.ToArray();
                    CountChildren = (uint)Children.Length;
                }
            }
            else
            {
                Children      = new VariableInformation[0];
                CountChildren = 0;
            }
            if (_format != null)
            {
                foreach (var child in Children)
                {
                    await child.Format();
                }
            }
        }
コード例 #53
0
ファイル: AD7Property.cs プロジェクト: happylancer/node-tools
        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)
        {
            ppEnum = null;
            IList<NodeEvaluationResult> children = _variable.Children;
            if (children == null)
            {
                return VSConstants.S_FALSE;
            }

            var properties = new DEBUG_PROPERTY_INFO[children.Count];
            for (int i = 0; i < children.Count; i++)
            {
                properties[i] = new AD7Property(children[i]).ConstructDebugPropertyInfo(dwRadix, dwFields);
            }

            ppEnum = new AD7PropertyEnum(properties);
            return VSConstants.S_OK;
        }