Skip to content

Debugger terminates immediately after app launch on physical iOS device #114

@Lieutenant-K

Description

@Lieutenant-K

Hi. I have discovered that when building and running an iOS app on a physical device, the debugger terminates immediately. The issue does not occur when using the iPhone simulator. Are there any known compatibility issues between Cursor AI, CodeLLDB, and Sweetpad when debugging on physical iOS devices? Or, Are there any specific settings or configurations required for debugging on physical devices that differ from simulator debugging?

Description

When attempting to install, run, and debug an iOS app on a physical device using Cursor AI editor with CodeLLDB and Sweetpad plugins, the app builds and launches successfully, but LLDB terminates immediately after the app starts running. This issue does not occur when using the iPhone simulator, where LLDB functions normally.

Steps to Reproduce

  1. Install CodeLLDB and Sweetpad plugins in Cursor AI editor.
  2. Set up an iOS project for debugging on a physical device.
  3. Build and run the app on the device.
  4. Observe that the app launches, but LLDB terminates shortly after.

Expected Behavior

LLDB should remain active and allow debugging on the physical iOS device, similar to its behavior on the iPhone simulator.

Actual Behavior

LLDB terminates immediately after the app launches on the physical device, preventing any debugging capabilities.

Environment

  • Cursor AI Editor Version: 0.45.11
  • VSCode Version: 1.96.2
  • Sweetpad Version: 0.1.51
  • CodeLLDB Version: 1.11.3
  • Xcode Version: 16.2
  • iOS Device: iPhone 13 Pro, 17.6.1
Terminal message after build success
Build Succeeded

🚀 Executing command:
xcrun devicectl device install app --device {device}/Users/{user}/Library/Developer/Xcode/DerivedData/MyApp-fuwrfbvmcckczfhjosrgspqbqihc/Build/Products/Debug-iphoneos/MyApp.app

16:32:31  Acquired tunnel connection to device.
16:32:31  Enabling developer disk image services.
16:32:31  Acquired usage assertion.
5%... 10%... 24%... 25%... 27%... 30%... 35%... 36%... 37%... 44%... 46%... 48%... 49%... 50%... 51%... 52%... 53%... 54%... 55%... 56%... 57%... 60%... 62%... 66%... 68%... 72%... 74%... 76%... 80%... 84%... 88%... 92%... 96%... Complete!
App installed:
? bundleID: {appId}
? installationURL: file:///private/var/containers/Bundle/Application/{directory}/MyApp.app/
? launchServicesIdentifier: unknown
? databaseUUID: {uuid}
? databaseSequenceNumber: 12936
? options: 

🍭 Sweetpad: watch marker (start)
🍩 Sweetpad: watch marker (end)

🚀 Executing command:
xcrun devicectl device process launch --console --json-output '/Users/{user}/Library/Application Support/Cursor/User/workspaceStorage/a78760739926debf1c42fbbbd1e191d4/sweetpad.sweetpad/_temp/json_c36d557d' --terminate-existing --device {device}{appId}
Debug Console
Could not initialize Python interpreter - some features will be unavailable (e.g. debug visualizers).
Console is in 'commands' mode, prefix expressions with '?'.
Executing script: initCommands
  Platform: remote-ios
 Connected: no
  SDK Path: "/Users/{Name}/Library/Developer/Xcode/iOS DeviceSupport/iPhone14,2 17.6.1 (21G93)"
 SDK Roots: [ 0] "/Users/{Name}/Library/Developer/Xcode/iOS DeviceSupport/iPhone14,2 17.6.1 (21G93)"
 SDK Roots: [ 1] "/Users/{Name}/Library/Developer/Xcode/iOS DeviceSupport/iPhone14,2 18.0 (22A3354)"
 SDK Roots: [ 2] "/Users/{Name}/Library/Developer/Xcode/iOS DeviceSupport/iPhone14,2 17.4.1 (21E236)"
 SDK Roots: [ 3] "/Users/{Name}/Library/Developer/Xcode/iOS DeviceSupport/iPhone14,2 17.5.1 (21F90)"
 SDK Roots: [ 4] "/Users/{Name}/Library/Developer/Xcode/iOS DeviceSupport/iPhone14,2 18.1.1 (22B91)"
 SDK Roots: [ 5] "/Users/{Name}/Library/Developer/Xcode/iOS DeviceSupport/iPhone14,2 18.1 (22B83)"
 SDK Roots: [ 6] "/Users/{Name}/Library/Developer/Xcode/iOS DeviceSupport/iPhone14,2 18.0.1 (22A3370)"

warning: (arm64) /Users/{Name}/Library/Developer/Xcode/DerivedData/MyApp-fuwrfbvmcckczfhjosrgspqbqihc/Build/Products/Debug-iphoneos/MyApp.app/MyApp empty dSYM file detected, dSYM was created with an executable with no debug info.
Executing script: preRunCommands
True
True

Executing script: processCreateCommands
Attached to process 2114
Process exited with code -1.
LLDB Output
Launching adapter
liblldb: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB
environment: {}
settings: { evaluateForHovers: true, commandCompletions: true }
[ERROR codelldb] Initialize Python interpreter: Error:  Fail
    Error Message:
    error: module importing failed: Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "[EXTENSION_PATH]/codelldb/__init__.py", line 1, in <module>
        from .api import evaluate, wrap, unwrap, get_config, create_webview, display_html, debugger_message
      File "[EXTENSION_PATH]/codelldb/api.py", line 6, in <module>
        from . import interface
      File "[EXTENSION_PATH]/codelldb/interface.py", line 322, in <module>
        current_exec_context: lldb.SBExecutionContext | None = None
    TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
    
warning: (arm64) [BUILD_PATH]/MyApp.app/MyApp empty dSYM file detected, dSYM was created with an executable with no debug info.
Debug adapter exit code=0 (0x0), signal=null.

launch.json
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "sweetpad-lldb",
            "request": "attach",
            "name": "Attach to running app (SweetPad)",
            "preLaunchTask": "sweetpad: launch"
        }
    ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions