Delphi Programming

Using the Remote Debugger with Delphi 2010[]

Delphi 2010 is not able to load debug informations from remote files by default. You need to apply updates 4 & 5 to fix this.

Take a look on the release notes for this issue : [[1]]

Using the Remote Debugger with Delphi 2007 and Delphi 2009[]

The following instructions have been tested in Delphi 2007 and Delphi 2009: A similar process is known to work in Delphi 7.0. Remote debugging is considered unusable in Delphi 2005 and 2006.

On the Target Machine[]

Startup remote debug.jpg

First Time Only: You need to insert your Delphi 2007 or 2009 product DVD on the target machine, or copy the "Remote Debugger Installer" files onto your network, and run them from there. Once you have the target machine configured (remote debugger installeed), go to C:\Program Files\Remote Debugger and double click on rmtdbt105.exe (delphi 2007), or rmtdbg120.exe (delphi 2009). Later on, I recommend that you run with the "-listen" command line parameter. You could create a batch file (remotedebugger.cmd) containing the following line:

rmtdbg120.exe -listen

To get the EXE file that Delphi builds onto your target machine, so you can load it using the remote debugger, we suggest you share the Target computer's C Drive, using Windows File Sharing, then use the Windows Explorer "Tools ->Map as Network drive" command, on your developer box. For example, you could make the C: drive from your test machine map as Q: on your developer box.

When you share the C: drive on your target machine, be sure to make it writeable, for only your particular user account+password combination. Do not use the "Everyone" permission, unless you want to invite your IT department to come over and introduce you to their new security policy documents.

If your EXE file needs any configuration files, or some setup on the remote machine before you first run the software, you should do that step next. To configure any runtime environment (consider registry settings, COM/DCOM OLE or ActiveX object registrations, other configuration files, etc). For example, I often make a folder C:\Program Files\DebugApp, and copy all configuration and data files over there.

When the remote debugger is running, you should see something like the picture shown at the top of this section, on your Target machine: (the <-listen> part is very important!). If you have done everything in this section, move to the next section now.

On the Target Machine (Rad Studio 2009 ESD version)[]

If you have a Rad Stuido 2009 ESD (download) edition, you don't have the remote debugger installer. However it is complete enough to do remote debugging:

Copy the follow files from your D2009 installation directory to the target machine:

  1. bccide.dll
  2. bordbk120.dll
  3. bordbk120N.dll
  4. comp32x.dll
  5. DCC120.dll
  6. rmtdbg120.exe

Then register the relevant DLLs by issueing

regsvr32 /s bordbk120.dll
regsvr32 /s bordbk120n.dll

on the cmdline , then use (like when using the installer)

rmtdbg120 -listen 8000

to start the remote debugging process

At least this worked on my Rad Studio 2009 ESD edition, repeated several times with various (XP,Vista,D2009) targets.

On your local Delphi developer machine[]

In your Delphi Project Options dialog box, you can change your EXE output folder. This saves you lots of time manually copying the EXE file after you build it. If the target's C drive is mapped as drive Q: for your developer machine, change the options of your project to output to Q:\Program Files\DebugApp folder, so that after compilation, the EXE ends up right at the place the remote debugger will expect it to be, on the target machine.

Make sure the Remote Debug Symbols option is checked in the Linker options in the Project Options.

Delphi project options remote debug2.jpg

Rebuild the app so that the executable file is now built with the correct options and is now present on your your remote machine.

In Run menu, select select Load Process. Now click Remote (the second item in the Load Process listview on the left side of the load process dialog). Now fill out the two boxes called remote path, remote host, and optionally, working directory. All these are paths as seen on the remote machine. So for the remote machine's main hard drive, use C: as the path. The first item (remote path) is the name of the EXE file on the server. If you mapped your remote drive as Q above, and the path was Q:\FOO\BAR.EXE, you would type C:\FOO\BAR.EXE in this box. The second item (remote host) is an ip address or dns resolveable hostname, such as 192.168.0.xx or

The remote path (and exe file name) must exist. The working directory also must exist.

Click Load button (leftmost button on bottom row of buttons in Load Process dialog). Run load process remote debugger.jpg

You are now debugging remotely. You should see the debugger highlighting the first source code line in the application initialization code. Assuming everything worked, and there's no firewalls, network problems, etc etc.

One Tip[]

I also like to use VNC Client and VNC Server to remote-desktop into my target debug machine, from the host machine I'm debugging on, when remotely debugging a GUI program.

Some of this came from a newsgroup posting by Warren Postma, later updated by User:Warren.postma, for Delphi 2009.