Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
edudnyk opened this issue Dec 30, 2022 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. clang importer Area → compiler: The clang importer lldb

Comments

@edudnyk
Copy link

edudnyk commented Dec 30, 2022

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
@edudnyk edudnyk added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Dec 30, 2022
@hborla hborla added lldb clang importer Area → compiler: The clang importer and removed triage needed This issue needs more specific labels labels Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. clang importer Area → compiler: The clang importer lldb
Projects
None yet
Development

No branches or pull requests

2 participants