MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / patchLibraries

Method patchLibraries

src/hooks.cpp:180–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180void Hooks::patchLibraries() {
181 MutexLocker ml(_patch_lock);
182
183 CodeCacheArray* native_libs = Profiler::instance()->nativeLibs();
184 int native_lib_count = native_libs->count();
185
186 while (_patched_libs < native_lib_count) {
187 CodeCache* cc = (*native_libs)[_patched_libs++];
188 UnloadProtection handle(cc);
189 if (!handle.isValid()) {
190 continue;
191 }
192
193 if (!cc->contains((const void*)Hooks::init)) {
194 // Let libasyncProfiler always use original dlopen
195 cc->patchImport(im_dlopen, (void*)dlopen_hook);
196 }
197 cc->patchImport(im_pthread_create, (void*)pthread_create_hook);
198 cc->patchImport(im_pthread_exit, (void*)pthread_exit_hook);
199 }
200}

Callers

nothing calls this directly

Calls 5

nativeLibsMethod · 0.80
isValidMethod · 0.80
patchImportMethod · 0.80
countMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected