Java Reference
In-Depth Information
Example 5.17 index.html used in jdb session
<HTML>
<HEAD>
<TITLE>RedHat Linux Laptop</TITLE>
</HEAD>
<BODY>
<H1>RedHat Linux Laptop</H1>
<P>You have contacted Michael Schwarz's RedHat Linux Laptop.
You would probably rather
<A HREF="http://www.multitool.net/">see his permanent Web
page</A> since this server goes up and down all the time, what
with it being on a laptop.</P>
</BODY>
</HTML>
Example 5.18 is an actual transcript of a real jdb session. It is annotated
with explanatory comments. Our goal here is to get you going. The best way
to learn jdb , or indeed any of these tools, is to use them.
Obviously, this little session has merely scratched the surface of the Java
debugger. You can debug multithreaded applications with commands that can
suspend and resume individual threads, list the running threads, switch your
“executable view” between threads, and so forth. You can trace method calls.
You can monitor variables. You can execute expressions (including assignment
expressions, allowing you to force variables to certain values). You can browse
classes. You can dump all local variables with a single command. The debugger
is quite capable, if a bit limited in user interface. 23 Learn it. Play with it. Step
through your favorite Java program with it.
23. As you know, we do not automatically like IDEs and GUI development tools (see Sec-
tion 5.2). A debugger is an exception to that rule. When debugging, a well designed UI with
a code pane, a stack pane, a data viewer, a class browser, a thread selection pane, and so on is
enormously helpful. You need to be able to see all these elements nearly simultaneously; you
need to see the whole system as it runs. The command-line debugger makes everything you need
available, but with a traditional “glass-teletype” UI that is quite awkward. By all means, learn
the CLI debugger, but then find a good Java debugger with a windowed UI of some kind. It
is hard to say which compiler UI is the best, but I think we can safely say the command-line
debugger UI is the worst! You should know it as a last resort, but use it as a last resort!
Search WWH ::




Custom Search