JDK-4185378 : show bytecode offset in exception if line number table unavailable
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.2.0,1.4.2,6
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: generic,windows_xp
  • CPU: generic,x86
  • Submitted: 1998-10-29
  • Updated: 2017-05-19
Related Reports
Relates :  
Relates :  
Description
Name: ap32198			Date: 10/29/98


I would be nice if the stack trace produced by an exception would include offsets in the bytecode if the line number is not available. This would greatly enhance debugging/tracing of release code. Also, please include the method signature with the name, because just the name is not enough for overloaded method.
We use obfuscation to compress our applications/applets and these two issues would be really helpful.
(Review ID: 36861)
======================================================================

Comments
This is simple: http://cr.openjdk.java.net/~plevart/jdk9-dev/StackTraceElement.byteCodeIndex/jdk.webrev.01/ http://cr.openjdk.java.net/~plevart/jdk9-dev/StackTraceElement.byteCodeIndex/hotspot.webrev.01/ With this patch, stack traces look like: Exception in thread "main" java.io.FileNotFoundException: /tmp/x (No such file or directory) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open[2](FileInputStream.java:195) at java.io.FileInputStream.<init>[97](FileInputStream.java:138) at java.io.FileInputStream.<init>[17](FileInputStream.java:93) at Test.dump[9](Test.java:12) at Test.main[3](Test.java:19) The numbers in square brackets are BCI(s). Showing them *in addition* to line numbers, because this way one can pin-point the NullPointerException or StackOverflowError or OutOfMemoryError or any exception that is not a result of a called method throwing it and can happen at several points in single line. BCI provides better resolution than line number. You must be looking at javap output instead of source. I would have needed this if it was available.
28-01-2015