Skip to content

[lldb] It doesn't seem possible to achieve deterministic debuggable builds when using ClangImporter #62793

Open
@edudnyk

Description

@edudnyk

Description

The binary output of swift compilation (arm64-apple-ios-simulator.swiftinterface files) contain the information about include paths, in the format of absolute paths.

There is no way to remap these paths to different location for lldb when using ClangImporter (by compiling with the linker option -add_ast_paths /Path/To/MyModule/arm64-apple-ios-simulator.swiftinterface).

Steps to reproduce

  1. Unpack lldb-playground.zip into two locations (/Path/To/Location1, /Path/To/Location2).
  2. Open project from /Path/To/Location1.
  3. Build for iOS simulator.
  4. Create ~/.lldbinit file with these contents:
settings set target.source-map /var/fake_src_dir /Path/To/Location2
  1. Open project from /Path/To/Location2.
  2. Copy the contents of $BUILT_PRODUCTS_DIR folder of project on /Path/To/Location1 into the $BUILT_PRODUCTS_DIR folder of project on /Path/To/Location2.
  3. Close project /Path/To/Location1, keep working now with the project on /Path/To/Location2.
  4. Delete /Path/To/Location1 or move/rename to some other location.
  5. Place breakpoint in LibWithObjcSwiftObject.swift:9
  6. Set custom LLDB Init file for App scheme to ~/.lldbinit in the scheme settings.
  7. In Xcode, select Product -> Perform Action -> Run Without Building
  8. When debugger hits the breakpoint, invoke po self in the debugger console.

Expected behavior
po self command succeeds, the debugDescription of the object gets printed.

Actual behavior
The error gets printed

warning: /Users/admin/Library/Developer/Xcode/DerivedData/App-aqaccfqqqxedzacxtukhhfcudtbr/Build/Products/Debug-iphonesimulator/App.app/App: Cannot load Swift type information: error: virtual filesystem overlay file '/Path/To/Location1/lldb-playground/buck-out/gen/_p/lZ4mh4iH1C-pub/objc-module-overlay.yaml' not found
error: virtual filesystem overlay file '/Path/To/Location1/lldb-playground/buck-out/gen/_p/lZ4mh4iH1C-pub/objc-module-overlay.yaml' not found

Environment

  • Swift compiler version info
swift-driver version: 1.62.15 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
Target: arm64-apple-macosx13.0
  • Xcode version info
Xcode 14.2
Build version 14C18
  • Deployment target: iOS 16.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.clang importerArea → compiler: The clang importerlldb

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions