예제 #1
0
        public DebuggerRuntimeImpl(DbgObjectIdService dbgObjectIdService, IDbgDotNetRuntime runtime, int pointerSize, DotNetClassHookFactory[] dotNetClassHookFactories)
        {
            if (dotNetClassHookFactories is null)
            {
                throw new ArgumentNullException(nameof(dotNetClassHookFactories));
            }
            argumentsProvider         = null !;
            evalInfo                  = null !;
            this.dbgObjectIdService   = dbgObjectIdService ?? throw new ArgumentNullException(nameof(dbgObjectIdService));
            this.runtime              = runtime ?? throw new ArgumentNullException(nameof(runtime));
            valuesToDispose           = new List <DbgDotNetValue>();
            interpreterLocalsProvider = new InterpreterLocalsProvider(this);
            PointerSize               = pointerSize;

            var anyClassHooksList = new List <DotNetClassHook>();

            classHooks = new Dictionary <DmdTypeName, DotNetClassHook>(DmdTypeNameEqualityComparer.Instance);
            foreach (var factory in dotNetClassHookFactories)
            {
                foreach (var info in factory.Create(this))
                {
                    Debug.Assert(!(info.Hook is null));
                    if (info.WellKnownType is null && info.TypeName is null)
                    {
                        anyClassHooksList.Add(info.Hook);
                    }
예제 #2
0
        public DebuggerRuntimeImpl(DbgObjectIdService dbgObjectIdService, IDbgDotNetRuntime runtime, int pointerSize, DotNetClassHookFactory[] dotNetClassHookFactories)
        {
            if (dotNetClassHookFactories == null)
            {
                throw new ArgumentNullException(nameof(dotNetClassHookFactories));
            }
            this.dbgObjectIdService   = dbgObjectIdService ?? throw new ArgumentNullException(nameof(dbgObjectIdService));
            this.runtime              = runtime ?? throw new ArgumentNullException(nameof(runtime));
            valuesToDispose           = new List <DbgDotNetValue>();
            interpreterLocalsProvider = new InterpreterLocalsProvider(this);
            PointerSize = pointerSize;

            var anyClassHooksList = new List <DotNetClassHook>();

            classHooks = new Dictionary <DmdTypeName, DotNetClassHook>(DmdTypeNameEqualityComparer.Instance);
            foreach (var factory in dotNetClassHookFactories)
            {
                foreach (var info in factory.Create(this))
                {
                    Debug.Assert(info.Hook != null);
                    if (info.WellKnownType == null && info.TypeName == null)
                    {
                        anyClassHooksList.Add(info.Hook);
                    }
                    else
                    {
                        DmdTypeName typeName;
                        if (info.WellKnownType != null)
                        {
                            typeName = DmdWellKnownTypeUtils.GetTypeName(info.WellKnownType.Value);
                        }
                        else
                        {
                            Debug.Assert(info.TypeName != null);
                            typeName = info.TypeName.Value;
                        }
                        Debug.Assert(!classHooks.ContainsKey(typeName));
                        classHooks[typeName] = info.Hook;
                    }
                }
            }
            anyClassHooks = anyClassHooksList.ToArray();
        }