Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 686
Chau Chee Yang Avatar asked May 09 '12 06:05

Chau Chee Yang


People also ask

How do I set up remote debugging?

Set up the remote debugger. On the remote computer, find and start the Remote Debugger from the Start menu. If you don't have administrative permissions on the remote computer, right-click the Remote Debugger app and select Run as administrator. Otherwise, just start it normally.

How do I debug a remote process in Visual Studio?

You can attach the Visual Studio debugger to a running process on a local or remote computer. After the process is running, select Debug > Attach to Process or press Ctrl+Alt+p in Visual Studio, and use the Attach to Process dialog to attach the debugger to the process.

How do you debug an application on a server?

Using a browser, open the administration console of the remote application server. Expand the Servers node and click Application Servers. Click the name of the server to open the application server properties. Click Debugging Service.

How do I debug Azure App Service?

In Solution Explorer, right-click the project, and click Publish. In the Profile drop-down list, select the same profile that you used in Create an ASP.NET app in Azure App Service. Then, click Settings. In the Publish dialog, click the Settings tab, and then change Configuration to Debug, and then click Save.


1 Answers

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
like image 54
Sertac Akyuz Avatar answered Oct 17 '22 14:10

Sertac Akyuz