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

[SR-11661] Source path remapping to find source code in LLDB debugging fails when using a UUID property list in a dSYM to specify a source path mapping #4558

swift-ci opened this issue Oct 23, 2019 · 6 comments
bug Something isn't working LLDB for Swift


Copy link

Previous ID SR-11661
Radar rdar://56671013
Original Reporter dylansturg (JIRA User)
Type Bug
Status Closed
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s LLDB for Swift
Labels Bug
Assignee @adrian-prantl
Priority Medium

md5: ad2672ca2e4bde6a334c6f51c87da01e

Issue Description:

Starting in the development snapshot toolchain from 10/3/19, LLDB incorrectly applies the source location mapping specified in a UUID plist in a dSYM using DBGSourcePathRemapping dictionary and/or DBGBuildSourcePath & DBGSourcePath. When remapping a relative source path, everything except the path's basename is discarded and the basename is appended to the entire prefix provided in the plist. This results in using the wrong paths for source code while debugging in LLDB: Xcode shows assembly instead of source code, breakpoints set in source code in Xcode are never hit, LLDB cannot display source code for the current frame, etc.

I created an iOS app using Xcode's "Single view app" template to demonstrate the issue, which is attached. I made 2 changes to the project's configuration:

  • Set debugging to use dSYM instead of just DWARF, to generate a dSYM.

  • Added -debug-prefix-map ${PROJECT_DIR} . to the other Swift flags, to use relative paths for sources in the debug info.

This app has the following directory structure:

  • SimpleApp/

    • AppDelegate.swift

    • Other unimportant files

In the dSYM, I created a UUID plist and added the following to remap the relative paths back to absolute paths on my system (the path is specific to where you place the project):


After generating the dSYM, I used dwarfdump to check the paths used to reference AppDelegate.swift, and correctly found ./SimpleApp/AppDelegate.swift.

When I debug the resulting app in LLDB, it's unable to find the source code. I used source info command to see if LLDB was finding the right file:

(lldb) source info

Lines found in module `SimpleApp

[0x0000000106b65b45-0x0000000106b65b70): /Users/dylansturg/playgrounds/SimpleApp/AppDelegate.swift:12:55

The correct path is /Users/dylansturg/playgrounds/SimpleApp/SimpleApp/AppDelegate.swift. The incorrect path is missing the directories before the basename of the file, but those directories were included in the path that I found in the debug info.

I used LLDB's target.source-map setting to apply the remapping, and that worked correctly on all tested toolchains. Apparently that setting is applied differently than the same remapping specified in the UUID plist in the dSYM.

I verified that this same setup works correctly when I use the default toolchain of Xcode 11.1 and the development snapshot from 9/30. I believe this a regression introduced sometime between the snapshot of 9/30 and the snapshot of 10/3. I verified that this issue is reproducible on the latest snapshot as of the time of filing (10/21).

Copy link

I'm not sure if this is Swift-specific at all, in which case it may be better to report at (or Apple Feedback Assistant).

Copy link

Comment by Dylan Sturgeon (JIRA)

I was able to repro this issue in an Objective-C only iOS app as well, so you're right that this isn't Swift-specific. Although it does represent a significant blocker to debugging Swift for me.

Copy link

This is hopefully the same bug I fixed in

Copy link

Can you try this again with a snapshot that has #272 in it? It's hard to predict exactly, but presumable 2019-11-13 or later should have it?

Copy link

Comment by Dylan Sturgeon (JIRA)

I tried it with the dev snapshot from 2019-11-13 and it is working. Thanks for the quick fix!

Copy link


@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from swiftlang/swift May 7, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
bug Something isn't working LLDB for Swift
None yet

No branches or pull requests

3 participants