Delphi – How to remote debug a Win32 VCL application built with runtime package

delphidelphi-xe2remote-debugging

I wrote a simple VCL win32 application that has the following code:

procedure TForm5.Button1Click(Sender: TObject);
begin
  ShowMessage('bingo');
end;

I compiled the application with runtime packages and has turn on the following switches:

  1. Debug Information -> true
  2. Include remote debug symbol -> true
  3. Assertion, debug information, local smbols, use debug dcus -> true

The output has the following files:

  1. Project1.exe
  2. project1.rsm

The two runtime packages are:

  1. vcl160.bpl
  2. rtl160.bpl

I set a break point in Button1Click handler, the local IDE debugger will stop there if I run the
application in debugger mode.

Next, I want to try remote debug the application with runtime packages.

I assign remote profile to the 32-bits windows platform. The test connection works with the remote profile. PAServer was started too in remote machine. I can notice 4 files were copied to remote machine when attempt to run the application with Delphi XE2 IDE debugger:

  1. Project1.exe
  2. project1.rsm
  3. vcl160.bpl
  4. rtl160.bpl

However, the event log shows:

Module Load: Project1.exe. No Debug Info. Base Address: $00400000. Process Project1.exe (1676)

As the module doesn't has debug info, all breakpoint will fail to trigger.

I have tried build single file .exe application without runtime packages. The same remote debugger steps work and I can debug application remotely.

What has make the remote debugging fail with application built with runtime packages?

Best Answer

It looks like you have to additionaly deploy '.dcp' files corresponding to used runtime packages.

From Debugger Notes (Release Notes for XE2):

Ensure Debug Information by Adding .dcp Files to Application Deployment

If your Delphi application links with run-time packages, the expected debug information might not be generated. This is true for Mac OS X applications and for remote Win64 or remote Win32 applications. The workaround is to use the Deployment Manager to add the .dcp files that correspond to the run-time packages in your run-time package list. For instance, if you are using rtl, you must deploy the rtl.dcp file.

Use the .dcp files located in the Embarcadero\Rad Studio\9.0\lib directories, as follows:

  • For an OS X application: Embarcadero\Rad Studio\9.0\lib\osx\release
  • For a remote 64-bit Windows application: Embarcadero\Rad Studio\9.0\lib\win64\release
  • For a remote 32-bit Windows application: Embarcadero\Rad Studio\9.0\lib\win32\release
Related Topic