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

Local variable debug range info too long with nested blocks

XMLWordPrintable

    • 1.1.4
    • x86
    • windows_nt
    • Not verified



      Name: wm7046 Date: 06/04/97


      Sample Program

      The following application demonstrates the behavior.


      class Scope
      {
         public static void main(String[] args)
         {
            {
               int i;

               i = 55;
               System.out.println("i = " + i);
            }

            {
               int i;

               i = 99;
               System.out.println("i = " + i);
            }
         }
      }



      The Problem

      Here's the corresponding output from javap -l:


      Compiled from Scope.java
      synchronized class Scope extends java.lang.Object
          /* ACC_SUPER bit set */
      {
          public static void main(java.lang.String[]);
          Scope();
      }

      Line numbers for method void main(java.lang.String[])
         line 8: 0
         line 9: 3
         line 15: 25
         line 16: 28
         line 3: 50

      Local variables for method void main(java.lang.String[])
         java.lang.String[] args pc=0, length=51, slot=0
         int i pc=3, length=48, slot=1
         int i pc=28, length=23, slot=2

      Line numbers for method Scope()
         line 1: 0

      Local variables for method Scope()
         Scope this pc=0, length=5, slot=0



      The compiler-generated information has address ranges for the two variables named i which overlap. The first entry for i should have a length of 22, not 48. Without a fix to this problem, a debugger has no way of distinguishing between the two variables named i once the second one comes into scope.
      ======================================================================

            dstoutamsunw David Stoutamire (Inactive)
            mmma Marvin Ma (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: