Пример #1
0
        public void WaitForSymbolsLoaded()
        {
            var needReload    = true;
            var oldModuleList = _moduleList;

            _moduleList = ASymbolLoaderThread.GetModuleList(Process.Native.Id);
            if (oldModuleList.Length > 0 && oldModuleList.Length == _moduleList.Length)
            {
                needReload = false;
                for (var i = 0; i < oldModuleList.Length; i++)
                {
                    var nameChanged    = oldModuleList[i].ModuleName != _moduleList[i].ModuleName;
                    var addressChanged = oldModuleList[i].BaseAddress != _moduleList[i].BaseAddress;
                    needReload = nameChanged || addressChanged;
                    if (needReload)
                    {
                        break;
                    }
                }
            }
            if (needReload | SymbolList.Length == 0)
            {
                lock (SymbolLock)
                {
                    _symbolLoaderThread         = new ASymbolLoaderThread();
                    _symbolLoaderThread.Process = Process;
                    _symbolLoaderThread.Execute();
                    while (_symbolLoaderThread.IsLoading)
                    {
                        Thread.Sleep(10);
                    }
                    SymbolList.Assign(_symbolLoaderThread.SymbolList.TakeAll());
                }
            }
        }
Пример #2
0
            public static AModuleInfoArray GetModuleList(int pid)
            {
                var processList = new AModuleInfoArray();
                var snapshot    = CreateToolhelp32Snapshot(SnapshotFlags.Module | SnapshotFlags.Module32, (uint)pid);
                var mod         = new MODULEENTRY32()
                {
                    dwSize = (uint)Marshal.SizeOf(typeof(MODULEENTRY32))
                };

                if (!Module32FirstW(snapshot, ref mod))
                {
                    return(new AModuleInfoArray());
                }
                var winDir = UEnvironment.GetWinDir();

                do
                {
                    processList.Inc();
                    processList.Last.ModuleName     = mod.szModule;
                    processList.Last.BaseAddress    = mod.modBaseAddr;
                    processList.Last.BaseSize       = mod.modBaseSize;
                    processList.Last.ModulePath     = mod.szExePath;
                    processList.Last.IsSystemModule = AStringUtils.Pos(winDir, mod.szExePath, true) != -1;
                }while (Module32NextW(snapshot, ref mod));
                return(processList);
            }
Пример #3
0
 public ASymbolHandler()
 {
     Process             = null;
     _symbolLoaderThread = null;
     SymbolList          = new UArrayManager <ASymbol>();
     UserDefinedSymbols  = new UArrayManager <AUserDefinedSymbol>();
     _moduleList         = new AModuleInfoArray();
     ShowSymbols         = false;
     ShowModules         = false;
     ShowSections        = false;
 }