Remote debugging in Delphi

by Radek Červinka 1. February 2011 23:24

Sometimes is good to debug directly on the client computer, because the development computer does not have the problem. Of course, in such cases is not appropriate (and often not even possible) to install Delphi on the client computer and for this cases Delphi offer the possibility of remote debugging. How to do?

I show remote debugging on Delphi 2010 (service pack 4 and 5 required - fixed some problems), but remote debugging is supported on old Delphi too - only difference is filenames (see below).

In first step install debugger support on target computer. You can download remote debugging support from Embarcadero or from Delphi directory copy this files (for Delphi 2010 - Delphi version 14, so for another version please use proper files - maybe can be stability problem with Delphi 2005 or 2006).

bccide.dll
bordbk140.dll
bordbk140N.dll
comp32x.dll
DCC140.dll
rmtdbg140.exe

Now register files with:

regsvr32 bordbk140.dll
regsvr32 bordbk140n.dll

Ok, so necessary tasks are done (this can be necessary only for first time) and start debugging.

On target computer start remote debugger (rmtdbg140.exe) - when started small icon is showed in tray (green bug).

Remote debugging tray

Now on project enable Remote debug symbols and Debug information. With first option compiler will create RSM files during compilation.

Remote options

Compiled binary file with rsm files copy on client computer. In menu Run select Load Process

Remote debugging start

… and in Remote tab fill fields (see screenshot - directories are from target computer).

Remote debugging

Now only click on Load and if everything is good, program will stop on first line of program (probably on first line in dpr file) and you can set breakpoints or everything like during normal debugging. And this is all.

When problems with communication try for example ping (and check firewall or stupid anti viruses and so on).

Update: simple demo - download

Update: maybe for some windows configuration remote debugging working only when everything is in same directory

Tags: , , ,

Practices

Comments

2/16/2011 5:17:26 PM #

Brian Frost

This looks really good, I've followed your instructions but I just cannot get it to stop on a breakpoint - they always go disabled. Could you take a look at:

http://stackoverflow.com/questions/5018147/delphi-2010-remote-debugging-unable-to-get-breakpoints-working

and maybe see what I am doing wrong?

Brian Frost |

2/16/2011 10:30:06 PM #

radekc

I don't know, this is tested with D2010. But I don't download files from EDN, only copied from install dir and did manual install. Maybe install under admin rights?

radekc |

2/16/2011 11:03:33 PM #

Brian Frost

Thanks for that, I tried manual install too as you suggested and all running has been done as admin and with UAC off.

Brian Frost |

2/27/2011 10:27:35 AM #

Javin @ Tibco Tutorials

Nice article ,Remote Debugging was the single most feature which is very useful while developing larget enterprise application, specially
if your applicaiton is live and you don't have proper development environment setup in your dev box.

Thanks
Javin

Javin @ Tibco Tutorials |

3/30/2011 12:16:57 PM #

Brian Frost

Well, for me the problem has now been solved, although as a 'work around' and after significant interaction with Embarcadero and an upgrade to XE (which also did not work).

It would appear that the remote debugger is flaky (or possibly just picky) in its ability to load rsm (remote symbols) files - they are still looking into why mine wont load. My rsm file is big at around 50Mb although this is no problem for Delphi 7's remote debugger.

The work around involved upgrading to Delphi XE and then choosing the compiler link option 'Place Debug Information in separate TDS file'. This seems to create a tds file onthe remote target instead of a rsm file and breakpoints then work fine.

I've submitted my rsm and tds files to Embarcadero for investigation as to why this happens.

Brian Frost |

4/1/2011 2:32:10 PM #

Jean-Pierre Jacques

I have exactly the same problem as Brian. The break points are always disabled. I tried everything but it's always the same.

Jean-Pierre Jacques |

4/2/2011 7:22:53 PM #

Brian Frost

@Jean Pierre: Did you try the work-around above with tdb format symbols?

Brian Frost |

4/4/2011 12:24:01 PM #

Jean-Pierre Jacques

No, because I have only D2010. I contacted Embarcadero, but I'm still waiting their reply.

Jean-Pierre Jacques |

4/12/2011 11:16:56 AM #

Jean-Pierre Jacques

Hello everybody,
For me, the problem is find. A bad Windows XP on distant PC prevents load RSM file by Remote Debugger. There is no error message in Remote Debugger, but no debugging possible on local PC. After a new windows installation Remote Debugger work.

Jean-Pierre Jacques |

Comments are closed