| 405 | } |
| 406 | |
| 407 | static int checkPreloadedCallback(dl_phdr_info* info, size_t size, void* data) { |
| 408 | Dl_info* dl_info = (Dl_info*)data; |
| 409 | |
| 410 | Dl_info libprofiler = dl_info[0]; |
| 411 | Dl_info libc = dl_info[1]; |
| 412 | |
| 413 | if ((void*)info->dlpi_addr == libprofiler.dli_fbase) { |
| 414 | // async-profiler found first |
| 415 | return 1; |
| 416 | } else if ((void*)info->dlpi_addr == libc.dli_fbase) { |
| 417 | // libc found first |
| 418 | return -1; |
| 419 | } |
| 420 | |
| 421 | return 0; |
| 422 | } |
| 423 | |
| 424 | // Checks if async-profiler is preloaded through the LD_PRELOAD mechanism. |
| 425 | // This is done by analyzing the order of loaded dynamic libraries. |
nothing calls this directly
no outgoing calls
no test coverage detected