Debugging Multi-Device Applications

From RAD Studio
Jump to: navigation, search

Go Up to Multi-Device Applications

Architecture of Multi-Device Application Debugging

Debugging macOS Applications

To debug macOS Applications, complete the following steps:

In Project Manager:

  1. Add or Activate Target Platform (macOS 64-bit and macOS ARM 64-bit)
  2. Assign Connection Profile following this path: Tools > Options > Deployment > Connection Profile Manager, and specify the following:
    • Platform
    • Hostname
    • Port number
    • Password (optional)
  3. Go to Tools > Options > Deployment > SDK Manager, and add the SDK version.

In the Platform Assistant Server (PAServer):

  1. Make sure that PAServer launches the remote debugger for macOS.
Note: For debugging on the macOS 64-bit and macOS ARM 64-bit target platforms, a few traditional debugger features are not available. For details about developing macOS apps, see macOS Application Development.

Debugging iOS Apps

To debug iOS Applications, complete the following steps:

In Project Manager:

  1. Add or Activate Target Platform (iOS Device 64-bit)
  2. Assign Connection Profile following this path: Tools > Options > Deployment > Connection Profile Manager, and specify the following:
    • Platform
    • Host name
    • Port number
    • Password (optional)
  3. Go to Tools > Options > Deployment > SDK Manager, and add the SDK version.

In the Platform Assistant Server (PAServer)

  1. Make sure that PAServer launches the remote debugger for iOS.
  2. Check iOS apps are provisioned and code signed during development.

On iOS Device:

  1. Connect the device to the Mac.
Note: For debugging on the iOS Device 64-bit target platform, a few traditional debugger features are not available. For more information, see Debugging iOS Apps. For details about iOS app development, see iOS Mobile Application Development.

Debugging Android Applications

Before debugging Android Applications in RAD Studio consider preparing your Android Development environment.

Debugging Linux Applications

To debug Linux Applications, complete the following steps:

In Project Manager:

  1. Add or Activate Target Platform (Linux 64-bit)
  2. Assign Connection Profile following this path: Tools > Options > Deployment > Connection Profile Manager, and specify the following:
    • Platform
    • Host name
    • Port number
    • Password (optional)
  3. Go to Tools > Options > Deployment > SDK Manager, and add the SDK version.

In the Platform Assistant Server (PAServer)

  1. Make sure that PAServer launches the remote debugger for Linux.
Note: For debugging on the Linux 64-bit target platforms, a few traditional debugger features are not available. For details about developing Linux apps, see Linux Application Development.

The RAD Studio Integrated Debugger

The integrated RAD Studio debugger enables you to debug an application that targets any of the Supported Target Platforms.

RAD Studio supports the following debuggers, all of which run on the specific target platform:

  • Embarcadero Windows 32-bit Debugger - for Windows 32-bit applications.
  • Embarcadero Windows 64-bit Debugger for Delphi - for Windows 64-bit Delphi applications.
  • Embarcadero Windows 64-bit LLDB Debugger for C++ - for Windows 64-bit C++ applications.
  • Embarcadero Linux 64-bit Debugger - for Linux 64-bit applications.
  • Embarcadero iOS Device 64-bit Debugger - for iOS 64-bit applications compiled for iOS devices.
  • Embarcadero Android 32-bit Debugger - for Android 32-bit applications compiled for Android 32-bit target platforms.
  • Embarcadero Android 64-bit Debugger - for Android 64-bit applications compiled for Android 64-bit target platforms.
  • Embarcadero macOS 64-bit Debugger - for macOS 64-bit applications.
  • Embarcadero macOS ARM 64-bit Debugger - for macOS and iOS Simulator ARM 64-bit applications.

The appropriate Embarcadero debuggers are installed when you prepare your development environment as described in the help. For example, when you follow the steps for macOS Application Development, Platform Assistant and the RAD Studio macOS debugger are installed on your Mac.

Note: Extra shared libraries are loaded in the iOS64 debugger, these shared libraries are controlled by the debugger and can be ignored. Some such libraries are:
  • __lldb_apple_objc_v2_get_dynamic_class_info
  • __lldb_caller_function
  • __lldb_apple_objc_v2_get_shared_cache_class_info
  • __lldb_caller_function
Note: In the iOS64 debugger, you may notice extra threads running. These extra threads are controlled by the debugger and can be ignored.
Note: The new debugging solution described in this topic is the recommended solution for multi-device application debugging for macOS, iOS, Android, and 64-bit Windows (from a 32-bit Windows development system). In this scenario, you use the specific multi-device debugger (running on the target platform) along with the integrated debugger in the IDE. Although the legacy old-style remote debugging solution is still supported, and can optionally be used to install and run the multi-device debuggers, using the old-style remote debugging solution for multi-device applications is not currently documented.
Note: With Remote Win32 Debugging, you can optionally continue to use the pre-existing (old-style) remote debugger for all desktop 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 debugging of Win64 and macOS applications. The help, however, does not yet give details about using the old-style remote debugger for multi-device debugging.
Note: When attempting to launch a 64-bit Android application on a 32-bit Android device, instead of an error message notifying the incompatibility, you will get the following message: Unable to start LLDB kernel: ‘./lldb-server[17]: syntax error: unexpected ‘)’.
Note: If you encounter issues debugging, our Support team may ask for debugger logs. You can read how to enable the debugger logs for RAD Studio debuggers.

Requirements for Multi-Device Debugging in RAD Studio

  • For an application running on either a macOS 64-bit, iOS Device - 64 bit target platform, the Platform Assistant and a connection profile are required for establishing a debug session.
    The Android target platform and in-system Win64 target platform do not require either the Platform Assistant or a connection profile.
  • Some target platforms require that you add an SDK in the IDE, as described in the next section Requirements for Multi-Device Debugging.

Typically, both the debugger and the process being debugged run on the target platform. This is true of the iOS Device and the Android Device. But in every case, the debugger reports status and interacts with you on the development PC in the RAD Studio IDE. This means that using one of the multi-device debuggers is very similar to using the integrated debugger for Win32 applications. For common high-level information about debugging, see Overview of Debugging.

To do multi-device debugging:

  • Your application must have an activated target platform:
    • 64-bit Windows (from a 32-bit Windows development PC)
    • macOS
    • iOS
    • Android (Android device)
    • Remote 32-bit or 64-bit Windows.
  • Depending on the target platform:
    • For the macOS and iOS platforms:
      Note: You do not have to provision and code sign macOS applications.
      • Your development system must have a live connection to the Mac (that is, Test Connection must succeed on the Connection Profile Manager window).
        This connection enables you to use both the integrated debugger and the Deployment Manager.
      • In addition, for the iOS Device platform, a provisioned iOS device must be connected by USB cable to the Mac.
      Note: You cannot use the integrated debugger to debug an iOS app compiled with the Application Store platform configuration.
    • For the 32-bit Windows platform:
      • You do not need to use the Platform Assistant because your debug environment is in-machine, and the integrated debugger runs automatically. However, if you wish to remote debug a 32-bit Windows application, you need to set the Include remote debug symbols option in Project > Options > Delphi Compiler > Linking to True.
    • For the 64-bit Windows platform:
      • If you are connecting to a remote 64-bit PC:
        • You must use the Platform Assistant and a connection profile.
        • Your development system must have a live connection to the remote 64-bit PC (that is, Test Connection must succeed on the Connection Profile Manager window). This connection 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 connection profile just as you can for a remote 64-bit Windows target system. Doing this enables you to use the Deployment Manager.
    • An SDK is required (on the SDK Manager) for the following platforms and application types:
      • FireMonkey Delphi multi-device applications for the iOS Device - 64 bit platform
      • FireMonkey Delphi multi-device applications for the Android platform

Debugging with C++Builder 64-bit Windows

For C++ 64-bit Windows debugging, a few debugger features are not available.

For more information, see Debugging C++Builder 64-Bit Windows Applications.

Starting the Debugger with a 'Run' Command

When all the Requirements for Multi-Device Debugging are met, entering the Run command does the following:

  • Copies the necessary files between the host PC and the target machine specified in the connection profile.
  • Runs the application in the appropriate debugger as required for the platform.

For example, if macOS 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 multi-device application (for either macOS 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)
    Note: Run to Cursor is not supported for launching the debugger on the Android platform.

Starting the Debugger with 'Attach to Process' and 'Load Process Remote'

To run and debug a compiled binary on a machine running the Platform Assistant server (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 connection profile is recommended here. Some platforms are not supported, as indicated in the Attach to Process dialog box.
    Note: Attachment to a running process is not supported for the Embarcadero Linux 64-bit Debugger, Embarcadero iOS Device 64-bit Debugger, Embarcadero Android 32-bit Debugger, Embarcadero Android 64-bit Debugger, Embarcadero macOS 64-bit Debugger, and Embarcadero macOS ARM 64-bit Debugger.
  • Load Process Local to load a local debuggee process.
    Note: Load Process Local is not supported for the Embarcadero Linux 64-bit Debugger, Embarcadero iOS Device 64-bit Debugger, Embarcadero macOS 64-bit Debugger, and Embarcadero macOS ARM 64-bit Debugger.
  • Load Process Remote to load a debuggee process and run it on a remote machine, with some restrictions regarding connection profiles. Some platforms are not supported, as indicated in the Load Process Remote dialog box.
    Note: Load Process Remote is not supported in Embarcadero Android 32-bit Debugger and Embarcadero Android 64-bit Debugger.
    Using the Platform Assistant and a connection profile is recommended here.

Timing Issues with Load Process

If you have problems debugging a macOS app that crashes immediately after you run it using Load Process, you should select either the Do not run option or the Run to entry point option (choices under "After load"). Either option can solve the timing issues concerning when the app runs and hits debug events, versus when the debugger is set up and ready to handle the events. These timing issues can cause the debugger to hang.

See Also