Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8130220

Show the original source code lines intermixed with the bytecode like objdump -S

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Unresolved
    • P4
    • tbd
    • 8u45
    • tools
    • x86_64
    • linux

    Description

      A DESCRIPTION OF THE REQUEST :
      I know this debug information is contained in the .class file when compiling with:

          javac -g Main.java

      and can be observed manually from the `LineNumberTable:` section of:

          javap -c -constants -private -verbose '$<' > '$@'

      What I want is to make `javap` display the source in the middle of the bytecode.

      Sample input:

          public class New {
              public static void main(String[] args) {
                  System.out.println(new Integer(1));
              }
          }

      Actual `javap` output:

             0: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream;
             3: new #3 // class java/lang/Integer
             6: dup
             7: iconst_1
             8: invokespecial #4 // Method java/lang/Integer."<init>":(I)V
            11: invokevirtual #5 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
            14: return
          LineNumberTable:
            line 3: 0
            line 4: 14

      Desired javap output:
       
                 System.out.println(new Integer(1));
             0: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream;
             3: new #3 // class java/lang/Integer
             6: dup
             7: iconst_1
             8: invokespecial #4 // Method java/lang/Integer."<init>":(I)V
            11: invokevirtual #5 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
              }
            14: return
          LineNumberTable:
            line 3: 0
            line 4: 14


      JUSTIFICATION :
      That would make it much easier to interpret `javap` output.


      Attachments

        Activity

          People

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: