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-9927] lldb Xcode 10.2 regression: failed to get module from AST context with a DBGSourcePathRemapping of ./ #4609

Closed
swift-ci opened this issue Feb 14, 2019 · 4 comments
Labels
bug Something isn't working LLDB for Swift

Comments

@swift-ci
Copy link

Previous ID SR-9927
Radar radar://48078809
Original Reporter Davidee (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Xcode 10.2, beta 1 and 2

Additional Detail from JIRA
Votes 0
Component/s LLDB for Swift
Labels Bug
Assignee None
Priority Medium

md5: 8cc3764088e38135d7e41b2d4797f6a5

Issue Description:

Before Xcode 10.2, a dSYM DBGSourcePathRemapping of `./` -> `source_dir` would work properly to remap paths in a given binary without impacting the loading of swift modules in lldb.

In Xcode 10.2, this is no longer the case. A dSYM DBGSourcePathRemapping of `./` -> `source_dir` breaks lldb's ability to load swift modules, which means that swift objects cannot be `po`'d.

See also rdar://47642498 as target.source-map seems to suffer from similar issues leading me to believe this is a general problem with relative path handling introduced into swift-lldb between Xcode 10.1 and Xcode 10.2.

Steps to Reproduce:

1) Unzip the attached xcodeproj

2) Open the attached xcodeproj in Xcode 10.2 (beta 2 or 1). Note that the DBGRemappingSwift target is the same as the DBGRemappingSwiftNoPrefixMap target besides the `-debug-prefix-map` that the DBGRemappingSwift target has (this flag was introduced in Swift 5)

3) Set a breakpoint on each main.swift line 15.

4) Run the DBGRemappingSwift target, observe that the breakpoint hits but `po terminal` fails.

5) Run the DBGRemappingSwiftNoPrefixMap target, observe that the breakpoint hits but `po terminal` fails.

6) Doing the same thing but with Xcode 10.1, the DBGRemappingSwiftNoPrefixMap can be debugged just fine (although the DBGRemappingSwift target won't build as it requires Swift 5).

7) If you modify the DBGRemappingSwiftNoPrefixMap target's `Create dSYM Remappings` `Run Script Phase` to change `./` to anything else, note that the target can then be debugged without any issue. Doing the same for the `DBGRemappingSwift` target breaks breakpoints since it relies on `-debug-prefix-map` and `DBGSourcePathRemapping` working together.

Results: (lldb) po terminal

Error while loading Swift module: DBGRemappingSwiftNoPrefixMap Debug info from this module will be unavailable in the debugger. error: warning: failed to get module 'DBGRemappingSwiftNoPrefixMap' from AST context error: in auto-import: failed to get module 'DBGRemappingSwiftNoPrefixMap' from AST context

@belkadan
Copy link

cc @adrian-prantl

@swift-ci
Copy link
Author

Comment by David Goldman (JIRA)

Looks like this has been fixed in Xcode 10.2 beta 4, although issues still remain with remapping -fmodulemap-file= flags.

@swift-ci
Copy link
Author

Comment by Nicholas Levin (JIRA)

David pinged me about verifying this issue.

With his suggestions, removing `SWIFT_FORCE_STATIC_LINK_STDLIB=YES` from the sample Xcode project settings and adding `${DEVELOPER_DIR}/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx` to runpath search paths, this seems to have been fixed in Xcode 10.2 beta 4.

DBGRemappingSwift-beta4.zip

@swift-ci
Copy link
Author

Comment by David Goldman (JIRA)

Resolved in Xcode 10.2 beta 4

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/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
Labels
bug Something isn't working LLDB for Swift
Projects
None yet
Development

No branches or pull requests

2 participants