RFR: 8193513: add support for printing a stack trace on class loading [v2]

David Holmes dholmes at openjdk.org
Thu Jun 22 01:16:08 UTC 2023


On Wed, 21 Jun 2023 07:02:09 GMT, Doug Simon <dnsimon at openjdk.org> wrote:

>> src/hotspot/share/oops/instanceKlass.cpp line 3748:
>> 
>>> 3746:     st.print_cr("Loading %s", external_name());
>>> 3747:     JavaThread::current()->print_stack_on(&st);
>>> 3748:     tty->print_raw(st.as_string());
>> 
>> This should be integrated with the UL below. When logging is enabled dump the stacktrace from the stringStream to the UL stream - probably at debug, or even trace, level. You need the diagnostic flag to set the filter, but it should still be controlled by the UL settings IMO.
>
> I assume you mean make the feature require `-Xlog:class+load` in addition? I had that at first but it adds a lot of noise when one is only interested in certain classes as it now shows a UL line for every class loaded, including those not matched by the filter.
> I think this is such niche functionality, it's better to keep it separate from `-Xlog:class+load`.

I prefer to see this as an extension of UL rather than a stand-alone tracing utility as we have been trying to get rid of the latter and focus on UL. By using UL you also get benefits like easy redirection to a file etc, rather than dumping to tty.

But I understand about the "noise" aspect. Need to think more on this ...

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14553#discussion_r1237873487


More information about the hotspot-dev mailing list