예제 #1
0
파일: CorProcess.cs 프로젝트: tylike/mindbg
        /// <summary>
        /// Resolves function from its name.
        /// </summary>
        /// <param name="moduleName">module name</param>
        /// <param name="className">class name</param>
        /// <param name="functionName">wanted function name</param>
        /// <returns></returns>
        public CorFunction ResolveFunctionName(String moduleName, String className, String functionName)
        {
            // find module
            CorModule module = FindModuleByName(moduleName);

            if (module == null)
            {
                return(null);
            }

            Int32 typeToken = module.GetTypeTokenFromName(className);

            if (typeToken == CorConstants.TokenNotFound)
            {
                return(null);
            }

            Type        t    = new MetadataType(module.GetMetadataInterface <IMetadataImport>(), typeToken);
            CorFunction func = null;

            foreach (MethodInfo mi in t.GetMethods())
            {
                if (String.Equals(mi.Name, functionName, StringComparison.Ordinal))
                {
                    func = module.GetFunctionFromToken(mi.MetadataToken);
                    break;
                }
            }
            return(func);
        }
예제 #2
0
        // Initializes all private symbol variables
        private void SetupSymbolInformation()
        {
            if (p_symbolsInitialized)
            {
                return;
            }

            p_symbolsInitialized = true;
            CorModule     module    = GetModule();
            ISymbolReader symreader = module.GetSymbolReader();

            p_hasSymbols = symreader != null;
            if (p_hasSymbols)
            {
                ISymbolMethod sm = null;
                sm = symreader.GetMethod(new SymbolToken((Int32)GetToken())); // FIXME add version
                if (sm == null)
                {
                    p_hasSymbols = false;
                    return;
                }
                p_symMethod      = sm;
                p_SPcount        = p_symMethod.SequencePointCount;
                p_SPoffsets      = new Int32[p_SPcount];
                p_SPdocuments    = new ISymbolDocument[p_SPcount];
                p_SPstartLines   = new Int32[p_SPcount];
                p_SPendLines     = new Int32[p_SPcount];
                p_SPstartColumns = new Int32[p_SPcount];
                p_SPendColumns   = new Int32[p_SPcount];

                p_symMethod.GetSequencePoints(p_SPoffsets, p_SPdocuments, p_SPstartLines,
                                              p_SPstartColumns, p_SPendLines, p_SPendColumns);
            }
        }
예제 #3
0
 internal void LoadModule(ICorDebugModule pModule, CorModule module)
 {
     if (moduleCache.TryAdd(pModule, module) == false)
     {
         Console.WriteLine($"Unable to LOAD Module {pModule}, {module} into the cache");
     }
 }
예제 #4
0
            void ICorDebugManagedCallback.LoadModule(ICorDebugAppDomain pAppDomain, ICorDebugModule pModule)
            {
                var appDomain = GetCachedAppDomain(pAppDomain);
                var module    = new CorModule(pModule, p_options);

                appDomain.LoadModule(pModule, module);

                var ev = new CorModuleLoadEventArgs(appDomain, module);

                GetOwner(ev.Controller).DispatchEvent(ev);

                FinishEvent(ev);
            }