/// <summary> /// Sets the value of a property from a given string. (http://msdn.microsoft.com/en-ca/library/bb160956.aspx) /// The debugger will call this when the user tries to edit the property's values in one of the debugger windows. /// </summary> /// <param name="pszValue"> A string containing the value to be set. </param> /// <param name="dwRadix"> A radix to be used in interpreting any numerical information. This can be 0 to attempt to determine /// the radix automatically. </param> /// <param name="dwTimeout"> Specifies the maximum time, in milliseconds, to wait before returning from this method. Use /// INFINITE to wait indefinitely. </param> /// <returns> VSConstants.S_OK. </returns> public int SetValueAsString(string pszValue, uint dwRadix, uint dwTimeout) { string result = ""; VariableInfo.evaluateExpression(this._variableInfo._name + "=" + pszValue, ref result, null); 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); }