Пример #1
0
        public void CallParameterizedFunction(CorFunction managedFunction, CorType[] argumentTypes, CorValue[] arguments)
        {
            ICorDebugType[] types = null;
            int typesLength = 0;
            ICorDebugValue[] values = null;
            int valuesLength = 0;

            var eval2 = (ICorDebugEval2) m_eval;

            if (argumentTypes != null)
            {
                types = new ICorDebugType[argumentTypes.Length];
                for (int i = 0; i < argumentTypes.Length; i++)
                    types[i] = argumentTypes[i].m_type;
                typesLength = types.Length;
            }
            if (arguments != null)
            {
                values = new ICorDebugValue[arguments.Length];
                for (int i = 0; i < arguments.Length; i++)
                    values[i] = arguments[i].m_val;
                valuesLength = values.Length;
            }
            eval2.CallParameterizedFunction(managedFunction.m_function, (uint) typesLength, types, (uint) valuesLength,
                                            values);
        }
Пример #2
0
        private CorDebug.CorGenericValue GetGenericValue()
        {
            CorGenericValue gv = CorValue.CastToGenericValue();

            if (gv == null)
            {
                throw new MDbgValueWrongTypeException();
            }
            return(gv);
        }
Пример #3
0
 public void CallFunction(CorFunction managedFunction, CorValue[] arguments)
 {
     ICorDebugValue[] values = null;
     if (arguments != null)
     {
         values = new ICorDebugValue[arguments.Length];
         for (int i = 0; i < arguments.Length; i++)
             values[i] = arguments[i].m_val;
     }
     m_eval.CallFunction(managedFunction.m_function,
                         (uint) (arguments == null ? 0 : arguments.Length),
                         values);
 }
Пример #4
0
        private MDbgValue[] InternalGetFields()
        {
            var al = new ArrayList();

            //dereference && (unbox);
            CorDebug.CorValue value = Dereference(CorValue);
            if (value == null)
            {
                throw new MDbgValueException("null value");
            }
            Unbox(ref value);
            CorDebug.CorObjectValue ov = value.CastToObjectValue();

            CorDebug.CorType cType = ov.ExactType;

            CorDebug.CorFrame cFrame = null;
            if (Process.Threads.HaveActive)
            {
                // we need a current frame to display thread local static values
                if (Process.Threads.Active.HaveCurrentFrame)
                {
                    cFrame = Process.Threads.Active.CurrentFrame.CorFrame;
                }
            }


            MDbgModule classModule;

            // initialization
            CorDebug.CorClass corClass = ov.Class;
            classModule = Process.Modules.Lookup(corClass.Module);

            // iteration through class hierarchy
            do
            {
                Type classType;
                //int parentToken;

                classType = classModule.Importer.GetType(corClass.Token);
                //classModule.Importer.GetTypeNameFromDef(classToken,out parentToken);

                foreach (MetadataFieldInfo fi in classType.GetFields())
                {
                    CorValue fieldValue = null;
                    try
                    {
                        if (fi.IsLiteral)
                        {
                            fieldValue = null;
                            // for now we just hide the constant fields.
                            continue;
                        }
                        else if (fi.IsStatic)
                        {
                            fieldValue = cType.GetStaticFieldValue(fi.MetadataToken, cFrame);
                        }
                        else // we are asuming normal field value
                             // GetFieldValueForTYpe Supersedes GetFieldValue
                             // Will replace when all issues are resolved.
                             //fieldValue = ov.GetFieldValueForType(cType, (uint)fi.Token);
                        {
                            fieldValue = ov.GetFieldValue(corClass, fi.MetadataToken);
                        }
                    }
                    catch (COMException)
                    {
                        // we won't report any problems.
                    }
                    al.Add(new MDbgValue(Process, fi.Name, fieldValue));
                }
                cType = cType.Base;
                if (cType == null)
                {
                    break;
                }
                corClass    = cType.Class;
                classModule = Process.Modules.Lookup(corClass.Module);
            } while (true);

            return((MDbgValue[])al.ToArray(typeof(MDbgValue)));
        }