示例#1
0
        public static CorDebugClass ClassFromRuntimeValue(RuntimeValue rtv, CorDebugAppDomain appDomain)
        {
            RuntimeValue_Reflection rtvf = rtv as RuntimeValue_Reflection;
            CorDebugClass           cls  = null;
            object objBuiltInKey         = null;

            Debug.Assert(!rtv.IsNull);

            if (rtvf != null)
            {
                objBuiltInKey = rtvf.ReflectionType;
            }
            else if (rtv.DataType == RuntimeDataType.DATATYPE_TRANSPARENT_PROXY)
            {
                objBuiltInKey = RuntimeDataType.DATATYPE_TRANSPARENT_PROXY;
            }
            else
            {
                cls = nanoCLR_TypeSystem.CorDebugClassFromTypeIndex(rtv.Type, appDomain);;
            }

            if (objBuiltInKey != null)
            {
                CorDebugProcess.BuiltinType builtInType = appDomain.Process.ResolveBuiltInType(objBuiltInKey);

                cls = builtInType.GetClass(appDomain);

                if (cls == null)
                {
                    cls = new CorDebugClass(builtInType.GetAssembly(appDomain), builtInType.TokenCLR);
                }
            }

            return(cls);
        }
示例#2
0
 //Object or CLASS, or VALUETYPE
 public CorDebugValueObject(RuntimeValue rtv, CorDebugAppDomain appDomain) : base(rtv, appDomain)
 {
     if (!rtv.IsNull)
     {
         m_class    = CorDebugValue.ClassFromRuntimeValue(rtv, appDomain);
         m_fIsEnum  = m_class.IsEnum;
         m_fIsBoxed = rtv.IsBoxed;
     }
 }
示例#3
0
        private CorDebugClass GetClassFromToken(uint tk, Hashtable ht)
        {
            CorDebugClass cls = null;

            Pdbx.Class c = ht[tk] as Pdbx.Class;
            if (c != null)
            {
                cls = new CorDebugClass(this, c);
            }

            return(cls);
        }
示例#4
0
        public static CorDebugValue CreateValue(RuntimeValue rtv, CorDebugAppDomain appDomain)
        {
            CorDebugValue val = null;
            bool          fIsReference;

            if (rtv.IsBoxed)
            {
                val          = new CorDebugValueBoxedObject(rtv, appDomain);
                fIsReference = true;
            }
            else if (rtv.IsPrimitive)
            {
                CorDebugClass c = ClassFromRuntimeValue(rtv, appDomain);

                if (c.IsEnum)
                {
                    val          = new CorDebugValueObject(rtv, appDomain);
                    fIsReference = false;
                }
                else
                {
                    val          = new CorDebugValuePrimitive(rtv, appDomain);
                    fIsReference = false;
                }
            }
            else if (rtv.IsArray)
            {
                val          = new CorDebugValueArray(rtv, appDomain);
                fIsReference = true;
            }
            else if (rtv.CorElementType == CorElementType.ELEMENT_TYPE_STRING)
            {
                val          = new CorDebugValueString(rtv, appDomain);
                fIsReference = true;
            }
            else
            {
                val          = new CorDebugValueObject(rtv, appDomain);
                fIsReference = !rtv.IsValueType;
            }

            if (fIsReference)
            {
                val = new CorDebugValueReference(val, val.m_rtv, val.m_appDomain);
            }

            if (rtv.IsReference)    //CorElementType.ELEMENT_TYPE_BYREF
            {
                val = new CorDebugValueReferenceByRef(val, val.m_rtv, val.m_appDomain);
            }

            return(val);
        }
示例#5
0
        private CorDebugFunction GetFunctionFromToken(uint tk, Hashtable ht)
        {
            CorDebugFunction function = null;

            Pdbx.Method method = ht[tk] as Pdbx.Method;
            if (method != null)
            {
                CorDebugClass c = new CorDebugClass(this, method.Class);
                function = new CorDebugFunction(c, method);
            }

            Debug.Assert(function != null);
            return(function);
        }
        public static CorDebugClass CorDebugClassFromTypeIndex(uint typeIndex, CorDebugAppDomain appDomain)
        {
            CorDebugClass cls = null;

            CorDebugAssembly assembly = appDomain.AssemblyFromIdx(nanoCLR_TypeSystem.IdxAssemblyFromIndex(typeIndex));

            if (assembly != null)
            {
                uint typedef = nanoCLR_TypeSystem.CLR_TkFromType(nanoCLR_TypeSystem.CLR_TABLESENUM.TBL_TypeDef, nanoCLR_TypeSystem.IdxFromIndex(typeIndex));
                cls = assembly.GetClassFromTokennanoCLR(typedef);
            }

            return(cls);
        }
示例#7
0
        int ICorDebugEval.NewObject(ICorDebugFunction pConstructor, uint nArgs, ICorDebugValue[] ppArgs)
        {
            Debug.Assert(nArgs == ppArgs.Length);

            CorDebugFunction f = (CorDebugFunction)pConstructor;
            CorDebugClass    c = f.Class;

            this.Process.SetCurrentAppDomain(this.AppDomain);
            Engine.AllocateObjectAsync(GetScratchPadLocation(), c.TypeDef_Index).Wait();

            ICorDebugValue[] args = new ICorDebugValue[nArgs + 1];

            args[0] = GetResultValue();
            ppArgs.CopyTo(args, 1);
            ((ICorDebugEval)this).CallFunction(pConstructor, (uint)args.Length, args);

            return(COM_HResults.S_OK);
        }
示例#8
0
        public CorDebugFunction GetFunctionFromTokennanoCLR(uint tk)
        {
            if (HasSymbols)
            {
                return(GetFunctionFromToken(tk, m_htTokennanoCLRToPdbx));
            }
            else
            {
                uint index = nanoCLR_TypeSystem.ClassMemberIndexFromnanoCLRToken(tk, this);

                var resolveMethod = this.Process.Engine.ResolveMethodAsync(index);
                resolveMethod.Wait();

                Debugger.WireProtocol.Commands.Debugging_Resolve_Method.Result resolvedMethod = resolveMethod.Result;
                Debug.Assert(nanoCLR_TypeSystem.IdxAssemblyFromIndex(resolvedMethod.m_td) == this.Idx);

                uint tkMethod = nanoCLR_TypeSystem.SymbollessSupport.MethodDefTokenFromnanoCLRToken(tk);
                uint tkClass  = nanoCLR_TypeSystem.nanoCLRTokenFromTypeIndex(resolvedMethod.m_td);

                CorDebugClass c = GetClassFromTokennanoCLR(tkClass);

                return(new CorDebugFunction(c, tkMethod));
            }
        }
示例#9
0
 public CorDebugFunction(CorDebugClass cls, uint tkSymbolless) : this(cls, null)
 {
     m_tkSymbolless = tkSymbolless;
 }
示例#10
0
 public CorDebugFunction(CorDebugClass cls, Pdbx.Method method)
 {
     m_class      = cls;
     m_pdbxMethod = method;
 }
示例#11
0
 public ManagedCallbackClass(CorDebugClass c, EventType eventType)
 {
     m_class     = c;
     m_eventType = eventType;
 }