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

'next' command crashes debugger if next line is at end of a method

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.1
    • 1.1
    • tools
    • 1.1fcs
    • sparc
    • solaris_2.5, solaris_2.5.1
    • Not verified

      Sun's Java debugger, JDB, has a 'next'command that
      allows you to continue execution to the next line.
      This command works except for the case when the
      next line is the end of a method. In this case,
      doing 'next' will crash the debugger.
      We're trying to build a debugger using Java debugger
      APIs. During debugging, the user can choose to
      step into the next instruction or step over to the
      next line. We use the method RemoteThread.step() to
      step into the next instruction. We use the method
      RemoteThread.next()to step over to the next line.

      This is similar to what JDB does. You can check out
      the code for JDB by looking that the source file
      'TTY.java'. RemoteThread.next() will crash the
      debugger if the next instruction is at the end of
      a method.

      Tried this against jdb in JDK 1.0.2 and JDK 1.1beta2
      and both failed.


      Here is a simple test case using jdb JDK 1.1beta2:

      public class Test {

          public static void main(String argv[]) {
              Test t = new Test();
              t.testBreakPoint("Hello world");
          }

         public void testBreakPoint(String abc) {
             XXX xxx = new XXX();
             String result = xxx.doIt(abc);
             System.out.println("result = " + result);
         }
      }

      class XXX {

          public String doIt(String abc) {
             return abc;
          }
          
      }


      chicosun:/home/meiphen/JAVA/2717835.jdb 7 % jdb Test
      Initializing jdb...
      0xee31df10:class(Test)
      > stop in Test.testBreakPoint
      Breakpoint set in Test.testBreakPoint
      > run
      run Test

      Breakpoint hit: Test.testBreakPoint (Test:9)
      main[1] running ...
      main[1] list
      5 t.testBreakPoint("Hello world");
      6 }
      7
      8 public void testBreakPoint(String abc) {
      9 => XXX xxx = new XXX();
      10 String result = xxx.doIt(abc);
      11 System.out.println("result = " + result);
      12 }
      13 }
      main[1] next

      Breakpoint hit: main[1] Test.testBreakPoint (Test:10)
      main[1] list
      6 }
      7
      8 public void testBreakPoint(String abc) {
      9 XXX xxx = new XXX();
      10 => String result = xxx.doIt(abc);
      11 System.out.println("result = " + result);
      12 }
      13 }
      14
      main[1] next
      main[1]
      Breakpoint hit: Test.testBreakPoint (Test:11)
      main[1] list
      7
      8 public void testBreakPoint(String abc) {
      9 XXX xxx = new XXX();
      10 String result = xxx.doIt(abc);
      11 => System.out.println("result = " + result);
      12 }
      13 }
      14
      15 class XXX {
      main[1] next
      result = Hello world

      Breakpoint hit: main[1] Test.testBreakPoint (Test:8)
      main[1] list
      4 Test t = new Test();
      5 t.testBreakPoint("Hello world");
      6 }
      7
      8 => public void testBreakPoint(String abc) {
      9 XXX xxx = new XXX();
      10 String result = xxx.doIt(abc);
      11 System.out.println("result = " + result);
      12 }
      main[1] next

      The communications channel closed.
      Internal exception: java.io.EOFException
      at java.io.DataInputStream.readUnsignedShort(DataInputStream.java)
      at java.io.DataInputStream.readUTF(DataInputStream.java)
      at java.io.DataInputStream.readUTF(DataInputStream.java)
      at sun.tools.debug.RemoteAgent.getThreadName(RemoteAgent.java:619)
      at sun.tools.debug.RemoteThread.getName(RemoteThread.java:45)
      at sun.tools.ttydebug.TTY.printPrompt(TTY.java:70)
      at sun.tools.ttydebug.TTY.<init>(TTY.java:1344)
      at sun.tools.ttydebug.TTY.main(TTY.java:1436)

            rfield Robert Field (Inactive)
            mchansunw Mei Chan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: