Beispiel #1
0
        public int GetMethodProperty(IDebugSymbolProvider pSymbolProvider, IDebugAddress pAddress, IDebugBinder pBinder, int fIncludeHiddenLocals, out IDebugProperty2 ppProperty)
        {
            AD7Property method = new AD7Property(m_var);
            ppProperty = method;

            return VSConstants.S_OK;
        }
Beispiel #2
0
    public  HRESULT GetMethodProperty( 
      IDebugSymbolProvider    pSymbolProvider,
      IDebugAddress           pAddress,
      IDebugBinder			      pBinder,
      bool	                  includeHiddenLocals,
      out IDebugProperty2     ppproperty
      ) 
    {

      HRESULT hr = (int)HResult.S_OK;
      ppproperty = null;
      IDebugContext context = new CDebugContext(pSymbolProvider, pAddress, pBinder);
      if (context != null)
      {
        IDebugProperty prop = null;
        prop = this.cciEvaluator.GetCurrentMethodProperty((IDebugMethodSymbol)context.GetContainer());

        if (null != prop)
        {
          CDebugProperty debugProp = new CDebugProperty(prop);
          if (null != debugProp)
          {
            ppproperty = debugProp as IDebugProperty2;
          }
          else
            hr = (HRESULT)HResult.E_OUTOFMEMORY;
        }
      } 
      else
        hr = (HRESULT)HResult.E_OUTOFMEMORY;

      return hr;
    }
Beispiel #3
0
    public  CDebugContext(IDebugSymbolProvider symbolProvider, IDebugAddress address, IDebugBinder binder, uint evalFlags, uint timeout) : this(symbolProvider, address, binder) {

      this.m_EvalFlags = evalFlags;
      this.m_Timeout = timeout;
      //this.radix = radix;
    }
Beispiel #4
0
    private long m_Radix; // TODO : figure out how to get this in all cases

    public  CDebugContext(IDebugSymbolProvider symbolProvider, IDebugAddress address, IDebugBinder binder) {
      
      this.m_SymbolProvider = symbolProvider;
      this.m_Address = address;
      this.m_Binder = binder;
      this.m_Radix = 0;
    }
Beispiel #5
0
    // IDebugParsedExpression
    public void EvaluateSync(uint dwEvalFlags, uint dwTimeout, IDebugSymbolProvider pSymbolProvider,
      IDebugAddress pAddress, IDebugBinder pBinder, String bstrResultType, out IDebugProperty2 ppResult) {

      ppResult = null;
      IDebugContext context = new CDebugContext(pSymbolProvider, pAddress, pBinder);
      if (context != null){
        IDebugProperty prop = null;
        prop = this.EvaluateExpression(dwEvalFlags, dwTimeout, context, bstrResultType);

        if (prop != null){
          CDebugProperty debugProp = new CDebugProperty(prop);
          if (null != debugProp)
            ppResult = debugProp as IDebugProperty2;
        }
      }
    }
Beispiel #6
0
 public  HRESULT GetMethodLocationProperty( 
   string                  pszFullyQualifiedMethodPlusOffset,
   IDebugSymbolProvider	pprovider,
   IDebugAddress			paddress,
   IDebugBinder			pbinder,
   out IDebugProperty2 	ppproperty
   ) 
 {
   ppproperty = null;
   return (HRESULT)HResult.E_NOTIMPL;
 }
 public int EvaluateSync(uint dwEvalFlags, uint dwTimeout, IDebugSymbolProvider pSymbolProvider, IDebugAddress pAddress, IDebugBinder pBinder, string bstrResultType, out IDebugProperty2 ppResult)
 {
   ppResult = (IDebugProperty2)null;
   return VSConstants.E_NOTIMPL;
 }
 public int GetMethodProperty(IDebugSymbolProvider pSymbolProvider, IDebugAddress pAddress, IDebugBinder pBinder, int fIncludeHiddenLocals, out IDebugProperty2 ppProperty)
 {
     ppProperty = null;
     return VSConstants.E_NOTIMPL;
 }
Beispiel #9
0
        private long m_Radix; // TODO : figure out how to get this in all cases

        public CDebugContext(IDebugSymbolProvider symbolProvider, IDebugAddress address, IDebugBinder binder)
        {
            this.m_SymbolProvider = symbolProvider;
            this.m_Address        = address;
            this.m_Binder         = binder;
            this.m_Radix          = 0;
        }
Beispiel #10
0
        public void SetValue(object val)
        {
            byte[]       valueBytes = null;
            IDebugBinder binder     = this.m_Context.Binder;

            if (null == this.m_RuntimeType)
            {
                binder.ResolveRuntimeType(this.m_Object, out this.m_RuntimeType);
            }
            if (null != this.m_RuntimeType)
            {
                IDebugObject pObject = this.m_Object;
                IDebugField  type    = this.m_RuntimeType;
                if (null != pObject)
                {
                    uint size = 0;
                    pObject.GetSize(out size);
                    if (0 < size)
                    {
                        valueBytes = new byte[size];
                        if (null != valueBytes)
                        {
                            FIELD_KIND fieldKind = 0;
                            type.GetKind(out fieldKind);
                            if (0 != fieldKind)
                            {
                                if (0 != (fieldKind & FIELD_KIND.FIELD_TYPE_PRIMITIVE))
                                {
                                    FIELD_INFO fieldInfo;
                                    type.GetInfo(FIELD_INFO_FIELDS.FIF_NAME, out fieldInfo);
                                    if (null != fieldInfo.bstrName)
                                    {
                                        switch (size)
                                        {
                                        case 1:
                                            if (0 == String.Compare("whole", fieldInfo.bstrName, true))
                                            {
                                                valueBytes[0] = (byte )val;
                                            }
                                            else if (0 == String.Compare("uwhole", fieldInfo.bstrName, true))
                                            {
                                                valueBytes[0] = (byte )val;
                                            }
                                            break;

                                        case 2:
                                            if (0 == String.Compare("whole", fieldInfo.bstrName, true))
                                            {
                                                Int16 temp = (Int16)val;
                                                valueBytes[0] = System.Convert.ToByte(temp & 0x00FF);
                                                valueBytes[1] = System.Convert.ToByte(temp >> 8);
                                            }
                                            else if (0 == String.Compare("char", fieldInfo.bstrName, true))
                                            {
                                                UInt16 temp = (UInt16)val;
                                                valueBytes[0] = System.Convert.ToByte(temp & 0x00FF);
                                                valueBytes[1] = System.Convert.ToByte(temp >> 8);
                                            }
                                            else if (0 == String.Compare("uwhole", fieldInfo.bstrName, true))
                                            {
                                                UInt16 temp = (UInt16)val;
                                                valueBytes[0] = System.Convert.ToByte(temp & 0x00FF);
                                                valueBytes[1] = System.Convert.ToByte(temp >> 8);
                                            }
                                            break;

                                        case 4:
                                            if (0 == String.Compare("whole", fieldInfo.bstrName, true))
                                            {
                                                Int32 temp = (Int32)val;
                                                valueBytes[0] = System.Convert.ToByte(temp & 0xFF);
                                                valueBytes[1] = System.Convert.ToByte((temp >> 8) & 0xFF);
                                                valueBytes[2] = System.Convert.ToByte((temp >> 8) & 0xFF);
                                                valueBytes[3] = System.Convert.ToByte(temp >> 8);
                                            }
                                            else if (0 == String.Compare("uwhole", fieldInfo.bstrName, true))
                                            {
                                                UInt32 temp = (UInt32)val;
                                                valueBytes[0] = System.Convert.ToByte(temp & 0xFF);
                                                valueBytes[1] = System.Convert.ToByte((temp >> 8) & 0xFF);
                                                valueBytes[2] = System.Convert.ToByte((temp >> 8) & 0xFF);
                                                valueBytes[3] = System.Convert.ToByte(temp >> 8);
                                            }
                                            else if (0 == String.Compare("real", fieldInfo.bstrName, true))
                                            {
                                                UInt32 temp = (UInt32)val;
                                                valueBytes[0] = System.Convert.ToByte(temp & 0xFF);
                                                valueBytes[1] = System.Convert.ToByte((temp >> 8) & 0xFF);
                                                valueBytes[2] = System.Convert.ToByte((temp >> 8) & 0xFF);
                                                valueBytes[3] = System.Convert.ToByte(temp >> 8);
                                            }
                                            break;

                                        case 8:
                                            if (0 == String.Compare("whole", fieldInfo.bstrName, true))
                                            {
                                                //pRetVal->vt = VT_I8;
                                                //pRetVal->llVal = *reinterpret_cast<LONGLONG*>(valueBytes);
                                            }
                                            else if (0 == String.Compare("uwhole", fieldInfo.bstrName, true))
                                            {
                                                //pRetVal->vt = VT_UI8;
                                                //pRetVal->ullVal = *reinterpret_cast<ULONGLONG*>(valueBytes);
                                            }
                                            else if (0 == String.Compare("real", fieldInfo.bstrName, true))
                                            {
                                                //pRetVal->vt = VT_R8;
                                                //pRetVal->dblVal = *reinterpret_cast<DOUBLE*>(valueBytes);
                                            }
                                            break;
                                        }

                                        if (0 == String.Compare("bool", fieldInfo.bstrName, true))
                                        {
                                            //pRetVal->vt = VT_BOOL;
                                            bool temp = (bool)val;
                                            for (uint i = 0; i < size; i++)
                                            {
                                                if (temp)
                                                {
                                                    valueBytes[i] = 1;
                                                }
                                                else
                                                {
                                                    valueBytes[i] = 0;
                                                }
                                            }
                                        }
                                        else if (0 == String.Compare("string", fieldInfo.bstrName, true))
                                        {
                                            //VSASSERT(size >= 2, "String length is too short");
                                            //VSASSERT(size % 2 == 0, "String of odd byte length");
                                            //UINT chars = (size-2)/2; // Debug engine adds 2 for terminating L'\0'
                                            //pRetVal->vt = VT_BSTR;
                                            //pRetVal->bstrVal = SysAllocStringLen(NULL, chars);
                                            //wcsncpy(pRetVal->bstrVal, reinterpret_cast<WCHAR*>(valueBytes), chars);
                                            //pRetVal->bstrVal[chars] = L'\0';
                                            String temp      = val as String;
                                            char[] charArray = temp.ToCharArray();
                                            valueBytes = new byte[2 * charArray.Length + 2];
                                            int i = 0;
                                            for ( ; i < charArray.Length; i++)
                                            {
                                                UInt16 temp1 = (UInt16)charArray[i];
                                                valueBytes[2 * i]     = System.Convert.ToByte(temp1 & 0x00FF);
                                                valueBytes[2 * i + 1] = System.Convert.ToByte(temp1 >> 8);
                                            }
                                            valueBytes[2 * i] = valueBytes[2 * i + 1] = 0;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            this.m_Object.SetValue(valueBytes, (uint)valueBytes.Length);
        }
Beispiel #11
0
        public Object GetValue()
        {
            Object       pRetVal = null;
            IDebugBinder binder  = this.m_Context.Binder;

            if (null == this.m_RuntimeType)
            {
                binder.ResolveRuntimeType(this.m_Object, out this.m_RuntimeType);
            }
            if (null != this.m_RuntimeType)
            {
                IDebugObject    pObject   = this.m_Object;
                IDebugField     type      = this.m_RuntimeType;
                IDebugEnumField enumField = null;

                enumField = this.m_RuntimeType as IDebugEnumField;
                if (null != enumField)
                {
                    IDebugField underlyingField = null;
                    enumField.GetUnderlyingSymbol(out underlyingField);
                    if (null != underlyingField)
                    {
                        IDebugObject underlyingObject = null;
                        binder.Bind(this.m_Object, underlyingField, out underlyingObject);
                        if (null != underlyingObject)
                        {
                            pObject = underlyingObject;
                        }

                        IDebugField underlyingType = null;
                        underlyingField.GetType(out underlyingType);
                        if (null != underlyingType)
                        {
                            type = underlyingType;
                        }
                    }
                }

                if (null != pObject)
                {
                    uint size = 0;
                    pObject.GetSize(out size);
                    if (0 < size)
                    {
                        byte[] valueBytes = new byte[size];
                        if (null != valueBytes)
                        {
                            pObject.GetValue(valueBytes, size);
                            if (null != valueBytes)
                            {
                                FIELD_KIND fieldKind = 0;
                                type.GetKind(out fieldKind);
                                if (0 != fieldKind)
                                {
                                    if (0 != (fieldKind & FIELD_KIND.FIELD_TYPE_PRIMITIVE))
                                    {
                                        FIELD_INFO fieldInfo;
                                        type.GetInfo(FIELD_INFO_FIELDS.FIF_NAME, out fieldInfo);
                                        if (null != fieldInfo.bstrName)
                                        {
                                            switch (size)
                                            {
                                            case 1:
                                                if (0 == String.Compare("whole", fieldInfo.bstrName, true))
                                                {
                                                    pRetVal = valueBytes[0];
                                                }
                                                else if (0 == String.Compare("uwhole", fieldInfo.bstrName, true))
                                                {
                                                    pRetVal = valueBytes[0];
                                                }
                                                break;

                                            case 2:
                                                if (0 == String.Compare("whole", fieldInfo.bstrName, true))
                                                {
                                                    UInt16 temp = 0;
                                                    for (int i = 0; i < 2; i++)
                                                    {
                                                        temp <<= 8;
                                                        temp  |= valueBytes[1 - i];
                                                    }
                                                    pRetVal = (Int16 )temp;

                                                    //pRetVal->vt = VT_I2;
                                                    //pRetVal->iVal = *reinterpret_cast<SHORT*>(valueBytes);
                                                }
                                                else if (0 == String.Compare("char", fieldInfo.bstrName, true))
                                                {
                                                    UInt16 temp = 0;
                                                    for (int i = 0; i < 2; i++)
                                                    {
                                                        temp <<= 8;
                                                        temp  |= valueBytes[1 - i];
                                                    }
                                                    pRetVal = temp;
                                                    //pRetVal->vt = VT_UI2;
                                                    //pRetVal->uiVal = *reinterpret_cast<USHORT*>(valueBytes);
                                                }
                                                else if (0 == String.Compare("uwhole", fieldInfo.bstrName, true))
                                                {
                                                    UInt16 temp = 0;
                                                    for (int i = 0; i < 2; i++)
                                                    {
                                                        temp <<= 8;
                                                        temp  |= valueBytes[1 - i];
                                                    }
                                                    pRetVal = temp;
                                                    //pRetVal->vt = VT_UI2;
                                                    //pRetVal->uiVal = *reinterpret_cast<USHORT*>(valueBytes);
                                                }
                                                break;

                                            case 4:
                                                if (0 == String.Compare("whole", fieldInfo.bstrName, true))
                                                {
                                                    Int32 temp = 0;
                                                    for (int i = 0; i < 4; i++)
                                                    {
                                                        temp <<= 8;
                                                        temp  |= valueBytes[3 - i];
                                                    }
                                                    pRetVal = temp;
                                                    //pRetVal->vt = VT_I4;
                                                    //pRetVal->lVal = *reinterpret_cast<LONG*>(valueBytes);
                                                }
                                                else if (0 == String.Compare("uwhole", fieldInfo.bstrName, true))
                                                {
                                                    UInt32 temp = 0;
                                                    for (int i = 0; i < 4; i++)
                                                    {
                                                        temp <<= 8;
                                                        temp  |= valueBytes[3 - i];
                                                    }
                                                    pRetVal = temp;
                                                    //pRetVal->vt = VT_UI4;
                                                    //pRetVal->ulVal = *reinterpret_cast<ULONG*>(valueBytes);
                                                }
                                                else if (0 == String.Compare("real", fieldInfo.bstrName, true))
                                                {
                                                    Int32 temp = 0;
                                                    for (int i = 0; i < 4; i++)
                                                    {
                                                        temp <<= 8;
                                                        temp  |= valueBytes[3 - i];
                                                    }
                                                    pRetVal = temp;
                                                    //pRetVal->vt = VT_R4;
                                                    //pRetVal->fltVal = *reinterpret_cast<FLOAT*>(valueBytes);
                                                }
                                                break;

                                            case 8:
                                                if (0 == String.Compare("whole", fieldInfo.bstrName, true))
                                                {
                                                    //pRetVal->vt = VT_I8;
                                                    //pRetVal->llVal = *reinterpret_cast<LONGLONG*>(valueBytes);
                                                }
                                                else if (0 == String.Compare("uwhole", fieldInfo.bstrName, true))
                                                {
                                                    //pRetVal->vt = VT_UI8;
                                                    //pRetVal->ullVal = *reinterpret_cast<ULONGLONG*>(valueBytes);
                                                }
                                                else if (0 == String.Compare("real", fieldInfo.bstrName, true))
                                                {
                                                    //pRetVal->vt = VT_R8;
                                                    //pRetVal->dblVal = *reinterpret_cast<DOUBLE*>(valueBytes);
                                                }
                                                break;
                                            }

                                            if (0 == String.Compare("bool", fieldInfo.bstrName, true))
                                            {
                                                //pRetVal->vt = VT_BOOL;
                                                pRetVal = false;
                                                for (uint i = 0; i < size; i++)
                                                {
                                                    if (valueBytes[i] != 0)
                                                    {
                                                        pRetVal = true;
                                                    }
                                                }
                                            }
                                            else if (0 == String.Compare("string", fieldInfo.bstrName, true))
                                            {
                                                //VSASSERT(size >= 2, "String length is too short");
                                                //VSASSERT(size % 2 == 0, "String of odd byte length");
                                                //UINT chars = (size-2)/2; // Debug engine adds 2 for terminating L'\0'
                                                //pRetVal->vt = VT_BSTR;
                                                //pRetVal->bstrVal = SysAllocStringLen(NULL, chars);
                                                //wcsncpy(pRetVal->bstrVal, reinterpret_cast<WCHAR*>(valueBytes), chars);
                                                //pRetVal->bstrVal[chars] = L'\0';
                                                pRetVal = (new System.Text.UnicodeEncoding()).GetString(valueBytes);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(pRetVal);
        }
 public int EvaluateSync(uint dwEvalFlags, uint dwTimeout, IDebugSymbolProvider pSymbolProvider, IDebugAddress pAddress, IDebugBinder pBinder, string bstrResultType, out IDebugProperty2 ppResult)
 {
     ppResult = new AsmDebugProperty(vs, _name);
     return VSConstants.S_OK;
 }
Beispiel #13
0
        public int GetMethodProperty(IDebugSymbolProvider pSymbolProvider, IDebugAddress pAddress, IDebugBinder pBinder, int fIncludeHiddenLocals, out IDebugProperty2 ppProperty)
        {
            AD7Property method = new AD7Property(m_var);

            ppProperty = method;

            return(VSConstants.S_OK);
        }
Beispiel #14
0
 public int GetMethodProperty(IDebugSymbolProvider pSymbolProvider, IDebugAddress pAddress, IDebugBinder pBinder, int fIncludeHiddenLocals, out IDebugProperty2 ppProperty)
 {
     ppProperty = null;
     return(VSConstants.E_NOTIMPL);
 }
Beispiel #15
0
 public CDebugContext(IDebugSymbolProvider symbolProvider, IDebugAddress address, IDebugBinder binder, uint evalFlags, uint timeout) : this(symbolProvider, address, binder)
 {
     this.m_EvalFlags = evalFlags;
     this.m_Timeout   = timeout;
     //this.radix = radix;
 }
 public int GetMethodLocationProperty(string upstrFullyQualifiedMethodPlusOffset, IDebugSymbolProvider pSymbolProvider, IDebugAddress pAddress, IDebugBinder pBinder, out IDebugProperty2 ppProperty)
 {
     ppProperty = null;
     return VSConstants.E_NOTIMPL;
 }
Beispiel #17
0
 public int EvaluateSync(uint dwEvalFlags, uint dwTimeout, IDebugSymbolProvider pSymbolProvider, IDebugAddress pAddress, IDebugBinder pBinder, string bstrResultType, out IDebugProperty2 ppResult)
 {
     ppResult = new AsmDebugProperty(vs, _name);
     return(VSConstants.S_OK);
 }
Beispiel #18
0
 public int GetMethodLocationProperty(string upstrFullyQualifiedMethodPlusOffset, IDebugSymbolProvider pSymbolProvider, IDebugAddress pAddress, IDebugBinder pBinder, out IDebugProperty2 ppProperty)
 {
     ppProperty = null;
     return(VSConstants.E_NOTIMPL);
 }
Beispiel #19
0
 public int EvaluateSync(uint dwEvalFlags, uint dwTimeout, IDebugSymbolProvider pSymbolProvider, IDebugAddress pAddress, IDebugBinder pBinder, string bstrResultType, out IDebugProperty2 ppResult)
 {
     ppResult = (IDebugProperty2)null;
     return(VSConstants.E_NOTIMPL);
 }