Contents
Prev
Next


Remote debugging

In both examples at the previous chapter jBixbe starts new Java Virtual Machines (JVM's) at the local system. But you can also start JVM's independently of jBixbe at the local system or at a remote system and attaches them to jBixbe for debug purposes. This is what we call remote debugging.

Export the debug agent

If you want to attach a JVM to jBixbe you have to start this JVM with a debug agent provided by jBixbe. The agent comes as an operating system specific dynamic native library. How can you get this library? Start jBixbe, go to the Debug menu and choose Export Agent Library... The following dialog appears.

At first select the platform on which you plan to start a JVM with the agent. Select operating system and machine. The default selection is your local operating system and machine. Note, at the moment Windows 64-bit is not supported. Secondly give a directory in which the agent library will be exported. The line below displays a command line template to start a JVM with the agent. Click on Export and jBixbe will export a shared object file (libagent.so) for Linux systems and a dynamic link library (agent.dll) for Windows systems into the given directory.

Start a Java Virtual Machine with the debug agent

Syntax

java -agentpath:PathToAgentLibrary[=transport=isock[,address=port][,host=interface]] ...

transport The transport mechanism used for communication between agent and jBixbe.
isock - Internet Sockets (TCP sockets). This is the only mechanism supported at the moment and also the default if you let out the transport parameter.
address The agent will listen at the given TCP port for connections. If not specified the agent prints a self-selected port to the screen.
host interface is the name or IP address from which the agent will accept connections. If not specified connections from all host interfaces are allowed.

Examples:

Windows: java -agentpath:agent.dll -cp C:\jBixbe debuggees.BTree
Linux: java -agentpath:libagent.so -cp /home/swolf/jBixbe debuggees.BTree
The agent library is located in the current directory. TCP sockets will be used to transport data between agent and jBixbe. The agent prints a port number to the screen and accepts connections from all host interfaces.
Windows: java -agentpath:C:\Programme\jBixbe\agent.dll=transport=isock,address=1188 -cp C:\jBixbe debuggees.BTree
Linux: java -agentpath:/home/swolf/jBixbe/libagent.so=transport=isock,address=1188 -cp /home/swolf/jBixbe debuggees.BTree
Give the absolute path of the agent library. TCP sockets will be used. The agent will listen at port 1188 and accepts connections from all host interfaces.
Windows: java -agentpath:agent.dll=transport=isock,host=192.168.1.1 -cp C:\jBixbe debuggees.BTree
Linux: java -agentpath:libagent.so=transport=isock,host=192.168.1.1 -cp /home/swolf/jBixbe debuggees.BTree
The agent prints a port number to the screen and will only accept connections that comes over the host interface with IP address 192.168.1.1.

Attach jBixbe to a remote Java Virtual Machine

Open the Configure Project... dialog and select Attach. Give the name or IP address of the host on which the remote JVM was started. Select the port number that you define when starting the JVM or if you let out that the agent has written to the screen. Click OK and press Start/Continue button or F5.


Next