Debugging Cross-Platform Applications
Go Up to Cross-Platform Applications
Note: The new debugging solution described in this topic is the recommended solution for cross-platform application debugging. In this scenario, you use: old-style remote debugging solution is still supported, and can optionally be used to install and run the cross-platform debuggers, this usage is not currently documented.
The integrated RAD Studio debugger enables you to debug an application that targets any of the Supported Target Platforms. The integrated debugger works with both Delphi and C++ applications.
RAD Studio supports two cross-platform debuggers:
- Embarcadero Win64 Debugger (on a PC running a 64-bit Windows OS)
- Embarcadero OS X Debugger (on a Mac running a version of OS X)
When you install the Platform Assistant on your target platform, the cross-platform debuggers are installed as well. The debuggers that are registered on your system are listed in Tools > Options > Debugger Options.
Architecture of XE2 Cross-Platform Application Debugging
The Platform Assistant and a remote profile are required for establishing a debug session for an application running on a cross-platform target system. The only cross-platform configuration that does not require the Platform Assistant is a Win64 development system.
The cross-platform debugger and the debuggee process both run on the target platform. The cross-platform debugger reports status and interacts with you on the development PC in the RAD Studio IDE. This means that using one of the cross-platform debuggers is very similar to using the integrated debugger for Win32 applications. For high-level information about debugging, see Overview of Debugging.
Note about Remote Win32 Debugging: You can optionally continue to use the pre-existing (old-style) remote debugger for all remote debugging. Keep in mind, though, that you will need to manually copy files to the target platform, just as in the past. For instructions on using the old-style remote debugger, see Overview of Remote Debugging and related procedures. The old-style remote debugging solution can be used both for remote Win32 debugging (as before) and for cross-platform debugging of Win64 and Mac OS X applications. The help, however, does not yet give details about how to use the old-style remote debugger for cross-platform debugging.
Requirements for Cross-Platform Debugging
To do cross-platform debugging:
- Your application must have an activated target platform (Win64, OS X, or remote Win32).
- Depending on the target platform:
- For the Mac OS X:
- The Platform Assistant must be running on the Mac.
- Your application must have an assigned remote profile.
- Your development system must have a live connection to the Mac (that is, Test Connection must succeed on the Remote Profiles window). This enables you to use both the integrated debugger and the Deployment Manager.
- For 64-bit Windows:
- If you are connecting to a remote 64-bit PC:
- You must use the Platform Assistant and a remote profile.
- Your development system must have a live connection to the remote 64-bit PC (that is, Test Connection must succeed on the Remote Profiles window). This enables you to use both the integrated debugger and the Deployment Manager.
- If your development system is a PC running a 64-bit Windows operating system:
- You do not need to use the Platform Assistant because your debug environment is in-machine, and the integrated debugger runs automatically.
- You can, however, optionally choose to use the Platform Assistant and a remote profile for the target platform just as you would for a remote 64-bit Windows target system. Doing this enables you to use the Deployment Manager.
- If you are connecting to a remote 64-bit PC:
- For the Mac OS X:
Debugging with C++Builder 64-bit Windows
For C++ 64-bit Windows debugging, a few debugger features are not available. For more information, see "Debugger Notes" in the Readme (Release Notes).
On Mac OS X Platform, Debugger Needs File Permissions
Debugging on OS X is a privileged operation; only a process with adequate access rights can act as a debugger. In RAD Studio, this requirement is met by codesigning
dbkosx_16_0, the executable file that requires privileged access rights. In order to guarantee support for debugging on the Mac, you need to log in on the Developer Tools Access dialog box using the administrator or root user password:
- The first time you start the Platform Assistant in a session (or when you start a debugging session on the Mac), the Mac displays a login dialog for Developer Tools Access. You need to provide the password for the root user on that Mac. The password is required only once per session.
- For more information about the Acquiring permission to support debugging message, see To Run the Platform Assistant on a Mac.
- If you are using SSH or PuTTY, you might need to take an extra step in order to guarantee debugging access to your Mac applications:
- You might receive the following message on the Mac when you try to debug your application:
Error: file permissions do not allow debugging
- If you get this error message (or if the Developer Tools Access dialog appears repeatedly), you might cautiously decide to assign privilege to the debugger by setting the user ID of
dbkosx_16_0to root, as follows:
sudo chown root dbkosx_16_0
sudo chmod u+s,g+x dbkosx_16_0
Caution: Be aware that using these
sudocommands might present a significant security risk. We recommend that you take precautions: Keep a copy of the original
dbxosx_16_0file. After debugging your application, delete the
dbxosx_16_0file for which you set the uid root, and restore the original file.
Starting the Debugger with a 'Run' Command
When all the Requirements for Cross-Platform Debugging are met, entering the Run command does the following:
- Copies the necessary files between the host PC and the target platform specified in the remote profile
- Runs the application in the appropriate debugger as required for the platform.
For example, if OS X is the active target platform, the executable is copied to the Mac.
You can use any of the standard Run commands to start debugging a cross-platform application (for either OS X or Win64):
- Run > Run (F9) (compiles and runs the application in the integrated debugger)
- Run > Step Over (F8)
- Run > Trace Into (F7)
- Run > Run Until Return (Shift+F8)
- Run > Run To Cursor (F4)
Starting the Debugger with 'Attach to Process' and 'Load Process Local/Remote'
To run and debug a compiled binary on a target platform (either a remote PC or a Mac), you can use:
- Attach to Process to debug a running process that is either local or remote. Using the Platform Assistant and a remote profile is recommended here.
- Load Process Local to load a local debuggee process.
- Load Process Remote to load a debuggee process and run it on a remote target platform, with some restrictions regarding remote profiles. Using the Platform Assistant and a remote profile is recommended here.