[2208] in java-interest
Resend: Re: Debugging Java
daemon@ATHENA.MIT.EDU (Thomas Ball)
Tue Sep 26 22:27:32 1995
Date: Tue, 26 Sep 1995 16:31:54 -0700
From: Thomas.Ball@Eng.Sun.COM (Thomas Ball)
To: java-interest@java.Eng.Sun.COM
The "use" command (like in dbx) shows the list of directories which
will be searched to find a source file. By default, it uses your
classpath -- that's a poor choice for source files, but it's the only
clue I have (it's been said that Californian==clueless, but that's off
the subject). If you specify a colon-deliminated list of source
directory roots with the "use" command, jdb should have no trouble
looking up source files. Here's part of the path I use:
main[1] use .:/home/tball/java/src/share/java
Note that you only need the top of the source tree if it matches the
class hierarchy, that is, if the package name can be used as part of the
path. For example, jdb would lookup java.lang.String by taking each
path, appending the package, and then adding the source file name
(stored in the class file), so it would try (using the above path):
./java/lang/String.java (not there...)
/home/tball/java/src/share/java/java/lang/String.java (a winner!)
Note: if you are doing remote debugging, specify the source file paths
used on the remote machine. The source files are actually copied down,
so you have some assurance that those are the actual source files.
I'll be adding a way to store the initial jdb setup commands, so you
won't need to always enter them anymore.
Your second problem points to missing features (though soon to be
added). Although you can set breakpoints either by line number or
method name, you can currently only clear them by line number. To make
things more painful, there's no way today to list the current
breakpoints.
The good news is that when you hit a breakpoint in a class which has
line number information (the default), the source file and the line
number of the breakpoint will be displayed in the breakpoint event
message. Here's an example:
running ...
main[1] stop in TicTacToe.mouseUp
Breakpoint set in TicTacToe.mouseUp
Breakpoint hit: TicTacToe.mouseUp (TicTacToe.java:235)
AWT-Motif[1] clear TicTacToe.mouseUp
"TicTacToe.mouseUp" is not a valid id or class name. <== to be fixed
AWT-Motif[1] clear TicTacToe:235
Breakpoint cleared at TicTacToe: 235
AWT-Motif[1] cont
Fixed in the next release, as they say.
Tom
> Hi Thomas ,
>
> I decided to try out some of the java debugging commands using TicTacTac .
> Everytime I do a list to try and see the source code I get a message saying
> "Unable to find $JAVAHOME/demo/TicTacToe/TicTacToe.java" . I am also having
> problems with clearing breakpoints .
> Maybe I'm doing something wrong . Please can you clarify the usage of these 2
> commands . Your help will be most appreciated .
>
> Many Thanks ,
>
> Mushtaq
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com