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

Ioi Lam iklam at openjdk.org
Fri Jun 20 17:13:08 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 two additional commits since the last revision:

 - refactor
 - Reimplement -- print stack trace only when it is a known throwing site

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

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

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

  Stats: 114 lines in 4 files changed: 58 ins; 13 del; 43 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