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

STEPOVER lands on wrong line (in catch)

XMLWordPrintable

    • x86_64
    • os_x

      A DESCRIPTION OF THE PROBLEM :
      When suspended in a try, issueing a STEP_OVER lands past the catch line. This is not the expected behavior.

      REGRESSION : Last worked in version 8

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      ```
      $ cat Main5.java
      public class Main5 {
          public static void main(String[] args) {
              try {
                  throw new RuntimeException();
              } catch (Exception e) {
                  System.out.println();
              }
          }
      }
      $ javac Main5.java
      $ java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000 -cp . Main5 &
      $ jdb -attach 8000
      main[1]: stop at Main5:4
      main[1]: resume
      main[1]:list // Observe how the debugger has stopped on Line 4
      main[1]:next
      main[1]:list // Observe how the debugger has stopped on Line 5 (correct behavior)
      ```

      Now when we throw the exception from somwhere else, STEP_OVER will not complete the step in the same line.

      ```
      $ cat Main6.java
      public class Main6 {
          public static void main(String[] args) {
              try {
                  throwRuntimeException();
              } catch (Exception e) {
                  System.out.println();
              }
          }

         static void throwRuntimeException() {
            throw new RuntimeException();
         }
      }
      $ javac Main6.java
      $ java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000 -cp . Main6 &
      $ jdb -attach 8000
      main[1]: stop at Main6:4
      main[1]: resume
      main[1]:list // Observe how the debugger has stopped on Line 4
      main[1]:next
      main[1]:list // Observe how the debugger has stopped on Line 6 (INCORRECT behavior)


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Upon `next` command from jdb, the VM should have completed the step and landed on line 4 (on the catch line).
      ACTUAL -
      However, in the second program, it landed on line 5 (on the first line in the catch body).

      FREQUENCY : always


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

              Created:
              Updated:
              Resolved: