RFR: 8344165: Trace exceptions with a complete call-stack [v7]
David Holmes
dholmes at openjdk.org
Tue Jun 10 12:45:28 UTC 2025
On Tue, 10 Jun 2025 00:05:54 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> This PR makes it easier to analyze exceptions without modifying the JVM or the app to print call stacks:
>>
>> Excerpt from the test case ExceptionsTest.java.
>>
>>
>> [0.038s][info][exceptions ] Exception <a 'java/lang/RuntimeException'{0x0000000474019bd8}: Test exception 2 for logging>
>> [ ] thrown in interpreter method <{method} {0x000074c408400810} 'baz2' '()V' in 'ExceptionsTest$InternalClass'>
>> [ ] at bci 9 for thread 0x000074c46402c7b0 (main)
>> [0.038s][info][exceptions,stacktrace] at ExceptionsTest$InternalClass.baz2(ExceptionsTest.java:142)
>> [0.038s][info][exceptions,stacktrace] at ExceptionsTest$InternalClass.bar2(ExceptionsTest.java:135)
>> [0.038s][info][exceptions,stacktrace] at ExceptionsTest$InternalClass.foo2(ExceptionsTest.java:127)
>> [0.038s][info][exceptions,stacktrace] at ExceptionsTest$InternalClass.main(ExceptionsTest.java:110)
>> [0.038s][info][exceptions ] Exception <a 'java/lang/RuntimeException'{0x0000000474019bd8}: Test exception 2 for logging>
>> [ ] thrown in interpreter method <{method} {0x000074c408400748} 'bar2' '()V' in 'ExceptionsTest$InternalClass'>
>> [ ] at bci 0 for thread 0x000074c46402c7b0 (main)
>> [0.038s][info][exceptions ] Found matching handler for exception of type "java.lang.RuntimeException" in method "bar2" at BCI: 6
>> [0.038s][info][exceptions ] Exception <a 'java/lang/RuntimeException'{0x0000000474019bd8}: Test exception 2 for logging>
>> [ ] thrown in interpreter method <{method} {0x000074c408400748} 'bar2' '()V' in 'ExceptionsTest$InternalClass'>
>> [ ] at bci 8 for thread 0x000074c46402c7b0 (main)
>> [0.038s][info][exceptions,stacktrace] at ExceptionsTest$InternalClass.bar2(ExceptionsTest.java:137)
>> [0.038s][info][exceptions,stacktrace] at ExceptionsTest$InternalClass.foo2(ExceptionsTest.java:127)
>> [0.038s][info][exceptions,stacktrace] at ExceptionsTest$InternalClass.main(ExceptionsTest.java:110)
>> [0.038s][info][exceptions ] Exception <a 'java/lang/RuntimeException'{0x0000000474019bd8}: Test exception 2 for logging>
>> [ ] thrown in interpreter method <{method} {0x000074c408400670} 'foo2' '()V' in 'ExceptionsTest$InternalClass'>
>> [ ] at bci 0 for thread 0x000074c46402c7b0 (m...
>
> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
>
> Print callstack for rethrown exceptions
I'm not sure about the de-duplication checks. It isn't clear to me what code structures will cause you see to see a single stacktrace and which will cause you to see many stacktraces. For example, will a try/finally causes a repeated stacktrace? I think yes.
Sorry I am away for a few days so will have to re-examine this next week.
-------------
PR Review: https://git.openjdk.org/jdk/pull/25522#pullrequestreview-2913388476
More information about the hotspot-dev
mailing list