swiftlang / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. This fork is used to manage Swift’s stable releases of Clang as well as support the Swift project.
https://llvm.org
Other
1.11k stars 328 forks source link

[SR-11745] lldb for Linux on Swift 5.1.2: warning: Swift error in fallback scratch context: error: missing required module 'CNIOAtomics' #4436

Open weissi opened 4 years ago

weissi commented 4 years ago
Previous ID SR-11745
Radar rdar://problem/57049271
Original Reporter @weissi
Type Bug
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | LLDB for Swift | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: d42a94e7c72c408358acd9932600609c

Issue Description:

Description

When running the following 1 liner (runnable from macOS (with Docker for Mac installed) or Linux) I get a warning.

cd /tmp && rm -rf swift-nio && git clone https://github.com/apple/swift-nio && cd swift-nio && git reset --hard f548a29a27d7e533f1714d2d282ca0d79f6086dd && docker run -it --rm -v "$PWD:$PWD" -w "$PWD" swift:5.1.2 swift build --build-tests && docker run -it --rm -v "$PWD:$PWD" -w "$PWD" --privileged swift:5.1.2 lldb  .build/debug/swift-nioPackageTests.xctest

which can also be broken into multiple lines:

cd /tmp
rm -rf swift-nio
git clone https://github.com/apple/swift-nio
cd swift-nio
git reset --hard f548a29a27d7e533f1714d2d282ca0d79f6086dd
docker run -it --rm -v "$PWD:$PWD" -w "$PWD" swift:5.1.2 swift build --build-tests
docker run -it --rm -v "$PWD:$PWD" -w "$PWD" --privileged swift:5.1.2 lldb  .build/debug/swift-nioPackageTests.xctest

once lldb is started, please type

(lldb) break set -f EventLoop.swift -l 857         # ignore the Unable to load module. warning
(lldb) run NIOTests.ChannelTests/testHalfClosure

Once lldb has hit the breakpoint, run

(lldb) po ev

and you'll see the output

warning: Swift error in fallback scratch context: error: missing required module 'CNIOAtomics'

note: This error message is displayed only once. If the error displayed above is due to conflicting search paths to Clang modules in different images of the debugged executable, this can slow down debugging of Swift code significantly, since a fresh Swift context has to be created every time a conflict is encountered.

Unable to load module.
Unable to load module.
▿ SelectorEvent<NIORegistration>
  ▿ registration : NIORegistration
    ▿ socketChannel : 2 elements
      ▿ .0 : SocketChannel { socket fd: 7, localAddress = Optional([IPv4]127.0.0.1/127.0.0.1:45650), remoteAddress = nil }
      ▿ .1 : SelectorEventSet
        - rawValue : 9
  ▿ io : SelectorEventSet
    - rawValue : 8

To be honest, I'm quite happy with this output, however the warning

warning: Swift error in fallback scratch context: error: missing required module 'CNIOAtomics'

is probably not good news if debugging something in CNIOAtomics.

weissi commented 4 years ago

@swift-ci create

weissi commented 4 years ago

CC @dcci / @adrian-prantl / friss (JIRA User)