Bug 721564 - Get module information for the profiler on Windows; r=BenWa

This commit is contained in:
Ehsan Akhgari 2012-01-26 19:03:42 -05:00
parent 9fc0ba862e
commit 838b8d9023

View File

@ -40,20 +40,25 @@
#include <tlhelp32.h>
#include "shared-libraries.h"
#include "nsWindowsHelpers.h"
SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
{
SharedLibraryInfo sharedLibraryInfo;
/*
HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId());
nsAutoHandle snap(CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId()));
MODULEENTRY32 module;
Module32First(snap, &module);
do {
// process module
} while (Module32Next(snap, &module));
*/
MODULEENTRY32 module = {0};
module.dwSize = sizeof(MODULEENTRY32);
if (Module32First(snap, &module)) {
do {
SharedLibrary shlib((uintptr_t)module.modBaseAddr,
(uintptr_t)module.modBaseAddr+module.modBaseSize,
0, // DLLs are always mapped at offset 0 on Windows
module.szModule);
sharedLibraryInfo.AddSharedLibrary(shlib);
} while (Module32Next(snap, &module));
}
return sharedLibraryInfo;
}