Esempio n. 1
0
 internal DkmClrType(DkmClrModuleInstance module, DkmClrAppDomain appDomain, Type lmrType)
 {
     _module         = module;
     _appDomain      = appDomain;
     _lmrType        = lmrType;
     _evalAttributes = GetEvalAttributes(lmrType);
 }
Esempio n. 2
0
 internal DkmClrType(DkmClrModuleInstance module, DkmClrAppDomain appDomain, Type lmrType)
 {
     _module = module;
     _appDomain = appDomain;
     _lmrType = lmrType;
     _evalAttributes = GetEvalAttributes(lmrType);
 }
Esempio n. 3
0
 internal DkmClrRuntimeInstance(
     Assembly[] assemblies,
     GetModuleDelegate getModule           = null,
     GetMemberValueDelegate getMemberValue = null,
     bool enableNativeDebugging            = false
     ) : base(enableNativeDebugging)
 {
     if (getModule == null)
     {
         getModule = (r, a) =>
                     new DkmClrModuleInstance(
             r,
             a,
             (a != null) ? new DkmModule(a.GetName().Name + ".dll") : null
             );
     }
     this.Assemblies = assemblies;
     this.Modules    = assemblies
                       .Select(a => getModule(this, a))
                       .Where(m => m != null)
                       .ToArray();
     _defaultModule      = getModule(this, null);
     _appDomain          = new DkmClrAppDomain(this);
     this.GetMemberValue = getMemberValue;
 }
Esempio n. 4
0
 internal DkmClrType(DkmClrModuleInstance module, DkmClrAppDomain appDomain, Type lmrType, DkmClrObjectFavoritesInfo favorites = null)
 {
     _module         = module;
     _appDomain      = appDomain;
     _lmrType        = lmrType;
     _evalAttributes = GetEvalAttributes(lmrType);
     _favorites      = favorites;
 }
Esempio n. 5
0
 internal DkmClrRuntimeInstance(
     Assembly[] assemblies,
     GetModuleDelegate getModule = null,
     GetMemberValueDelegate getMemberValue = null)
 {
     if (getModule == null)
     {
         getModule = (r, a) => new DkmClrModuleInstance(r, a, (a != null) ? new DkmModule(a.GetName().Name + ".dll") : null);
     }
     this.Assemblies = assemblies;
     this.Modules = assemblies.Select(a => getModule(this, a)).Where(m => m != null).ToArray();
     _defaultModule = getModule(this, null);
     _appDomain = new DkmClrAppDomain(this);
     _getMemberValue = getMemberValue;
 }
Esempio n. 6
0
        private static IEnumerable <DkmClrModuleInstance> WithMscorlibLast(DkmClrModuleInstance[] list)
        {
            DkmClrModuleInstance mscorlib = null;

            foreach (var module in list)
            {
                if (IsMscorlib(module.Assembly))
                {
                    Debug.Assert(mscorlib == null);
                    mscorlib = module;
                }
                else
                {
                    yield return(module);
                }
            }
            if (mscorlib != null)
            {
                yield return(mscorlib);
            }
        }
Esempio n. 7
0
        public DkmClrValue InstantiateDynamicViewProxy(DkmInspectionContext inspectionContext)
        {
            if (inspectionContext == null)
            {
                throw new ArgumentNullException(nameof(inspectionContext));
            }

            var module = new DkmClrModuleInstance(
                this.Type.AppDomain.RuntimeInstance,
                typeof(Microsoft.CSharp.RuntimeBinder.RuntimeBinderException).Assembly,
                new DkmModule("Microsoft.CSharp.dll"));
            var proxyType = module.ResolveTypeName(
                "Microsoft.CSharp.RuntimeBinder.DynamicMetaObjectProviderDebugView",
                s_noArguments);
            return this.InstantiateProxyType(inspectionContext, proxyType);
        }
 private ImportedModule ImportModule(DkmClrModuleInstance debuggerModule)
 {
     IntPtr metadataBlock;
     uint blockSize;
     try
     {
         metadataBlock = debuggerModule.GetMetaDataBytesPtr(out blockSize);
         return Session.Importer.ImportModule(metadataBlock, blockSize);
     }
     catch (DkmException)
     {
         // This can fail when dump debugging if the full heap is not available
         return null;
     }
 }
Esempio n. 9
0
 private EvaluationContextBase CreateTypeContext(DkmClrModuleInstance moduleInstance, ImmutableArray<MetadataBlock> references, int typeToken)
 {
     return this.CreateTypeContext(
         moduleInstance.AppDomain,
         references,
         moduleInstance.Mvid,
         typeToken);
 }
Esempio n. 10
0
        void IDkmClrExpressionCompilerCallback.CompileDisplayAttribute(
            DkmLanguageExpression expression,
            DkmClrModuleInstance moduleInstance,
            int token,
            out string error,
            out DkmCompiledClrInspectionQuery result)
        {
            try
            {
                var appDomain = moduleInstance.AppDomain;
                var references = moduleInstance.Process.GetMetadataBlocks(appDomain);

                ResultProperties unusedResultProperties;
                ImmutableArray<AssemblyIdentity> missingAssemblyIdentities;
                CompileResult compileResult;
                do
                {
                    var context = this.CreateTypeContext(moduleInstance, references, token);
                    compileResult = context.CompileExpression(
                        RuntimeInspectionContext.Empty,
                        expression.Text,
                        DkmEvaluationFlags.TreatAsExpression,
                        this.DiagnosticFormatter,
                        out unusedResultProperties,
                        out error,
                        out missingAssemblyIdentities,
                        preferredUICulture: null,
                        testData: null);
                } while (ShouldTryAgainWithMoreMetadataBlocks(appDomain, missingAssemblyIdentities, ref references));

                result = compileResult.ToQueryResult(this.CompilerId, default(ResultProperties), moduleInstance.RuntimeInstance);
            }
            catch (Exception e) when (ExpressionEvaluatorFatalError.CrashIfFailFastEnabled(e))
            {
                throw ExceptionUtilities.Unreachable;
            }
        }