Remote Debugging with MonoDevelop

This morning I tried to debug some Mono code in a Ubuntu 13.10 Saucy virtual machine that doesn’t have all the developer tools installed. Miguel de Icaza recently blogged about remote debugging, but it took a bit of fiddling to get it working. Here are my findings:

In the VM start your application with

mono --debug --debugger-agent="address=192.177.88.11:10000,transport=dt_socket,server=y" \
    /full/path/to/mono-application.exe

The IP address is the address of the VM, transport is a required argument, dt_socket seems to be the only allowed option. It is important to specify the full path to your managed application otherwise you’ll get an error that the application can’t be found.

Then on your developer machine set the environment variable MONODEVELOP_SDB_TEST and start MonoDevelop:

export MONODEVELOP_SDB_TEST=1
monodevelop-4.0

This adds a new menu item that allows to start a remote debugging session, under Run -> Run With -> Custom Command Mono Soft Debugger. This opens a dialog window; enter the IP address of your VM (192.177.88.11) and the port (10000) and start the session with the Connect button. This starts the application in the VM. Debugging works the same as if you would start the app locally. Great!

Advertisements

2 thoughts on “Remote Debugging with MonoDevelop

  1. Thanks for this. Nice concise writeup. But ‘full/path/to/mono’ is the part I did not understand. The app is not on the VM, so how do I provide the full path ? Or is it the full path on the machine from where I am debugging ?

    1. You need access to the app from the VM. This might easiest be done by using a shared folder so that the app used in the VM and in your host machine stay in sync.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s