Navigation

About
Home
Junk
Links
Contact

Quick links

UniMail
Newmail.ru
Gmail
Google
Gateway
myUNSW
CSE FAQ

Subject links

COMP3441
COMP3421

Google

Dictionary
Dictionary
Thesaurus

JDB reference

Debugging with JDB

While usually you will be able to simply run JDB by typing 'jdb' at the prompt, in some cases you will be debugging an application which uses STDIN and STDOUT and things will suddenly become not so simple. After you've spend hours bashing your head with the keyboard in frustration, you will realise what you really should have done was set up two xterms and then do this:

Start up your application

java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=4571 HelloWorld

Connect to it through JDB

jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=4571

Where address and port obviously correspond to each other... and HelloWorld is the nameof the class to test.

My useless list of useful commands

Since I'm sick and tired of forgetting how to use JDB, the somewhat distant and slightly backward cousin of GDB, I have decided to conjure up this small reference. I've already forgotten what those commands actually do, but I recall that these were the most useful. It is a lot easier to look up the commands in the help file individually than read the whole bloody thing everytime I decide to use jdb.

This is obviously of little use to anyone but me, but I hope society accepts this humble gift of mine. I'm not really gonna put much effort into this, so don't complain if the layout is a bit dodgy.

  • run [class [args]]
  • threads
  • where/wherei
  • up/down
  • print {exp}/dump {exp}
  • set {lval} = {exp}
  • classes
  • class {id}
  • methods
  • fields
  • stop in {class.method}
  • stop at {class:lineno}
  • clear
  • step
  • step up
  • next
  • cont

Click here to go back to the main page and remember to never, ever come here again... for your own benefit.

This document was last updated on: 00:08 7/04/08