You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[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
Closed
swift-ci opened this issue
Oct 23, 2019
· 6 comments
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):
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).
The text was updated successfully, but these errors were encountered:
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.
Attachment: Download
Additional Detail from JIRA
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: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).
The text was updated successfully, but these errors were encountered: