private DEBUG_PROPERTY_INFO CreateInfo(enum_DEBUGPROP_INFO_FLAGS dwFields) { DEBUG_PROPERTY_INFO info = new DEBUG_PROPERTY_INFO(); info.dwFields = 0; if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0) { info.bstrName = _group.Name; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0) { info.dwAttrib = 0; info.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY; info.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP) != 0) { info.pProperty = this; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP; } return info; }
// Construct a DEBUG_PROPERTY_INFO representing this local or parameter. public DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(uint radix, enum_DEBUGPROP_INFO_FLAGS dwFields) { var propertyInfo = new DEBUG_PROPERTY_INFO(); if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME)) { propertyInfo.bstrFullName = _evaluationResult.FullName; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME)) { propertyInfo.bstrName = _evaluationResult.Expression; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE)) { propertyInfo.bstrType = _evaluationResult.TypeName; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE)) { string value = radix == 16 ? _evaluationResult.HexValue ?? _evaluationResult.StringValue : _evaluationResult.StringValue; propertyInfo.bstrValue = _evaluationResult.Type.HasFlag(NodeExpressionType.String) ? string.Format("\"{0}\"", value) : value; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB)) { if (_evaluationResult.Type.HasFlag(NodeExpressionType.ReadOnly)) { propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY; } if (_evaluationResult.Type.HasFlag(NodeExpressionType.Private)) { propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PRIVATE; } if (_evaluationResult.Type.HasFlag(NodeExpressionType.Expandable)) { propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE; } if (_evaluationResult.Type.HasFlag(NodeExpressionType.String)) { propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_RAW_STRING; } if (_evaluationResult.Type.HasFlag(NodeExpressionType.Boolean)) { propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_BOOLEAN; } if (_evaluationResult.Type.HasFlag(NodeExpressionType.Property)) { propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_PROPERTY; } if (_evaluationResult.Type.HasFlag(NodeExpressionType.Function)) { propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_METHOD; } } // Always provide the property so that we can access locals from the automation object. propertyInfo.pProperty = this; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP; return propertyInfo; }
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; }
public AD7RegGroupProperty(AD7Engine engine, enum_DEBUGPROP_INFO_FLAGS dwFields, RegisterGroup grp, Tuple<int, string>[] values) { _engine = engine; _group = grp; _values = values; PropertyInfo = CreateInfo(dwFields); }
public static DEBUG_PROPERTY_INFO ConstructErrorPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields, string name, string error, IDebugProperty2 prop) { DEBUG_PROPERTY_INFO property = new DEBUG_PROPERTY_INFO(); ; if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0) { property.bstrName = name; property.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE) != 0) { property.bstrValue = error; property.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0) { property.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_ERROR; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP) != 0) { property.pProperty = prop; property.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP; } return property; }
// Construct a DEBUG_PROPERTY_INFO representing this local or parameter. public DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(uint radix, enum_DEBUGPROP_INFO_FLAGS dwFields) { DEBUG_PROPERTY_INFO propertyInfo = new DEBUG_PROPERTY_INFO(); if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME) != 0) { propertyInfo.bstrFullName = _evalResult.Expression; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0) { if (String.IsNullOrEmpty(_evalResult.ChildText)) { propertyInfo.bstrName = _evalResult.Expression; } else { propertyInfo.bstrName = _evalResult.ChildText; } propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE) != 0) { if (_evalResult.ExceptionText != null) { propertyInfo.bstrType = "<error>"; } else { propertyInfo.bstrType = _evalResult.TypeName; } propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE) != 0) { if (_evalResult.ExceptionText != null) { propertyInfo.bstrValue = "error: " + _evalResult.ExceptionText; } else if (radix != 16) { propertyInfo.bstrValue = _evalResult.StringRepr; } else { propertyInfo.bstrValue = _evalResult.HexRepr ?? _evalResult.StringRepr; } propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0) { if (!_writable) { propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY; } if (_evalResult.ExceptionText != null) { propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_ERROR; } if (_evalResult.IsExpandable) { propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE; } } // Always Provide the property so that we can access locals from the automation object. propertyInfo.pProperty = (IDebugProperty2)this; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP; return propertyInfo; }
// Construct a DEBUG_PROPERTY_INFO representing this local or parameter. public DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields) { DEBUG_PROPERTY_INFO propertyInfo = new DEBUG_PROPERTY_INFO(); if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME) != 0) { StringBuilder sb = new StringBuilder(m_variableInformation.m_name); propertyInfo.bstrFullName = sb.ToString(); propertyInfo.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)propertyInfo.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME)); } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0) { StringBuilder sb = new StringBuilder(m_variableInformation.m_name); propertyInfo.bstrName = sb.ToString(); propertyInfo.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)propertyInfo.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME)); } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE) != 0) { StringBuilder sb = new StringBuilder(m_variableInformation.m_typeName); propertyInfo.bstrType = sb.ToString(); propertyInfo.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)propertyInfo.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE)); } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE) != 0) { StringBuilder sb = new StringBuilder(m_variableInformation.m_value); propertyInfo.bstrValue = sb.ToString(); propertyInfo.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)propertyInfo.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE)); } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0) { // The sample does not support writing of values displayed in the debugger, so mark them all as read-only. propertyInfo.dwAttrib = (enum_DBG_ATTRIB_FLAGS)DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY; if (this.m_variableInformation.child != null) { propertyInfo.dwAttrib |= (enum_DBG_ATTRIB_FLAGS)DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE; } } // If the debugger has asked for the property, or the property has children (meaning it is a pointer in the sample) // then set the pProperty field so the debugger can call back when the chilren are enumerated. if (((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP) != 0) || (this.m_variableInformation.child != null)) { propertyInfo.pProperty = (IDebugProperty2)this; propertyInfo.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)propertyInfo.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP)); } return propertyInfo; }
// 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); } enumObject = new AD7PropertyInfoEnum(propInfo); }
// Construct an instance of IEnumDebugPropertyInfo2 for the parameters collection only. private void CreateParameterProperties(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++) { MonoProperty property = new MonoProperty(parameters[i].Name, parameters[i]); propInfo[i] = property.ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD); } enumObject = new MonoPropertyInfoEnum(propInfo); }
// 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); }
internal int GetVariableHandle(DEBUG_PROPERTY_INFO propertyInfo, enum_DEBUGPROP_INFO_FLAGS propertyInfoFlags) { int handle = 0; if (propertyInfo.dwAttrib.HasFlag(enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE)) { handle = m_variableHandles.Create(new VariableEvaluationData { DebugProperty = propertyInfo.pProperty, propertyInfoFlags = propertyInfoFlags }); } return(handle); }
// 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; }
// Construct an instance of IEnumDebugPropertyInfo2 for the locals collection only. private void CreateLocalProperties(enum_DEBUGPROP_INFO_FLAGS dwFields, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject) { elementsReturned = (uint)_locals.Count; DEBUG_PROPERTY_INFO[] propInfo = new DEBUG_PROPERTY_INFO[_locals.Count]; for (int i = 0; i < propInfo.Length; i++) { AD7Property property = new AD7Property(Engine, _locals[i]); propInfo[i] = property.ConstructDebugPropertyInfo(dwFields); } enumObject = new AD7PropertyInfoEnum(propInfo); }
public void TestSkipReturnsFalseWhenSkipsTooFar() { int result = _varInfoEnum.Skip(10); Assert.That(result, Is.EqualTo(VSConstants.S_FALSE)); var propertyInfo = new DEBUG_PROPERTY_INFO[1]; result = _varInfoEnum.Next(2, propertyInfo, out uint numFetched); Assert.That(result, Is.EqualTo(VSConstants.S_FALSE)); Assert.That(numFetched, Is.EqualTo(0)); }
// Construct an instance of IEnumDebugPropertyInfo2 for the locals collection only. private void CreateLocalProperties(uint radix, out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject) { elementsReturned = (uint)_locals.Length; var propInfo = new DEBUG_PROPERTY_INFO[_locals.Length]; for (int i = 0; i < propInfo.Length; i++) { var property = new AD7Property(_locals[i]); propInfo[i] = property.ConstructDebugPropertyInfo(radix, enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD); } enumObject = new AD7PropertyInfoEnum(propInfo); }
// 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); }
// Construct a DEBUG_PROPERTY_INFO representing this local or parameter. public DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(DIF dwFields) { var propertyInfo = new DEBUG_PROPERTY_INFO(); if (dwFields.HasFlag(DIF.DEBUGPROP_INFO_FULLNAME)) { propertyInfo.bstrFullName = m_variableInformation.m_fullName; propertyInfo.dwFields |= DIF.DEBUGPROP_INFO_FULLNAME; } if (dwFields.HasFlag(DIF.DEBUGPROP_INFO_NAME)) { propertyInfo.bstrName = m_variableInformation.m_name; propertyInfo.dwFields |= DIF.DEBUGPROP_INFO_NAME; } if (dwFields.HasFlag(DIF.DEBUGPROP_INFO_TYPE)) { propertyInfo.bstrType = m_variableInformation.m_typeName; propertyInfo.dwFields = DIF.DEBUGPROP_INFO_TYPE; } if (dwFields.HasFlag(DIF.DEBUGPROP_INFO_VALUE)) { propertyInfo.bstrValue = m_variableInformation.m_value; propertyInfo.dwFields = DIF.DEBUGPROP_INFO_VALUE; } if (dwFields.HasFlag(DIF.DEBUGPROP_INFO_ATTRIB)) { // The sample does not support writing of values displayed in the debugger, so mark them all as read-only. propertyInfo.dwAttrib = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY; if (m_variableInformation.IsString) propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_RAW_STRING; if (m_variableInformation.HasChildren) propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE; if (m_variableInformation.HasAccessor) propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_PROPERTY; if (m_variableInformation.IsPrivate) propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PRIVATE; if (m_variableInformation.IsMethod) propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_METHOD; //propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_SIDE_EFFECT; propertyInfo.dwFields |= DIF.DEBUGPROP_INFO_ATTRIB; } // If the debugger has asked for the property, or the property has children (meaning it is a pointer in the sample) // then set the pProperty field so the debugger can call back when the chilren are enumerated. if ((dwFields.HasFlag(DIF.DEBUGPROP_INFO_PROP)) || (m_variableInformation.HasChildren)) { propertyInfo.pProperty = this; propertyInfo.dwFields |= DIF.DEBUGPROP_INFO_PROP; } return propertyInfo; }
// Construct an instance of IEnumDebugPropertyInfo2 for the locals collection only. private void CreateLocalProperties(out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject) { elementsReturned = (uint)mLocals.Length; var propInfo = new DEBUG_PROPERTY_INFO[mLocals.Length]; for (int i = 0; i < propInfo.Length; i++) { AD7Property property = new AD7Property(mLocals[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); }
/// <summary> /// Construct a DEBUG_PROPERTY_INFO representing this local or parameter. /// </summary> /// <param name="dwFields"> A combination of flags from the DEBUGPROP_INFO_FLAGS enumeration that specifies which variables are /// to be filled in. </param> /// <returns> The Property info. </returns> public DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields) { DEBUG_PROPERTY_INFO propertyInfo = new DEBUG_PROPERTY_INFO(); if (_variableInfo != null) { string name = _variableInfo._name; if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME) != 0) { propertyInfo.bstrFullName = name; propertyInfo.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)propertyInfo.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME)); } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0) { propertyInfo.bstrName = name; propertyInfo.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)propertyInfo.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME)); } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE) != 0) { propertyInfo.bstrType = _variableInfo._type; propertyInfo.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)propertyInfo.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE)); } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE) != 0) { propertyInfo.bstrValue = _variableInfo._value; propertyInfo.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)propertyInfo.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE)); } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0) { if (_variableInfo._children != null) { propertyInfo.dwAttrib |= (enum_DBG_ATTRIB_FLAGS)DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE; } } // If the debugger has asked for the property, or the property has children (meaning it is a pointer in the sample) // then set the pProperty field so the debugger can call back when the chilren are enumerated. if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP) != 0 || _variableInfo._children != null) { propertyInfo.pProperty = (IDebugProperty2)this; propertyInfo.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)propertyInfo.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP)); } } return propertyInfo; }
public void NatvisReloadCommand() { IDebugExpression expression = CreateExpression(".natvisreload"); Assert.AreEqual(VSConstants.S_OK, expression.EvaluateSync(0, 0, null, out IDebugProperty2 property)); DEBUG_PROPERTY_INFO info = GetPropertyInfo(property, enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB); Assert.That(!info.dwAttrib.HasFlag(enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_ERROR)); _engineCommandsMock.Received().ReloadNatvis(Arg.Any <TextWriter>(), out string _); }
private static IPropertyInfo GetPropertyInfo(IDebugProperty2 debugProperty, PropertyInfoFactory propertyInfoFactory) { IDebugReference2[] reference = new IDebugReference2[1]; DEBUG_PROPERTY_INFO[] propertyInfo = new DEBUG_PROPERTY_INFO[1]; debugProperty.GetPropertyInfo( enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ALL | enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE, 10, Configuration.DefaultTimeoutForVSCalls, reference, 0, propertyInfo).ThrowOnFailure(); return(propertyInfoFactory.Create(propertyInfo[0], null)); }
// 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; }
// 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); }
// Construct a DEBUG_PROPERTY_INFO representing this local or parameter. public DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields) { DEBUG_PROPERTY_INFO propertyInfo = new DEBUG_PROPERTY_INFO(); if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME) != 0) { propertyInfo.bstrFullName = m_variableInformation.m_name; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0) { propertyInfo.bstrName = m_variableInformation.m_name; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE) != 0) { propertyInfo.bstrType = m_variableInformation.m_typeName; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE) != 0) { propertyInfo.bstrValue = m_variableInformation.m_value; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0) { // The sample does not support writing of values displayed in the debugger, so mark them all as read-only. propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY; if (this.m_variableInformation.child != null) { propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE; } } // If the debugger has asked for the property, or the property has children (meaning it is a pointer in the sample) // then set the pProperty field so the debugger can call back when the chilren are enumerated. if (((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP) != 0) || (this.m_variableInformation.child != null)) { propertyInfo.pProperty = (IDebugProperty2)this; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP; } return(propertyInfo); }
/// <summary> /// Construct a DEBUG_PROPERTY_INFO representing this local or parameter. /// </summary> /// <param name="dwFields"> A combination of flags from the DEBUGPROP_INFO_FLAGS enumeration that specifies which variables are /// to be filled in. </param> /// <returns> The Property info. </returns> public DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields) { DEBUG_PROPERTY_INFO propertyInfo = new DEBUG_PROPERTY_INFO(); if (_variableInfo != null) { string name = _variableInfo._name; if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME) != 0) { propertyInfo.bstrFullName = name; propertyInfo.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)propertyInfo.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME)); } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0) { propertyInfo.bstrName = name; propertyInfo.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)propertyInfo.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME)); } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE) != 0) { propertyInfo.bstrType = _variableInfo._type; propertyInfo.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)propertyInfo.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE)); } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE) != 0) { propertyInfo.bstrValue = _variableInfo._value; propertyInfo.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)propertyInfo.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE)); } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0) { if (_variableInfo._children != null) { propertyInfo.dwAttrib |= (enum_DBG_ATTRIB_FLAGS)DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE; } } // If the debugger has asked for the property, or the property has children (meaning it is a pointer in the sample) // then set the pProperty field so the debugger can call back when the chilren are enumerated. if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP) != 0 || _variableInfo._children != null) { propertyInfo.pProperty = (IDebugProperty2)this; propertyInfo.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)propertyInfo.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP)); } } return(propertyInfo); }
public void TestSkipAndGetChildren() { int result = _varInfoEnum.Skip(2); Assert.That(result, Is.EqualTo(VSConstants.S_OK)); var propertyInfo = new DEBUG_PROPERTY_INFO[1]; result = _varInfoEnum.Next(1, propertyInfo, out uint numFetched); Assert.That(result, Is.EqualTo(VSConstants.S_OK)); Assert.That(numFetched, Is.EqualTo(1)); Assert.That(propertyInfo[0].bstrName, Is.EqualTo(_children[2].DisplayName)); }
private void EnumLocals(out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject) { ObjectValue[] locals = _monoStackFrame.GetLocalVariables(EvaluationOptions.DefaultOptions); elementsReturned = (uint)locals.Length; DEBUG_PROPERTY_INFO[] propInfo = new DEBUG_PROPERTY_INFO[locals.Length]; for (int i = 0; i < propInfo.Length; i++) { MonoProperty property = new MonoProperty(null, locals[i], locals[i].Name); propInfo[i] = property.CreatePropertyInfo((uint)enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD); } enumObject = new MonoPropertyEnumerator(propInfo); }
public int GetPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, uint dwTimeout, IDebugReference2[] rgpArgs, uint dwArgCount, DEBUG_PROPERTY_INFO[] pPropertyInfo) { pPropertyInfo[0] = new DEBUG_PROPERTY_INFO(); if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB)) { pPropertyInfo[0].dwAttrib = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_ERROR; pPropertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE)) { pPropertyInfo[0].bstrValue = _errorText; pPropertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE; } return VSConstants.S_OK; }
internal DEBUG_PROPERTY_INFO GetDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields) { var propertyInfo = new DEBUG_PROPERTY_INFO(); if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME) != 0) { propertyInfo.bstrFullName = info != null ? info.Name : info.Name; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0) { propertyInfo.bstrName = info != null ? info.Name : info.Name; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE) != 0) { propertyInfo.bstrType = info.TypeName; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE) != 0) { propertyInfo.bstrValue = info.Value; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0) { propertyInfo.dwAttrib = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY; if (IsExpandable()) { propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE; } propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB; } if (((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP) != 0) || IsExpandable()) { propertyInfo.pProperty = this; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP; } return(propertyInfo); }
public void GetPropertyInfo() { var testName = "test name"; var testValue = "test value"; var property = new DebugProperty.Factory().Create(testName, testValue); var propertyInfo = new DEBUG_PROPERTY_INFO[1]; Assert.AreEqual(VSConstants.S_OK, property.GetPropertyInfo( (enum_DEBUGPROP_INFO_FLAGS)0, 0, 0, new IDebugReference2[0], 0, propertyInfo)); Assert.AreEqual(testName, propertyInfo[0].bstrName); Assert.AreEqual(testValue, propertyInfo[0].bstrValue); Assert.AreEqual( enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME | enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE, propertyInfo[0].dwFields); }
// Construct an instance of IEnumDebugPropertyInfo2 for the locals collection only. private void CreateLocalProperties(out uint elementsReturned, out IEnumDebugPropertyInfo2 enumObject, bool hex) { // bool hex = SquirrelDebuggerEngine.SquirrelDebuggerEnginePackage.HexDisplayMode; List <SquirrelDebugObject> locals = sqframe.Locals; elementsReturned = (uint)locals.Count; DEBUG_PROPERTY_INFO[] propInfo = new DEBUG_PROPERTY_INFO[locals.Count]; for (int i = 0; i < propInfo.Length; i++) { AD7Property property = new AD7Property(locals[i]); propInfo[i] = property.ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD, hex); } enumObject = new AD7PropertyInfoEnum(propInfo); }
/// <summary> /// Construct a DEBUG_PROPERTY_INFO representing this local or parameter. /// </summary> /// <param name="dwFields"></param> /// <returns></returns> internal override DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields) { var info = new DEBUG_PROPERTY_INFO(); if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME)) { /*var sb = new StringBuilder(m_variableInformation.m_name); * info.bstrFullName = sb.ToString(); * info.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)info.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME));*/ } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME)) { info.bstrName = "[" + superClass.GetNameAsync().Await(DalvikProcess.VmTimeout) + "]"; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE)) { /*StringBuilder sb = new StringBuilder(m_variableInformation.m_typeName); * info.bstrType = sb.ToString(); * info.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)info.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE));*/ } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE)) { //info.bstrValue = value.Value.ToString(); //info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB)) { // The sample does not support writing of values displayed in the debugger, so mark them all as read-only. info.dwAttrib = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY | enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB; } // If the debugger has asked for the property, or the property has children (meaning it is a pointer in the sample) // then set the pProperty field so the debugger can call back when the chilren are enumerated. if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP)) { info.pProperty = this; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP; } return(info); }
/// <summary> /// Construct a DEBUG_PROPERTY_INFO representing this local or parameter. /// </summary> /// <param name="dwFields"></param> /// <param name="dwRadix"></param> /// <returns></returns> internal override DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix) { var info = new DEBUG_PROPERTY_INFO(); if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME)) { info.bstrFullName = Name; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME; /*var sb = new StringBuilder(m_variableInformation.m_name); * info.bstrFullName = sb.ToString(); * info.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)info.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME));*/ } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME)) { info.bstrName = Name; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE)) { info.bstrType = Type; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE)) { info.bstrValue = Value; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB)) { // all properties readonly by default. info.dwAttrib = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY; if (HasSideEffects) { info.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_SIDE_EFFECT; } info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB; } return(info); }
/// <summary> /// Construct a DEBUG_PROPERTY_INFO representing this local or parameter. /// </summary> /// <param name="dwFields"></param> /// <param name="dwRadix"></param> /// <returns></returns> internal override DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix) { var info = new DEBUG_PROPERTY_INFO(); if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME)) { /*var sb = new StringBuilder(m_variableInformation.m_name); info.bstrFullName = sb.ToString(); info.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)info.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME));*/ } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME)) { info.bstrName = "Length"; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE)) { /*StringBuilder sb = new StringBuilder(m_variableInformation.m_typeName); info.bstrType = sb.ToString(); info.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)info.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE));*/ } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE)) { info.bstrValue = length.ToString(); info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB)) { // The sample does not support writing of values displayed in the debugger, so mark them all as read-only. info.dwAttrib = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB; } // If the debugger has asked for the property, or the property has children (meaning it is a pointer in the sample) // then set the pProperty field so the debugger can call back when the chilren are enumerated. if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP)) { info.pProperty = this; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP; } return info; }
public void TestGetNextNChildren() { var propertyInfo = new DEBUG_PROPERTY_INFO[1]; int result = _varInfoEnum.Next(1, propertyInfo, out uint numFetched); Assert.That(result, Is.EqualTo(VSConstants.S_OK)); Assert.That(numFetched, Is.EqualTo(1)); propertyInfo = new DEBUG_PROPERTY_INFO[3]; result = _varInfoEnum.Next(3, propertyInfo, out numFetched); Assert.That(result, Is.EqualTo(VSConstants.S_FALSE)); Assert.That(numFetched, Is.EqualTo(2)); Assert.That(propertyInfo[0].bstrName, Is.EqualTo(_children[1].DisplayName)); Assert.That(propertyInfo[1].bstrName, Is.EqualTo(_children[2].DisplayName)); }
// Construct a DEBUG_PROPERTY_INFO representing this local or parameter. public DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields) { DEBUG_PROPERTY_INFO propertyInfo = new DEBUG_PROPERTY_INFO(); if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME) != 0) { propertyInfo.bstrFullName = _objectValue.Name; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0) { propertyInfo.bstrName = _objectValue.Name; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE) != 0) { propertyInfo.bstrType = _objectValue.TypeName; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE) != 0) { propertyInfo.bstrValue = _objectValue.Value; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0) { // The sample does not support writing of values displayed in the debugger, so mark them all as read-only. propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY; if (_objectValue.HasChildren) { propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE; } } // Provide this property pointer as the property info propertyInfo.pProperty = (IDebugProperty2)this; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP; return(propertyInfo); }
/// <summary> /// Construct a DEBUG_PROPERTY_INFO representing this local or parameter. /// </summary> /// <param name="dwFields"></param> /// <param name="dwRadix"></param> /// <returns></returns> internal override DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix) { var info = new DEBUG_PROPERTY_INFO(); if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME)) { info.bstrFullName = "$regs"; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME)) { info.bstrName = "$regs"; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE)) { info.bstrValue = "(local registers)"; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB)) { info.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE; info.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE)) { info.bstrType = "(local registers)"; info.dwFields = enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP)) { info.pProperty = this; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP; } return info; }
private IPropertyInfo[] GetChildren(IDebugProperty2 debugProperty, IExpandablePropertyInfo parent) { var logger = Logger.GetLogger(); logger.Info("EnumChildren"); IEnumDebugPropertyInfo2 debugPropertyEnum; debugProperty.EnumChildren( enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_STANDARD | enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME, 10, dbgGuids.guidFilterLocals, enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ALL, "", Configuration.DefaultTimeoutForVSCalls, out debugPropertyEnum).ThrowOnFailure(); uint count; debugPropertyEnum.GetCount(out count).ThrowOnFailure(); DEBUG_PROPERTY_INFO[] debugPropInfos = new DEBUG_PROPERTY_INFO[ITEMS_TO_FETCH]; uint fetched; logger.Info($"Fetch children"); List <IPropertyInfo> result = new List <IPropertyInfo>(); do { // TODO: Performance bottlneck debugPropertyEnum.Next(ITEMS_TO_FETCH, debugPropInfos, out fetched).ThrowOnFailure(); logger.Info("Received next {0} of children", ITEMS_TO_FETCH); foreach (var p in debugPropInfos.Take((int)fetched)) { // this properties are not evaluated var child = _propertyInfoFactory.Create(p, parent); logger.Info("Returning property: '{0}'", child.Name); result.Add(child); } } while (fetched >= ITEMS_TO_FETCH); logger.Info("All children returned"); return(result.ToArray()); }
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); }
public int GetPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, uint dwTimeout, IDebugReference2[] rgpArgs, uint dwArgCount, DEBUG_PROPERTY_INFO[] pPropertyInfo) { pPropertyInfo[0] = new DEBUG_PROPERTY_INFO(); if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB)) { pPropertyInfo[0].dwAttrib = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_ERROR; pPropertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE)) { pPropertyInfo[0].bstrValue = this._errorText; pPropertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE; } return(VSConstants.S_OK); }
// 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); }
public ulong TebAddress() { IDebugProperty2 debugProperty = this.EvaluateExpression(this.CurrentThread, "@tib"); if (debugProperty != null) { using (new DisposableComReference(debugProperty)) { DEBUG_PROPERTY_INFO[] debugPropertyInfo = new DEBUG_PROPERTY_INFO[1]; if (debugProperty.GetPropertyInfo((uint)enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE, 16, evaluateExpressionTimeout, null, 0, debugPropertyInfo) == S_OK) { IDebugMemoryContext2 memoryContext = null; if (debugProperty.GetMemoryContext(out memoryContext) == S_OK) { string hexString; memoryContext.GetName(out hexString); hexString = hexString.Substring(2); // Strip '0x' for conversion to ulong return ulong.Parse(hexString, NumberStyles.HexNumber); } } } } return 0; }
public void CompletionHandlerIsInvoked() { var propertyInfos = new DEBUG_PROPERTY_INFO[_count]; propertyInfos[0] = new DEBUG_PROPERTY_INFO(); propertyInfos[1] = new DEBUG_PROPERTY_INFO(); _childrenProvider.GetChildrenCountAsync().Returns(_count); _childrenProvider .GetChildrenAsync(0, _count, FillOutProperties(propertyInfos)) .Returns(_count); _getPropertiesOp.BeginExecute(); _completionHandler.Received(1) .OnComplete(VSConstants.S_OK, _count, MatchProperties(propertyInfos)); }
/// <summary> /// Construct a DEBUG_PROPERTY_INFO representing this local or parameter. /// </summary> /// <param name="dwFields"></param> /// <param name="dwRadix"></param> /// <returns></returns> internal override DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix) { var info = new DEBUG_PROPERTY_INFO(); if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME)) { info.bstrFullName = Name; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME; /*var sb = new StringBuilder(m_variableInformation.m_name); info.bstrFullName = sb.ToString(); info.dwFields = (enum_DEBUGPROP_INFO_FLAGS)((uint)info.dwFields | (uint)(DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME));*/ } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME)) { info.bstrName = Name; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE)) { info.bstrType = Type; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE)) { info.bstrValue = Value; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE; } if (dwFields.HasFlag(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB)) { // all properties readonly by default. info.dwAttrib = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY; if (HasSideEffects) info.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_SIDE_EFFECT; info.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB; } return info; }
public AsVariable(IDebugProperty3 debugProperty) { int hr = VSConstants.S_OK; DEBUG_PROPERTY_INFO[] propertyInfo = new DEBUG_PROPERTY_INFO[1]; hr = debugProperty.GetPropertyInfo( enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ALL, 100, //dwRadix 10000, //dwTimeout new IDebugReference2[] { }, 0, propertyInfo); if(hr != VSConstants.S_OK) { throw new Exception("AsVariable : IDebugProperty3.GetPropertyInfo failed"); } debugPropertyInfo_ = propertyInfo[0]; }
// Construct a DEBUG_PROPERTY_INFO representing this local or parameter. public DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields) { DEBUG_PROPERTY_INFO propertyInfo = new DEBUG_PROPERTY_INFO(); if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME) != 0) { propertyInfo.bstrFullName = m_variableInformation.Name; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0) { propertyInfo.bstrName = m_variableInformation.Name; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE) != 0) { propertyInfo.bstrType = m_variableInformation.Type; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE) != 0) { propertyInfo.bstrValue = m_variableInformation.Value; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0) { // Does not support writing of values displayed in the debugger, so mark them all as read-only. propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY; } return propertyInfo; }
// 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); }
internal DEBUG_PROPERTY_INFO GetDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields) { var propertyInfo = new DEBUG_PROPERTY_INFO(); var info = GetMirrorInfo(); if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME) != 0) { propertyInfo.bstrFullName = info != null ? info.Name : variable.Name; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0) { propertyInfo.bstrName = info != null ? info.Name : variable.Name; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE) != 0) { if (info != null) { if (info.PropertyType != null) propertyInfo.bstrType = info.PropertyType.FullName; } else propertyInfo.bstrType = variable.Type.Namespace + "." + variable.Type.Name; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE) != 0 && info == null) { Value value = frame.GetValue(variable); if (value is ObjectMirror) { var obj = ((ObjectMirror)value); MethodMirror toStringMethod = obj.Type.GetMethod("ToString"); value = obj.InvokeMethod(frame.Thread, toStringMethod, Enumerable.Empty<Value>().ToList(), InvokeOptions.DisableBreakpoints); propertyInfo.bstrValue = ((StringMirror)value).Value; } else if (value is PrimitiveValue) { var obj = ((PrimitiveValue)value); if (obj.Value != null) propertyInfo.bstrValue = obj.Value.ToString(); } propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0) { propertyInfo.dwAttrib = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY; if (IsExpandable()) { propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE; } propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB; } if (((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP) != 0) || IsExpandable()) { propertyInfo.pProperty = this; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP; } return propertyInfo; }
// Fills in a DEBUG_PROPERTY_INFO structure that describes a property. public int GetPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, uint dwTimeout, IDebugReference2[] rgpArgs, uint dwArgCount, DEBUG_PROPERTY_INFO[] pPropertyInfo) { pPropertyInfo[0] = ConstructDebugPropertyInfo(dwRadix, dwFields); return VSConstants.S_OK; }
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; }
/// <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; }
// 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; }
// Construct a DEBUG_PROPERTY_INFO representing this local or parameter. public DEBUG_PROPERTY_INFO ConstructDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields) { IVariableInformation variable = _variableInformation; if ((dwFields & (enum_DEBUGPROP_INFO_FLAGS)enum_DEBUGPROP_INFO_FLAGS100.DEBUGPROP100_INFO_NOSIDEEFFECTS) != 0) { if ((variable = DebuggedProcess.g_Process.Natvis.Cache.VisualizeOnRefresh(_variableInformation)) == null) { return AD7ErrorProperty.ConstructErrorPropertyInfo(dwFields, _variableInformation.Name, ResourceStrings.NoSideEffectsVisualizerMessage, this); } } DEBUG_PROPERTY_INFO propertyInfo = new DEBUG_PROPERTY_INFO(); if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME) != 0) { propertyInfo.bstrFullName = variable.FullName(); if (propertyInfo.bstrFullName != null) { propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME; } } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0) { propertyInfo.bstrName = variable.Name; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE) != 0 && !string.IsNullOrEmpty(variable.TypeName)) { propertyInfo.bstrType = variable.TypeName; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE) != 0) { propertyInfo.bstrValue = DebuggedProcess.g_Process.Natvis.FormatDisplayString(variable); propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0) { // don't check readonly attribute, it doubles the eval time for a variable //if (this.m_variableInformation.IsReadOnly()) //{ // propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY; //} if (variable.CountChildren != 0) { propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE; } if (variable.Error) { propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_ERROR; } if (variable.IsStringType) { propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_RAW_STRING; } propertyInfo.dwAttrib |= variable.Access; } // If the debugger has asked for the property, or the property has children (meaning it is a pointer in the sample) // then set the pProperty field so the debugger can call back when the children are enumerated. if (((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP) != 0) || (variable.CountChildren != 0)) { propertyInfo.pProperty = (IDebugProperty2)this; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP; } return propertyInfo; }
public int GetPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, uint dwTimeout, IDebugReference2[] rgpArgs, uint dwArgCount, DEBUG_PROPERTY_INFO[] pPropertyInfo) { pPropertyInfo[0] = ConstructErrorPropertyInfo(dwFields, _name, _message, this); rgpArgs = null; return Constants.S_OK; }
// 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); }
// 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; }
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); }
public int GetPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, uint dwTimeout, IDebugReference2[] rgpArgs, uint dwArgCount, DEBUG_PROPERTY_INFO[] pPropertyInfo) { 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; if (getFullName) { pPropertyInfo[0].bstrFullName = "Static Members"; pPropertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME; } if (getName) { pPropertyInfo[0].bstrName = "Static Members"; pPropertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME; } /* no type */ //if (getType) //{ //} /* no value */ //if (getValue) //{ //} if (getAttributes) { pPropertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE; pPropertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_OVERLOADED_CONTAINER; pPropertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_CLASS; pPropertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PRIVATE; pPropertyInfo[0].dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY; } if (getProperty) { pPropertyInfo[0].pProperty = this; pPropertyInfo[0].dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP; } return VSConstants.S_OK; }