Skip to content

Connecting java debugger to JVM inside OSv

Tomasz Grabiec edited this page Jan 22, 2014 · 7 revisions

Starting the guest

To start OSv with debugger agent enabled pass one of these options:

  • --jvm-debug starts debugger agent listening on *:5005
  • --jvm-suspend is the same as above but suspends the JVM until debugger client connects.

Because the debugger server is using TCP as transport you need to start OSv with networking enabled.

Example:

sudo scripts/run.py -nv --jvm-debug

Once the JVM starts the debugger server it will print

Listening for transport dt_socket at address: 5005

Connecting the debugger

First you need to figure out the IP of your OSv guest. If you don't know what it is, look for the message of the following form in OSv's console (you need to run with -V option to see the output):

[I/329 dhcp]: Configuring eth0: ip 192.168.122.89 subnet mask 255.255.255.0 gateway 192.168.122.1

It means the guest was assigned 192.168.122.89.

After that you can use your favorite debugger to connect by pointing it to '192.168.122.89:5005'.

For example, using the JDK's command line debugger:

jdb -attach 192.168.122.89:5005
Clone this wiki locally