Hi Larry,

jdb works quite well for me. I find its behaviour a little quirky at times, but
basically it seems to work.

I have jdk1.1.5v7 and libc 5.4.44. Some examples follow.

Actually you can see from the exampes, it really *is* a bit temperamental. If
anyone can spot what I'm doing wrong, please let the list know

Cheers ... Duncan.

EXAMPLE: the recently-discussed clipboard application

 18:16:45~/java/1.1$ javac -g clipboard.java
 Note: clipboard.java uses a deprecated API.  Recompile with "-deprecation" for
details.
 1 warning
 18:17:27~/java/1.1$ jdb clipboard
 Initializing jdb...
 0x406e72d0:class(clipboard)
 > stop at clipboard:61
 No code at line 61, or class is optimized.

Don't know what's going on here, but the following line works...

 > stop at clipboard$2:61
 Breakpoint set at clipboard$2:61
 > run
 run clipboard
 running ...
 main[1] isDataFlavorSupported Method called with:
  Mime Type: text/insidejava
  Human Name: Test on InsideJava
 Transferable supports text/insidejava Mime Type.
 isDataFlavorSupported Method called with:
  Mime Type: application/x-java-serialized-object
  Human Name: Unicode String
 Transferable supports application/x-java-serializedobject Mime Type

 Breakpoint hit: clipboard$2.actionPerformed (clipboard$2:61)
 AWT-EventQueue-0[1] print result
 result = null
 AWT-EventQueue-0[1] next
 AWT-EventQueue-0[1]
 Breakpoint hit: clipboard$2.actionPerformed (clipboard$2:65)
 AWT-EventQueue-0[1] locals
 Method arguments:
   this = clipboard$2@80dd0d0
   e = java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=Paste] on button1
 Local variables:
   data = Transfer@80dd9ef
   result = null
   s = null
   c is not in scope
 AWT-EventQueue-0[1] print s

Don't know why jdb doesn't simply report "s = null" again:-

 [Internal debug-agent error: operation failed to complete - deadlock avoided]
 Internal exception:
 java.lang.InterruptedException
         at sun.tools.debug.RemoteAgent.getClassInfo(RemoteAgent.java:627)
         at sun.tools.debug.RemoteClass.getClassInfo(RemoteClass.java:52)
         at sun.tools.debug.RemoteClass.getName(RemoteClass.java:87)
         at sun.tools.debug.RemoteAgent.findClass(RemoteAgent.java:463)
         at sun.tools.debug.RemoteDebugger.findClass(RemoteDebugger.java:115)
         at sun.tools.ttydebug.TTY.print(TTY.java:1094)
         at sun.tools.ttydebug.TTY.executeCommand(TTY.java:1321)
         at sun.tools.ttydebug.TTY.<init>(TTY.java:1469)
         at sun.tools.ttydebug.TTY.main(TTY.java:1590)

"locals" still gets it right:-

 AWT-EventQueue-0[1] locals
 Method arguments:
   this = clipboard$2@80dd0d0
   e = java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=Paste] on button1
 Local variables:
   data = Transfer@80dd9ef
   result = null
   s = null
   c is not in scope
 AWT-EventQueue-0[1] next
 AWT-EventQueue-0[1]
 Breakpoint hit: clipboard$2.actionPerformed (clipboard$2:71)
 AWT-EventQueue-0[1] quit
 19:36:21~/java/1.1$

You can also debug applets, although the error message had me fooled for a
while. The Scribble applet from Javanut2 (or 1):-

 20:12:07~/java/1.1$ javac -g  Scribble.java
 Note: Scribble.java uses a deprecated API.  Recompile with "-deprecation" for
details.
 1 warning
 20:14:08~/java/1.1$ appletviewer -debug Scribble.html
 Initializing jdb...
 [Internal debug-agent error: operation failed to complete - deadlock avoided]
 sun.applet.AppletViewer not found (try the full name)

It seems to be "safe" to ignore this error message

 > run
 run sun.applet.AppletViewer Scribble.html
 running ...

For now, I have only had success in setting breakpoints *after* the applet is
started (so the target classes are loaded). I have not yet been able to load
them myself with the "load" command.

 main[1] stop in Scribble.action
 [Internal debug-agent error: operation failed to complete - deadlock avoided]
 Internal exception:
 java.lang.InterruptedException
         at sun.tools.debug.RemoteAgent.getClassInfo(RemoteAgent.java:627)
         at sun.tools.debug.RemoteClass.getClassInfo(RemoteClass.java:52)
         at sun.tools.debug.RemoteClass.getName(RemoteClass.java:87)
         at sun.tools.debug.RemoteAgent.findClass(RemoteAgent.java:463)
         at sun.tools.debug.RemoteDebugger.findClass(RemoteDebugger.java:115)
         at sun.tools.ttydebug.TTY.getClassFromToken(TTY.java:695)
         at sun.tools.ttydebug.TTY.stop(TTY.java:755)
         at sun.tools.ttydebug.TTY.executeCommand(TTY.java:1376)
         at sun.tools.ttydebug.TTY.<init>(TTY.java:1469)
         at sun.tools.ttydebug.TTY.main(TTY.java:1590)

I thought *that* worked last time I tried. Ho hum, try it the other way:-

 main[1] stop at Scribble:51
 Breakpoint set at Scribble:51
 main[1]

Invoke the Colour Choice button in the applet window, which hits the breakpoint:

 Breakpoint hit: Scribble.action (Scribble:51)
 AWT-EventQueue-0[1] locals
 Method arguments:
   this = Scribble[panel1,0,0,500x300,layout=java.awt.FlowLayout]
   event = 
java.awt.Event[id=1001,x=274,y=5,target=java.awt.Choice[choice0,274,5,68x26,current=yellow],arg=yellow]
   arg = yellow
 Local variables:
   g is not in scope
   r is not in scope
 AWT-EventQueue-0[1] next
 AWT-EventQueue-0[1]
 Breakpoint hit: Scribble.action (Scribble:59)
 AWT-EventQueue-0[1] !!
 next
 AWT-EventQueue-0[1]
 Breakpoint hit: Scribble.action (Scribble:61)
 AWT-EventQueue-0[1] list

"list" usually works. Must be having a bad night

 Unable to find Scribble.java
 AWT-EventQueue-0[1] use ./Scribble.java
 AWT-EventQueue-0[1] list
 Unable to find Scribble.java
 AWT-EventQueue-0[1] use /home/dunc/java/1.1/Scribble.java
 AWT-EventQueue-0[1] list
 Unable to find Scribble.java

It really doesn't want to play ball. Oh well,

 AWT-EventQueue-0[1] cont
 AWT-EventQueue-0[1]

Kill applet from the applet menu

 sun.applet.AppletViewer exited
 20:24:16~/java/1.1$


On Wed, May 13, 1998 at 06:22:36PM -0400, Larry Medwin wrote:
> Hello,
>
> I've been trying to get jdb running under jdk1.1.5 under Linux, with no
> luck.  Has anybody gotten this working?
>
> First I type: javac -g Layout.java
> then: jdb Layout, from the JDE/Debug option
>
> Emacs then says: "Initializing jdb..." and nothing more.  Has anybody
> gotten this to work?
>
>
>
> Thanks,
>
> Larry
>

Reply via email to