예제 #1
0
 public int GetDataBreakpointInfo160(out string pbstrAddress, out uint pSize, out string pbstrDisplayName, out string pbstrError)
 {
     try
     {
         pbstrAddress     = _variableInformation.Address() + "," + _variableInformation.FullName();
         pSize            = _variableInformation.Size();
         pbstrDisplayName = _variableInformation.FullName();
         pbstrError       = "";
         return(Constants.S_OK);
     }
     catch (Exception e)
     {
         pbstrAddress     = null;
         pSize            = 0;
         pbstrDisplayName = null;
         pbstrError       = e.Message;
     }
     return(Constants.E_FAIL);
 }
예제 #2
0
        // 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 = _engine.DebuggedProcess.Natvis.Cache.VisualizeOnRefresh(_variableInformation)) == null)
                {
                    return(AD7ErrorProperty.ConstructErrorPropertyInfo(dwFields, _variableInformation.Name, ResourceStrings.NoSideEffectsVisualizerMessage, this, _variableInformation.FullName()));
                }
            }

            DEBUG_PROPERTY_INFO propertyInfo = new DEBUG_PROPERTY_INFO();
            string fullName = variable.FullName();

            if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME) != 0)
            {
                propertyInfo.bstrFullName = 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 = _engine.DebuggedProcess.Natvis.FormatDisplayString(variable);
                propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE;
            }

            if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0)
            {
                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;
                }
                else
                {
                    propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_DATA;
                    if (!string.IsNullOrEmpty(fullName))
                    {
                        lock (_engine.DebuggedProcess.DataBreakpointVariables)
                        {
                            if (_engine.DebuggedProcess.DataBreakpointVariables.Any(candidate =>
                                                                                    candidate.Length > fullName.Length &&
                                                                                    candidate.EndsWith(fullName, StringComparison.Ordinal) &&
                                                                                    candidate[candidate.Length - fullName.Length - 1] == ','))
                            {
                                try
                                {
                                    if (_engine.DebuggedProcess.DataBreakpointVariables.Contains(variable.Address() + "," + fullName))
                                    {
                                        propertyInfo.dwAttrib |= (enum_DBG_ATTRIB_FLAGS)DBG_ATTRIB_HAS_DATA_BREAKPOINT;
                                    }
                                }
                                catch (Exception) { }
                            }
                        }
                    }
                }

                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);
        }
예제 #3
0
 public string Address()
 {
     return(Parent.Address());
 }