RFR: JDK-8288003: log events for os::dll_unload

David Holmes dholmes at openjdk.java.net
Thu Jun 9 13:43:17 UTC 2022


On Thu, 9 Jun 2022 07:50:14 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

> Currently we only log events for os::dll_load, but not for os::dll_unload, this patch adds it. On some platforms (Linux/Windows) we can use OS APIs (e.g. dlinfo on Linux) to log the path of the unloaded shared lib.

Generally okay but I'd like to minimise the conditional code.

Thanks.

src/hotspot/os/posix/os_posix.cpp line 718:

> 716:   if (res_dli == 0) {
> 717:     l_path = lmap->l_name;
> 718:   }

Can we hide this in `os::Linux::dll_path` so that the code here would simply be:


const char* l_path = LINUX_ONLY(os::Linux::dll_path(lib))
                     NOT_LINUX("<not available>");

src/hotspot/os/posix/os_posix.cpp line 726:

> 724: 
> 725:   if (res == 0) {
> 726:     Events::log_dll_message(NULL, "Unloaded shared library %s [" INTPTR_FORMAT "]", l_path, p2i(lib));

Shouldn't the %s be quoted here too? The output will look a bit odd:

Unloaded shared library <not available> [0xbaadcafebaadcafe]

vs.

Unloaded shared library "<not available>" [0xbaadcafebaadcafe]

-------------

Changes requested by dholmes (Reviewer).

PR: https://git.openjdk.org/jdk/pull/9101


More information about the hotspot-runtime-dev mailing list