Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi 2010 remote debugging - unable to get breakpoints working

I recently posted this question about my inability to get Delphi 2010 working with remote debugging. I have not had any success and decided to post up a simple step-by-step test technique that might highlight what I'm doing wrong. THIS IS REALLY IMPORTANT to me - I've used Delphi since V1.0 and earn my living from it. Being stuck like this is a pain and its keeping me on Delphi 7.

Anyway, here goes.

  1. Ensure that Delphi 2010 has updates 4&5.

  2. Fire up Delphi 2010, then File | New | VCL Forms App. Put a button on the form, put 'ShowMessage( 'hello' ) in the button OnClick event. Save the project and its unit in a local folder "C:\scratch". Build the project, run it, click the button, 'hello' appears, all fine.

  3. On a networked PC (194.168.1.64), create a new folder "c:\DebugTest" and share it with R/W access.

  4. On 194.168.1.64 install the Remote Debugger from the latest download on the Embarcadero Website (RemoteDebugger_upd2.exe). CLick rmtdbg140.exe to run. Accept the 'un-block' message from the firewall.

  5. Edit the DEBUG build configuration compiler settings with Output directory=\192.168.1.64\DebugTest and unit output directory = c:\scratch - see Compiler settings

  6. Edit the Linking settings to set Debug Information=True, Include remote debug symbols=True. See Linking settings

  7. Leave compiling settings at defaults. See Compiling settings

  8. Do a full build. The relevant project exe 'project2.exe' and 'project2.rsm' appear in the remote folder \192.168.1.64\DebugTest. Blue dots are visible in Unit2 in the IDE.

  9. Set a breakpoint on the 'ShowMessage' line (the button OnClick event).

  10. Use 'Run' | 'Load Process' with Remote path=c:\DebugTest\Project2.exe, Remote Host=192.168.1.64 and Working directory=c:\DebugTest see Load Process remote tab

  11. Click 'Load'. The visible breakpoint is immediately disabled, the project starts running and opens the CPU window and stops. Pressing f9 cause the exe to run fully on the remote machine, the button works, you just cannot debug it.

I've tried various 'obvious' things like firewall off but all to no avail. Could some kind person suggest further ideas?

Many thanks.

like image 842
Brian Frost Avatar asked Feb 16 '11 15:02

Brian Frost


People also ask

How do you use breakpoints in Delphi?

To set a data breakpointRun your application in Debug mode (for example, use F9, F8, F7, or F4). Choose Run > Add Breakpoint > Data Breakpoint to display the Add Data Breakpoint dialog box. In the Address field, enter the address of the data you want to function as the data breakpoint.

How do I enable remote debugging?

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 you Debug a break point?

To set a breakpoint in source code: Click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.

How do I Debug Delphi code?

Debugging delphi source files You need to go to "project->options->compiler" on this tab you need to check the "use debug DCUs". After that you need to build your project again and you can run your application. From now on breakpoints also stop in Delphi source files.


2 Answers

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.

like image 179
Brian Frost Avatar answered Oct 22 '22 13:10

Brian Frost


What Windows OS? Maybe run rmtdbg140.exe as admin.

I run D2010 remote debugging on XP versus XP. My How-To is at http://blog.runbits.com/post/Remote-debugging-Delphi.aspx

like image 30
netcodecz Avatar answered Oct 22 '22 14:10

netcodecz