RFR: 8344165: Trace exceptions with a complete call-stack [v8]

Ioi Lam iklam at openjdk.org
Tue Jun 10 18:34:00 UTC 2025


> 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 (main)
> [0.038s][info][exceptions           ] Found m...

Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:

  @dholmes-ora comments -- removed printing of output.getStdout() from test

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/25522/files
  - new: https://git.openjdk.org/jdk/pull/25522/files/cc451e7e..10e94797

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=25522&range=07
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25522&range=06-07

  Stats: 24 lines in 1 file changed: 7 ins; 12 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/25522.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25522/head:pull/25522

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


More information about the hotspot-dev mailing list