Attaching a debugger to `swift test`?

I have a Swift package with hundreds of XCTestCases. I have loaded the
package in Xcode and configured tests for Debug builds.

For some reason not all of the breakpoints that I set in my package
are reliable. The Xcode debugger appears to pause momentarily at some
breakpoints before it enters the "Waiting to attach" state. After a
second or two, I see more console output from the tests. In the log
I see that the tests exited with -1 in some test that is far from the

Does this ring a bell with anyone?

I would like to get a little closer to the problem by avoiding Xcode.
If I run the tests from Terminal with swift test (which is my custom),
apparently there is a way to attach lldb, but I have not been able to
get it to work. The instructions I have found suggest starting lldb
and running process attach -w -n NAME where NAME is the process name
that swift test starts my unit tests under. I have not been able to
figure the right name out—swift test is pretty opaque—and lldb
never attaches to any process. Any suggestions?