Remote Debugging

Remote Debugging

Did you know that Real Studio includes a Remote Debugger that can make your cross-platform development even simpler than it already is?

When creating cross-platform software, a question I am frequently asked is how to test projects on a platform other than what you are using. Often people think they need to install Real Studio on the other platform and figure out a way to share source code.  I'm happy to say that you do not need to go to all that trouble. Instead use the Remote Debugger.

The Remote Debugger is a small program that lets you run your project on a different target platform. Real Studio communicates with it so that when you run your project, it sends it to the target platform rather than running it locally. Normally when you run your project from within Real Studio (Project->Run), it runs the debug build locally. If you have the Remote Debugger configured, you can instead have Real Studio send and run your debug build on a remote computer, which is incredibly useful for testing cross-platform applications.  This remote build still communicates with Real Studio, so you can access the debugger and test just as if you were running it locally.

To use the Remote Debugger, you need to configure it on both the development machine (where you use Real Studio) and the remote machine. For this example, the development machine is running OS X 10.7.3 and the remote machine is running Windows 7 Ultimate x86.

Remote Machine Configuration

On the remote machine, you need to run the Remote Debugger Stub.  If Real Studio is installed on the remote machine then you already have it. If not, you need to either install Real Studio on the remote machine or copy the Remote Debugger Stub from the development machine to the remote machine.

The Remote Debugger Stub is located in the Extras folder in the Real Studio application folder. Within Extras is a folder called "Remote Debugger Stubs" that contains the stubs for OS X, Windows and Linux.  Once you have the Windows Remote Debugger Stub on the remote machine, run "Remote Debugger Stub.exe". At this point, I also create a shortcut on the desktop (and pin it to the taskbar) so that I can access it quickly.

The Remote Debugger Stub has an Options window that lets you configure some settings.  In the General tab, you want to give the machine a name and select the Download location. You typically do not need to change the settings in the Networking tab.

Remote Debugger Options

After you have set the Options, click OK and leave the Remote Debugger Stub running.

Remote Debugger

If you are using a firewall on the remote machine, you need to make sure that port 44553 is open for UDP and TCP connections.

Development Machine Configuration

On the development machine, you need to configure Real Studio so that it can see the remote debugger stub. In the Preferences for Real Studio, select Debugger. There you'll see a list of configured remote machines.

Debugger Preferences in Real Studio

Click Add to add your remote machine. Depending on your network configuration, the remote machine may appear as an "auto-discovered remote machine". If it does, you can just click its name and then OK to add it. If it does not appear, you can enter the IP address (specified on the Remote Debugger Stub on the remote machine) and give it a name.

Adding a Remote Machine for Remote Debugging

If you are using a firewall on your development machine, you need to make sure that port 44553 is open for UDP and TCP connections and port 13897 is open for TCP connections.

Debugging Remotely

That is it for configuration. Now you can try running a project remotely. Using Real Studio on the development machine, create a new desktop project.

Choose Project->Run Remotely and click your remote machine name. Real Studio will compile and link the project as it usually does, but you will now see an additional step where it sends this debug build over to the Remote Debugger Stub on the remote machine.

When the Remote Debugger Stub has received the debug build, it runs it. Interact with it on the remote machine. Any breakpoints you have set will jump to the debugger on the development machine.

That's It!

Remote Debugging makes cross-platform development with Real Studio even easier than it already is. Of course you can remote debug between any platform, not just from OS X to Windows. You can go from Windows to OS X, OS X to Linux or any combination. You can even remote debug to the same platform, for example OS X to OS X. This is useful when you need to debug things that occur in Refresh or Paint events, which would be triggered when running everything locally on the same machine.

I'd also like to note that the remote machine does not need to be an actual physical machine.  VMware Fusion or Parallels Desktop can host virtual machines that work great with the Real Studio Remote Debugger.