Exemplo n.º 1
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) {
            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;
        }
Exemplo n.º 2
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) {
            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;
        }
Exemplo n.º 3
0
 public int EnumProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, uint nRadix, ref Guid guidFilter, uint dwTimeout,
     out uint pcelt, out IEnumDebugPropertyInfo2 ppEnum)
 {
     ppEnum = new MonoPropertyInfosEnum(locals.Select(x => x.GetDebugPropertyInfo(dwFields)));
     ppEnum.GetCount(out pcelt);
     return VSConstants.S_OK;
 }
Exemplo n.º 4
0
 public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum)
 {
     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;
 }
Exemplo n.º 5
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;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Creates an enumerator for properties associated with the stack frame, such as local variables.
 /// </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="nRadix">The radix to be used in formatting any numerical information.</param>
 /// <param name="guidFilter">A GUID of a filter used to select which DEBUG_PROPERTY_INFO structures are to be enumerated, such as guidFilterLocals.</param>
 /// <param name="dwTimeout">Maximum time, in milliseconds, to wait before returning from this method. Use INFINITE to wait indefinitely.</param>
 /// <param name="pcelt">Returns the number of properties enumerated. This is the same as calling the IEnumDebugPropertyInfo2::GetCount method.</param>
 /// <param name="ppEnum">Returns an IEnumDebugPropertyInfo2 object containing a list of the desired properties.</param>
 /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
 /// <remarks>Because this method allows all selected properties to be retrieved with a single call, it is faster than sequentially calling the IDebugStackFrame2::GetDebugProperty and IDebugProperty2::EnumChildren methods.</remarks>
 public virtual int EnumProperties( enum_DEBUGPROP_INFO_FLAGS dwFields,
     uint nRadix,
     ref Guid guidFilter,
     uint dwTimeout,
     out uint pcelt,
     out IEnumDebugPropertyInfo2 ppEnum)
 {
     Logger.Debug( string.Empty );
     pcelt = 0;
     ppEnum = null;
     return VSConstants.E_NOTIMPL;
 }
Exemplo n.º 7
0
        // Construct an instance of IEnumDebugPropertyInfo2 for the locals collection only.
        private void CreateLocalProperties(out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            elementsReturned = (uint)m_numLocals;
            DEBUG_PROPERTY_INFO[] propInfo = new DEBUG_PROPERTY_INFO[m_thread.NumberOfLocals];

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

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
Exemplo n.º 8
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;
        }
Exemplo n.º 9
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;
            if (!HasChildren)
                return VSConstants.E_FAIL;

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

            ppEnum = new PropertyInfoEnum(children.Select(x => x.ConstructDebugPropertyInfo(dwFields)));
            return VSConstants.S_OK;
        }
Exemplo n.º 10
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.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;
        }
Exemplo n.º 11
0
        int IDebugStackFrame2.EnumProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, uint nRadix, ref Guid guidFilter, uint dwTimeout, out uint pcelt, out IEnumDebugPropertyInfo2 ppEnum) {
            pcelt = 0;

            int hr = ((IDebugProperty2)_property.Value).EnumChildren(dwFields, nRadix, guidFilter, enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ALL, null, dwTimeout, out ppEnum);
            if (hr < 0) {
                return hr;
            }

            if (ppEnum != null) {
                hr = ppEnum.GetCount(out pcelt);
                if (hr < 0) {
                    return hr;
                }
            }

            return VSConstants.S_OK;
        }
Exemplo n.º 12
0
        public int EnumProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, uint nRadix, ref Guid guidFilter, uint dwTimeout, out uint pcelt, out IEnumDebugPropertyInfo2 ppEnum)
        {
            DLog.Debug(DContext.VSDebuggerComCall, "DebugStackFrame.EnumProperties");
            var list = new List<DebugProperty>();

            if (guidFilter == AD7Guids.guidFilterLocalsPlusArgs)
            {
                AddLocalProperties(list);
                AddParameterProperties(list);
            }
            else if (guidFilter == AD7Guids.guidFilterAllLocalsPlusArgs)
            {
                AddLocalProperties(list);
                AddParameterProperties(list);
                AddRegisters(list, false);
            }
            else if(guidFilter == AD7Guids.guidFilterAllLocals)
            {
                AddLocalProperties(list);
                AddRegisters(list, false);
            }
            else if (guidFilter == AD7Guids.guidFilterLocals)
            {
                AddLocalProperties(list);
            }
            else if (guidFilter == AD7Guids.guidFilterArgs)
            {
                AddParameterProperties(list);
            }
            else if (guidFilter == AD7Guids.guidFilterRegisters)
            {
                AddRegisters(list, true);
            }
            else
            {
                pcelt = 0;
                ppEnum = null;
                return VSConstants.E_NOTIMPL;
            }

            pcelt = (uint) list.Count;
            ppEnum = new PropertyEnum(list.Select(x => x.ConstructDebugPropertyInfo(dwFields, nRadix)));
            return VSConstants.S_OK;
        }
Exemplo n.º 13
0
        public int EnumProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, uint nRadix, ref Guid guidFilter, uint dwTimeout, out uint pcelt, out IEnumDebugPropertyInfo2 ppEnum)
        {
            int hr;

            pcelt = 0;
            ppEnum = null;

            try
            {
                if (guidFilter == AD7Guids.guidFilterLocalsPlusArgs ||
                        guidFilter == AD7Guids.guidFilterAllLocalsPlusArgs ||
                        guidFilter == AD7Guids.guidFilterAllLocals)
                {
                    //CreateLocalsPlusArgsProperties(out elementsReturned, out enumObject);
                    CreateLocalProperties(out pcelt, out ppEnum);
                    hr = VSConstants.S_OK;
                }
                else if (guidFilter == AD7Guids.guidFilterLocals)
                {
                    CreateLocalProperties(out pcelt, out ppEnum);
                    hr = VSConstants.S_OK;
                }
                else if (guidFilter == AD7Guids.guidFilterArgs)
                {
                    //CreateParameterProperties(out elementsReturned, out enumObject);
                    hr = VSConstants.S_OK;
                }
                else
                {
                    hr = VSConstants.E_NOTIMPL;
                }
            }
            catch (Exception e)
            {
                return EngineUtils.UnexpectedException(e);
            }

            return hr;
        }
Exemplo n.º 14
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(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;
     }
 }
Exemplo n.º 15
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);
        }
Exemplo n.º 16
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(VSConstants.E_NOTIMPL);
 }
Exemplo n.º 17
0
 int IDebugStackFrame2.EnumProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref Guid guidFilter, uint dwTimeout, out uint pcelt, out IEnumDebugPropertyInfo2 ppEnum)
 {
     ppEnum = new AD7PropertyInfoEnum(new DEBUG_PROPERTY_INFO[] {
         new StackFrameRegisterProperty("Accumulator", _execState.Accumulator).GetInfo(dwFields, dwRadix)
     });
     ppEnum.GetCount(out pcelt);
     return(VSConstants.S_OK);
 }
Exemplo n.º 18
0
        // Construct an instance of IEnumDebugPropertyInfo2 for the parameters collection only.
        private void CreateParameterProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            elementsReturned = (uint)_parameters.Count;
            DEBUG_PROPERTY_INFO[] propInfo = new DEBUG_PROPERTY_INFO[_parameters.Count];

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

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
Exemplo n.º 19
0
        // Creates an enumerator for properties associated with the stack frame, such as local variables.
        // The sample engine only supports returning locals and parameters. Other possible values include
        // class fields (this pointer), registers, exceptions...
        int IDebugStackFrame2.EnumProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, uint nRadix, ref Guid guidFilter, uint dwTimeout, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            int hr;

            elementsReturned = 0;
            enumObject       = null;

            try
            {
                if (guidFilter == AD7Guids.guidFilterAllLocals ||
                    guidFilter == AD7Guids.guidFilterAllLocalsPlusArgs ||
                    guidFilter == AD7Guids.guidFilterArgs ||
                    guidFilter == AD7Guids.guidFilterLocals ||
                    guidFilter == AD7Guids.guidFilterLocalsPlusArgs)
                {
                    EnsureLocalsAndParameters();
                }

                if (guidFilter == AD7Guids.guidFilterLocalsPlusArgs ||
                    guidFilter == AD7Guids.guidFilterAllLocalsPlusArgs ||
                    guidFilter == AD7Guids.guidFilterAllLocals)
                {
                    CreateLocalsPlusArgsProperties(dwFields, out elementsReturned, out enumObject);
                    hr = Constants.S_OK;
                }
                else if (guidFilter == AD7Guids.guidFilterLocals)
                {
                    CreateLocalProperties(dwFields, out elementsReturned, out enumObject);
                    hr = Constants.S_OK;
                }
                else if (guidFilter == AD7Guids.guidFilterArgs)
                {
                    CreateParameterProperties(dwFields, out elementsReturned, out enumObject);
                    hr = Constants.S_OK;
                }
                else if (guidFilter == AD7Guids.guidFilterRegisters)
                {
                    CreateRegisterContent(dwFields, out elementsReturned, out enumObject);
                    hr = Constants.S_OK;
                }
                else
                {
                    hr = Constants.E_NOTIMPL;
                }
            }
            catch (MIException e)
            {
                return(e.HResult);
            }
            catch (Exception e)
            {
                return(EngineUtils.UnexpectedException(e));
            }

            return(hr);
        }
Exemplo n.º 20
0
        // Creates an enumerator for properties associated with the stack frame, such as local variables.
        // The sample engine only supports returning locals and parameters. Other possible values include
        // class fields (this pointer), registers, exceptions...
        int IDebugStackFrame2.EnumProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, uint nRadix, ref Guid guidFilter, uint dwTimeout, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            List <DEBUG_PROPERTY_INFO> properties;

            elementsReturned = 0;
            enumObject       = null;

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

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

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

            return(VSConstants.S_OK);
        }
Exemplo n.º 21
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)
            {
                DEBUG_PROPERTY_INFO[] properties = new DEBUG_PROPERTY_INFO[_variableInformation.Children.Count];
                for (int i = 0; i < _variableInformation.Children.Count; i++)
                {
                    properties[i] = (new AD7Property(_engine, _variableInformation.Children[i])).ConstructDebugPropertyInfo(dwFields);
                }
                ppEnum = new AD7PropertyEnum(properties);
                return(VSConstants.S_OK);
            }

            return(VSConstants.S_FALSE);
        }
Exemplo n.º 22
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;
            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);
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public override int EnumProperties(enum_DEBUGPROP_INFO_FLAGS requestedFields, uint radix, ref Guid guidFilter, uint timeout, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumDebugProperty)
        {
            LoggingUtils.PrintFunction();

            try
            {
                if ((guidFilter == DebuggeeProperty.Filters.guidFilterRegisters) || (guidFilter == DebuggeeProperty.Filters.guidFilterAutoRegisters))
                {
                    LoggingUtils.RequireOk(QueryRegisters());
                }

                if ((guidFilter == DebuggeeProperty.Filters.guidFilterAllLocals) ||
                    (guidFilter == DebuggeeProperty.Filters.guidFilterAllLocalsPlusArgs) ||
                    (guidFilter == DebuggeeProperty.Filters.guidFilterArgs) ||
                    (guidFilter == DebuggeeProperty.Filters.guidFilterLocals) ||
                    (guidFilter == DebuggeeProperty.Filters.guidFilterLocalsPlusArgs))
                {
                    LoggingUtils.RequireOk(QueryArgumentsAndLocals());
                }

                LoggingUtils.RequireOk(base.EnumProperties(requestedFields, radix, ref guidFilter, timeout, out elementsReturned, out enumDebugProperty));

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

                elementsReturned = 0;

                enumDebugProperty = null;

                return(Constants.E_FAIL);
            }
        }
Exemplo n.º 24
0
        public int EnumProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, uint nRadix, ref Guid guidFilter, uint dwTimeout, out uint pcelt, out IEnumDebugPropertyInfo2 ppEnum)
        {
            DLog.Debug(DContext.VSDebuggerComCall, "DebugStackFrame.EnumProperties");
            var list = new List <DebugProperty>();

            if (guidFilter == AD7Guids.guidFilterLocalsPlusArgs)
            {
                AddLocalProperties(list);
                AddParameterProperties(list);
            }
            else if (guidFilter == AD7Guids.guidFilterAllLocalsPlusArgs)
            {
                AddLocalProperties(list);
                AddParameterProperties(list);
                AddRegisters(list, false);
            }
            else if (guidFilter == AD7Guids.guidFilterAllLocals)
            {
                AddLocalProperties(list);
                AddRegisters(list, false);
            }
            else if (guidFilter == AD7Guids.guidFilterLocals)
            {
                AddLocalProperties(list);
            }
            else if (guidFilter == AD7Guids.guidFilterArgs)
            {
                AddParameterProperties(list);
            }
            else if (guidFilter == AD7Guids.guidFilterRegisters)
            {
                AddRegisters(list, true);
            }
            else
            {
                pcelt  = 0;
                ppEnum = null;
                return(VSConstants.E_NOTIMPL);
            }

            pcelt  = (uint)list.Count;
            ppEnum = new PropertyEnum(list.Select(x => x.ConstructDebugPropertyInfo(dwFields, nRadix)));
            return(VSConstants.S_OK);
        }
Exemplo n.º 25
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 _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);
        }
Exemplo n.º 26
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.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);
        }
Exemplo n.º 27
0
        // Construct an instance of IEnumDebugPropertyInfo2 for the combined locals and parameters.
        private void CreateLocalsPlusArgsProperties(uint radix, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            elementsReturned = 0;

            int localsLength = 0;

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

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

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

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

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
Exemplo n.º 28
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;
            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);
            }
        }
Exemplo n.º 29
0
    // Construct an instance of IEnumDebugPropertyInfo2 for the combined locals and parameters.
    private void CreateLocalsPlusArgsProperties(out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject) {
      elementsReturned = 0;

      int localsLength = 0;

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

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

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

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

      propInfo = propInfo.OrderBy(i => i.bstrName).ToArray();
      enumObject = new AD7PropertyInfoEnum(propInfo);
    }
Exemplo n.º 30
0
 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));
 }
Exemplo n.º 31
0
        public int EnumProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, uint nRadix, ref Guid guidFilter, uint dwTimeout, out uint pcelt, out IEnumDebugPropertyInfo2 ppEnum)
        {
            int hr;

            pcelt  = 0;
            ppEnum = null;

            try
            {
                if (guidFilter == AD7Guids.guidFilterLocalsPlusArgs ||
                    guidFilter == AD7Guids.guidFilterAllLocalsPlusArgs ||
                    guidFilter == AD7Guids.guidFilterAllLocals)
                {
                    //CreateLocalsPlusArgsProperties(out elementsReturned, out enumObject);
                    CreateLocalProperties(out pcelt, out ppEnum);
                    hr = VSConstants.S_OK;
                }
                else if (guidFilter == AD7Guids.guidFilterLocals)
                {
                    CreateLocalProperties(out pcelt, out ppEnum);
                    hr = VSConstants.S_OK;
                }
                else if (guidFilter == AD7Guids.guidFilterArgs)
                {
                    //CreateParameterProperties(out elementsReturned, out enumObject);
                    hr = VSConstants.S_OK;
                }
                else
                {
                    hr = VSConstants.E_NOTIMPL;
                }
            }
            catch (Exception e)
            {
                return(EngineUtils.UnexpectedException(e));
            }

            return(hr);
        }
Exemplo n.º 32
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)
        {
            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);
        }
Exemplo n.º 33
0
        private void CreateRegisterContent(enum_DEBUGPROP_INFO_FLAGS dwFields, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            IReadOnlyCollection <RegisterGroup> registerGroups = Engine.DebuggedProcess.GetRegisterGroups();

            elementsReturned = (uint)registerGroups.Count;
            DEBUG_PROPERTY_INFO[] propInfo = new DEBUG_PROPERTY_INFO[elementsReturned];
            Tuple <int, string>[] values   = null;
            Engine.DebuggedProcess.WorkerThread.RunOperation(async() =>
            {
                values = await Engine.DebuggedProcess.GetRegisters(Thread.GetDebuggedThread().Id, ThreadContext.Level);
            });
            int i = 0;

            foreach (var grp in registerGroups)
            {
                AD7RegGroupProperty regProp = new AD7RegGroupProperty(Engine, dwFields, grp, values);
                propInfo[i] = regProp.PropertyInfo;
                i++;
            }
            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
Exemplo n.º 34
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)
        {
            if (Value != null)
            {
                var props = GetChildren();
                ppEnum = new ScriptPropertyCollection(props.ToArray());
                return(VSConstants.S_OK);
            }

            ppEnum = null;
            return(VSConstants.S_FALSE);
        }
Exemplo n.º 35
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 System.Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum)
        {
            ppEnum = null;

            if (_objectValue.HasChildren)
            {
                var children = this._objectValue.GetAllChildren();
                DEBUG_PROPERTY_INFO[] properties = new DEBUG_PROPERTY_INFO[children.Length];
                for (int i = 0; i < children.Length; ++i)
                {
                    properties[i] = (new XamarinProperty(children[i])).ConstructDebugPropertyInfo(dwFields);
                }
                ppEnum = new XamarinPropertyEnum(properties);
                return(VisualStudioExtensionConstants.S_OK);
            }

            return(VisualStudioExtensionConstants.S_FALSE);
        }
Exemplo n.º 36
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;
     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;
 }
Exemplo n.º 37
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.Children.Count > 0)
            {
                List <DEBUG_PROPERTY_INFO> 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);
        }
Exemplo n.º 38
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.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;
        }
Exemplo n.º 39
0
 public int EnumChildren(uint dwFields, uint dwRadix, ref Guid guidFilter, ulong dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum)
 {
     ppEnum = (IEnumDebugPropertyInfo2)null;
     return(VSConstants.E_NOTIMPL);
 }
Exemplo n.º 40
0
        /// <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;
        }
Exemplo n.º 41
0
 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);
 }
Exemplo n.º 42
0
        // Creates an enumerator for properties associated with the stack frame, such as local variables.
        // The sample engine only supports returning locals and parameters. Other possible values include
        // class fields (this pointer), registers, exceptions...
        int IDebugStackFrame2.EnumProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, uint nRadix, ref Guid guidFilter, uint dwTimeout, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            int hr;

            elementsReturned = 0;
            enumObject = null;

            try
            {
                if (guidFilter == AD7Guids.guidFilterAllLocals ||
                    guidFilter == AD7Guids.guidFilterAllLocalsPlusArgs ||
                    guidFilter == AD7Guids.guidFilterArgs ||
                    guidFilter == AD7Guids.guidFilterLocals ||
                    guidFilter == AD7Guids.guidFilterLocalsPlusArgs)
                {
                    EnsureLocalsAndParameters();
                }

                if (guidFilter == AD7Guids.guidFilterLocalsPlusArgs ||
                        guidFilter == AD7Guids.guidFilterAllLocalsPlusArgs ||
                        guidFilter == AD7Guids.guidFilterAllLocals)
                {
                    CreateLocalsPlusArgsProperties(dwFields, out elementsReturned, out enumObject);
                    hr = Constants.S_OK;
                }
                else if (guidFilter == AD7Guids.guidFilterLocals)
                {
                    CreateLocalProperties(dwFields, out elementsReturned, out enumObject);
                    hr = Constants.S_OK;
                }
                else if (guidFilter == AD7Guids.guidFilterArgs)
                {
                    CreateParameterProperties(dwFields, out elementsReturned, out enumObject);
                    hr = Constants.S_OK;
                }
                else if (guidFilter == AD7Guids.guidFilterRegisters)
                {
                    CreateRegisterContent(dwFields, out elementsReturned, out enumObject);
                    hr = Constants.S_OK;
                }
                else
                {
                    hr = Constants.E_NOTIMPL;
                }
            }
            catch (MIException e)
            {
                return e.HResult;
            }
            catch (Exception e)
            {
                return EngineUtils.UnexpectedException(e);
            }

            return hr;
        }
Exemplo n.º 43
0
        // Construct a FRAMEINFO for this stack frame with the requested information.
        // Creates an enumerator for properties associated with the stack frame, such as local variables.
        // The sample engine only supports returning locals and parameters. Other possible values include
        // class fields (this pointer), registers, exceptions...
        int IDebugStackFrame2.EnumProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, uint nRadix, ref Guid guidFilter, uint dwTimeout, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            int hr;

            elementsReturned = 0;
            enumObject = null;

            if (guidFilter == DebuggerConstants.guidFilterLocalsPlusArgs ||
                guidFilter == DebuggerConstants.guidFilterAllLocalsPlusArgs ||
                guidFilter == DebuggerConstants.guidFilterAllLocals)
            {
                CreateLocalsPlusArgsProperties(nRadix, out elementsReturned, out enumObject);
                hr = VSConstants.S_OK;
            }
            else if (guidFilter == DebuggerConstants.guidFilterLocals)
            {
                CreateLocalProperties(nRadix, out elementsReturned, out enumObject);
                hr = VSConstants.S_OK;
            }
            else if (guidFilter == DebuggerConstants.guidFilterArgs)
            {
                CreateParameterProperties(nRadix, out elementsReturned, out enumObject);
                hr = VSConstants.S_OK;
            }
            else
            {
                hr = VSConstants.E_NOTIMPL;
            }
            return hr;
        }
Exemplo n.º 44
0
        // Construct an instance of IEnumDebugPropertyInfo2 for the parameters collection only.
        private void CreateParameterProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            elementsReturned = (uint)_parameters.Count;
            DEBUG_PROPERTY_INFO[] propInfo = new DEBUG_PROPERTY_INFO[_parameters.Count];

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

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
Exemplo n.º 45
0
        // Construct an instance of IEnumDebugPropertyInfo2 for the parameters collection only.
        private void CreateParameterProperties(uint radix, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            elementsReturned = (uint) _parameters.Length;
            var propInfo = new DEBUG_PROPERTY_INFO[_parameters.Length];

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

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
Exemplo n.º 46
0
 /// <summary>
 /// This method returns the collection of variables that are exposed at this current call stack. This
 /// is used for the locals and watch windows.
 /// </summary>
 /// <param name="dwFields"></param>
 /// <param name="nRadix"></param>
 /// <param name="guidFilter"></param>
 /// <param name="dwTimeout"></param>
 /// <param name="pcelt"></param>
 /// <param name="ppEnum"></param>
 /// <returns></returns>
 public int EnumProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, uint nRadix, ref Guid guidFilter, uint dwTimeout, out uint pcelt, out IEnumDebugPropertyInfo2 ppEnum)
 {
     Log.Debug("ScriptStackFrame: EnumProperties");
     pcelt  = 0;
     ppEnum = new ScriptPropertyCollection(_debugger);
     return(VSConstants.S_OK);
 }
Exemplo n.º 47
0
    // Construct an instance of IEnumDebugPropertyInfo2 for the parameters collection only.
    private void CreateParameterProperties(out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject) {
      elementsReturned = (uint)mParams.Length;
      var propInfo = new DEBUG_PROPERTY_INFO[mParams.Length];

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

      propInfo = propInfo.OrderBy(i => i.bstrName).ToArray();
      enumObject = new AD7PropertyInfoEnum(propInfo);
    }
Exemplo n.º 48
0
        // Construct an instance of IEnumDebugPropertyInfo2 for the combined locals and parameters.
        private void CreateLocalsPlusArgsProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            elementsReturned = 0;

            int localsLength = 0;

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

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

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

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

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
Exemplo n.º 49
0
 public int Clone(out IEnumDebugPropertyInfo2 ppEnum)
 {
     Log.Debug("Clone");
     ppEnum = null;
     return(VSConstants.E_NOTIMPL);
 }
Exemplo n.º 50
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)
        {
            uint pcelt;

            return(((IDebugStackFrame2)this).EnumProperties(dwFields, dwRadix, ref guidFilter, dwTimeout, out pcelt, out ppEnum));
        }
        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;
        }
Exemplo n.º 52
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)
        {
            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);
        }
Exemplo n.º 53
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_FALSE;
 }
Exemplo n.º 54
0
        // Construct an instance of IEnumDebugPropertyInfo2 for the combined locals and parameters.
        private void CreateLocalsPlusArgsProperties(uint radix, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            elementsReturned = 0;

            int localsLength = 0;

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

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

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

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

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
Exemplo n.º 55
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) {
            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;
        }
Exemplo n.º 56
0
        // Construct an instance of IEnumDebugPropertyInfo2 for the parameters collection only.
        private void CreateParameterProperties(uint radix, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            elementsReturned = (uint)_parameters.Length;
            DEBUG_PROPERTY_INFO[] propInfo = new DEBUG_PROPERTY_INFO[_parameters.Length];

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

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
Exemplo n.º 57
0
        // Construct an instance of IEnumDebugPropertyInfo2 for the combined locals and parameters.
        private void CreateLocalsPlusArgsProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            elementsReturned = 0;

            int localsLength = 0;

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

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

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

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

            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
Exemplo n.º 58
0
        // Creates an enumerator for properties associated with the stack frame, such as local variables.
        // The sample engine only supports returning locals and parameters. Other possible values include
        // class fields (this pointer), registers, exceptions...
        int IDebugStackFrame2.EnumProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, uint nRadix, ref Guid guidFilter, uint dwTimeout, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            int hr;

            elementsReturned = 0;
            enumObject       = null;

            if (guidFilter == DebuggerConstants.guidFilterLocalsPlusArgs ||
                guidFilter == DebuggerConstants.guidFilterAllLocalsPlusArgs ||
                guidFilter == DebuggerConstants.guidFilterAllLocals)
            {
                CreateLocalsPlusArgsProperties(nRadix, out elementsReturned, out enumObject);
                hr = VSConstants.S_OK;
            }
            else if (guidFilter == DebuggerConstants.guidFilterLocals)
            {
                CreateLocalProperties(nRadix, out elementsReturned, out enumObject);
                hr = VSConstants.S_OK;
            }
            else if (guidFilter == DebuggerConstants.guidFilterArgs)
            {
                CreateParameterProperties(nRadix, out elementsReturned, out enumObject);
                hr = VSConstants.S_OK;
            }
            else
            {
                hr = VSConstants.E_NOTIMPL;
            }
            return(hr);
        }
Exemplo n.º 59
0
        private void CreateRegisterContent(enum_DEBUGPROP_INFO_FLAGS dwFields, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject)
        {
            IReadOnlyCollection<RegisterGroup> registerGroups = Engine.DebuggedProcess.GetRegisterGroups();

            elementsReturned = (uint)registerGroups.Count;
            DEBUG_PROPERTY_INFO[] propInfo = new DEBUG_PROPERTY_INFO[elementsReturned];
            Tuple<int, string>[] values = null;
            Engine.DebuggedProcess.WorkerThread.RunOperation(async () =>
            {
                values = await Engine.DebuggedProcess.GetRegisters(Thread.GetDebuggedThread().Id, ThreadContext.Level);
            });
            int i = 0;
            foreach (var grp in registerGroups)
            {
                AD7RegGroupProperty regProp = new AD7RegGroupProperty(dwFields, grp, values);
                propInfo[i] = regProp.PropertyInfo;
                i++;
            }
            enumObject = new AD7PropertyInfoEnum(propInfo);
        }
Exemplo n.º 60
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)
        {
            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);
        }