JDK-4617488 : TTY: jdb produces malformed messages for caught exceptions on Linux and Solx86
  • Type: Bug
  • Component: core-svc
  • Sub-Component: debugger
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: linux,solaris
  • CPU: x86
  • Submitted: 2001-12-24
  • Updated: 2023-12-14
  • Resolved: 2016-11-03
Related Reports
Relates :  
Description

Name: dkR10014			Date: 12/24/2001


  The following simple test demonstrates that jdb produces malformed messages
in stdout for caught exceptions when "catch" command is used. It looks like
jdb prints the mesagges from different sources with overlap. The bug is observed
on Linux and Solaris x86 only.

------------------ Test.java ------------------  
class Test {
    public static void main(String argv []) {
        for (int i = 0; i < 10; i++) {
            try {
                throw new MyException("User defined exception is thrown :" + i);
            } catch (MyException e) {
                System.out.println(e);
            }
        }
    }
} 

class MyException extends Exception {
    public MyException (String s) {
        super(s);
    }
}
-----------------------------------------------

Steps to reproduce:

 1. Copy Test.java in your working directory and compile it.
 2. Launch jdb.
 3. When jdb gives the prompt, type the following jdb commands:
       catch MyException<enter>
       run Test<enter>
       
 4. Repeat "cont" command until jdb exit (10 times) when it reports 
    about caught exceptions and waits for the input.
    
    
 Below is example of malformed output on Linux RedHat 6.2 ("^" symbol points at what is wrong ):

----------------------------------------------------------------------------------
bash$ /export/ld24/java/hotspot/jdk1.4/linux/bin/jdb
Initializing jdb ...
> catch MyException
Deferring exception catch MyException.
It will be set after the class is loaded.
> run Test
run  Test
> 
VM Started: Set deferred exception catch MyException

Exception occurred: MyException (to be caught at: Test.main(), line=7 bci=32)"thread=main", Test.main(), line=5 bci=31
5                    throw new MyException("User defined exception is thrown :" + i);

main[1] cont
> MyException: User defined exception is thrown :0

Exception occurred: MyException (to be caught at: Test.main(), line=7 bci=32)"thread=main", Test.main(), line=5 bci=31
5                    throw new MyException("User defined exception is thrown :" + i);

    .........
    
main[1] cont
> MyException: User defined exception 
                                     ^ 
                                     line is broken
                                     
iException occurred: MyException (to be caught at: Test.main(), line=7 bci=32)s thrown :7
^                                                                             ^^^^^^^^^^^  
[this symbol should be in the previous line]                               [these symbols should be in the previous line]

"thread=main", Test.main(), line=5 bci=31
5                    throw new MyException("User defined exception is thrown :" + i);

main[1] cont
> MyE
     ^
     [line is broken]
     
xException occurred: MyException (to be caught at: Test.main(), line=7 bci=32)ception: User defined exception is thrown :8
^                                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[this symbol should be in the previous line]                                  [these symbols should be in the previous line]

"thread=main", Test.main(), line=5 bci=31
5                    throw new MyException("User defined exception is thrown :" + i);

main[1] cont
> MyException: User defined exception is thrown :9

The application exited
----------------------------------------------------------------------------------
   

 Below is example of malformed output on Solaris x86 5.8 ("^" symbol points at what is wrong ):
----------------------------------------------------------------------------------

kdos@novo92N36 /export/ld24/java/hotspot/jdk1.4/solx86/bin/jdb
Initializing jdb ...
> catch MyException
Deferring exception catch MyException.
It will be set after the class is loaded.
> run Test
run  Test
> 
VM Started: Set deferred exception catch MyException

Exception occurred: MyException (to be caught at: Test.main(), line=7 bci=32)"thread=main", Test.main(), line=5 bci=31
5                    throw new MyException("User defined exception is thrown :" + i);

main[1] cont
> MyException: User defined exception is thrown :0

Exception occurred: MyException (to be caught at: Test.main(), line=7 bci=32)"thread=main", Test.main(), line=5 bci=31
5                    throw new MyException("User defined exception is thrown :" + i);

main[1] cont
M> yException: User defined exception is thrown :1
 ^
 [the prompt symbol interrupts the line]
 
Exception occurred: MyException (to be caught at: Test.main(), line=7 bci=32)"thread=main", Test.main(), line=5 bci=31
5                    throw new MyException("User defined exception is thrown :" + i);

main[1] cont
MyExcep> tion: User defined exception is thrown :2
       ^
      [The prompt symbol interrupts the line]
       
Exception occurred: MyException (to be caught at: Test.main(), line=7 bci=32)"thread=main", Test.main(), line=5 bci=31
5                    throw new MyException("User defined exception is thrown :" + i);

   ......
   
main[1] cont
MyE> xception: User defined exception is thrown :9
   ^
  [the prompt symbol interrupts the line]

The application exited
----------------------------------------------------------------------------------

This bug affects the following testbase_nsk test:

  nsk/jdb/caught_exception/caught_exception001

======================================================================

Comments
This is not on our list of current priorities, if this changes please re-open this issue.
03-11-2016

WORK AROUND ###@###.### 2002-01-07 To bypass this conflict, separate debugger and debugee. Start the debugee program in one command window: java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=4571 Test Start jdb in another window and attach to the debugee via a socket: jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=4571
11-06-2004

PUBLIC COMMENTS .
10-06-2004