Open swift-ci opened 5 years ago
cc @aciidb0mb3r, @adrian-prantl
@aciidb0mb3r This looks like the bug that swiftpm doesn't perform the -modulerwrap action and thus isn't linking in the debug info. Is there a JIRA ticket for that?
Not sure what is modulerwrap, do you mean this https://bugs.swift.org/browse/SR-3280 ?
That seems to refer to the same problem although it isn't very specific.
The correct way to build a debuggable program on Darwin is:
$ swiftc -g -c a.swift ...
produces a.o, a.swiftmodule
$ ld a.o -o a --add_ast_apth /path/to/a.swiftmodule
$ dsymutil a
this is optional
On Linux it is:
$ swiftc -g -c a.swift ...
produces a.o, a.swiftmodule
$ swiftc -modulewrap a.swiftmodule -o a.swiftmodule.o
wraps the swiftmodule in an ELF object
$ ld a.o a.swiftmodule.o -o a
In radar-land the bug is rdar://problem/46509520.
Thanks for the examples. That bug is tracking the work for Darwin. I'll use this bug for Linux.
Comment by JD Xie (JIRA)
So is there a work around for this now?
Yes, compiling manually / with a Makefile that ensures that the wrapped swiftmodule is linked with the binary as outlined by my example above.
Environment
OS: Ubuntu 16.04 64bit Swift version 5.0.1 (swift-5.0.1-RELEASE) Target: x86_64-unknown-linux-gnuAdditional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Package Manager | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 7776a2f54aef3e1e7d4cfa79901fb415Issue Description:
When debugging a swift binary with lldb, I got the following error when using `p` or `expression` command
And there is an issue related to this problem which was fired before, https://bugs.swift.org/browse/SR-85. `-g` option has been included in the compile command, I don't know why this problem happens again.
output of `swift build -c debug -v`