| 178 | } |
| 179 | |
| 180 | void 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 | } |
nothing calls this directly
no test coverage detected