author | Aaron Klotz <aklotz@mozilla.com> |
Wed, 27 Jun 2018 14:23:29 -0600 | |
changeset 424943 | ff25e66da36e4c95363e684880085f99d845da2a |
parent 424942 | 1cdba0bde1857d2c8611fceaaa5f1d9fc6168ff6 |
child 424944 | a355ad34b92b9b75bce1667db40a62063ead215f |
child 424977 | cc3401e78e8bbae22e6dbc854e525ceae4923bcf |
push id | 104944 |
push user | aklotz@mozilla.com |
push date | Wed, 04 Jul 2018 02:23:52 +0000 |
treeherder | mozilla-inbound@ff25e66da36e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | njn |
bugs | 1460022 |
milestone | 63.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/tools/profiler/core/platform-win32.cpp +++ b/tools/profiler/core/platform-win32.cpp @@ -298,32 +298,34 @@ Registers::SyncPopulate() PopulateRegsFromContext(*this, &context); } #endif #if defined(GP_PLAT_amd64_windows) static WindowsDllInterceptor NtDllIntercept; typedef NTSTATUS (NTAPI *LdrUnloadDll_func)(HMODULE module); -static LdrUnloadDll_func stub_LdrUnloadDll; +static WindowsDllInterceptor::FuncHookType<LdrUnloadDll_func> + stub_LdrUnloadDll; static NTSTATUS NTAPI patched_LdrUnloadDll(HMODULE module) { // Prevent the stack walker from suspending this thread when LdrUnloadDll // holds the RtlLookupFunctionEntry lock. AutoSuppressStackWalking suppress; return stub_LdrUnloadDll(module); } // These pointers are disguised as PVOID to avoid pulling in obscure headers typedef PVOID (WINAPI *LdrResolveDelayLoadedAPI_func)(PVOID ParentModuleBase, PVOID DelayloadDescriptor, PVOID FailureDllHook, PVOID FailureSystemHook, PVOID ThunkAddress, ULONG Flags); -static LdrResolveDelayLoadedAPI_func stub_LdrResolveDelayLoadedAPI; +static WindowsDllInterceptor::FuncHookType<LdrResolveDelayLoadedAPI_func> + stub_LdrResolveDelayLoadedAPI; static PVOID WINAPI patched_LdrResolveDelayLoadedAPI(PVOID ParentModuleBase, PVOID DelayloadDescriptor, PVOID FailureDllHook, PVOID FailureSystemHook, PVOID ThunkAddress, ULONG Flags) { // Prevent the stack walker from suspending this thread when // LdrResolveDelayLoadAPI holds the RtlLookupFunctionEntry lock. @@ -331,26 +333,18 @@ patched_LdrResolveDelayLoadedAPI(PVOID P return stub_LdrResolveDelayLoadedAPI(ParentModuleBase, DelayloadDescriptor, FailureDllHook, FailureSystemHook, ThunkAddress, Flags); } void InitializeWin64ProfilerHooks() { - static bool initialized = false; - if (initialized) { - return; - } - initialized = true; - NtDllIntercept.Init("ntdll.dll"); - NtDllIntercept.AddHook("LdrUnloadDll", - reinterpret_cast<intptr_t>(patched_LdrUnloadDll), - (void**)&stub_LdrUnloadDll); + stub_LdrUnloadDll.Set(NtDllIntercept, "LdrUnloadDll", &patched_LdrUnloadDll); if (IsWin8OrLater()) { // LdrResolveDelayLoadedAPI was introduced in Win8 - NtDllIntercept.AddHook("LdrResolveDelayLoadedAPI", - reinterpret_cast<intptr_t>(patched_LdrResolveDelayLoadedAPI), - (void**)&stub_LdrResolveDelayLoadedAPI); + stub_LdrResolveDelayLoadedAPI.Set(NtDllIntercept, + "LdrResolveDelayLoadedAPI", + &patched_LdrResolveDelayLoadedAPI); } } #endif // defined(GP_PLAT_amd64_windows)