Debug local stack frame variables fails - Failed to get module 'Builtin' from AST context

It happened in a big project that I can not share. Are there any clues what I should check in the project?

We found the reason and the reason is this bug

Was this bug resolved?

I just upgraded to the 5.1 toolchain and the debugger seems busted. To absolve may own code I downloaded the Playing Cards example. It builds without incident, and I can run

$ .build/debug/Dealer

But using the debugger leads to this sequence:

$ lldb .build/debug/Dealer
(lldb) break set -l 18
(lldb) process launch
Target 0: (Dealer) stopped.
(lldb) n
Process 8390 stopped

  • thread #1, name = 'Dealer', stop reason = step over
    frame #0: 0x0000555555557aa2 Dealer`main at main.swift:20:17
    17
    18 let numberOfCards = 10
    19
    -> 20 var deck = Deck.standard52CardDeck()
    (lldb) po numberOfCards
    error: warning: failed to get module "Dealer" from AST context

I am running Ubuntu 18.04.1, and have swift and lldb referenced from same toolchain:
$ which swift
/home/microway/swift-5.1-RELEASE-ubuntu18.04/usr/bin/swift
$ which lldb
/home/microway/swift-5.1-RELEASE-ubuntu18.04/usr/bin/lldb

Any advice appreciated,
Randy

Were you using SwiftPM to build the Dealer executable? If yes, then you most likely ran into [SR-11008] lldb debug error when compiling project with SPM on Ubuntu 16.04 ยท Issue #4857 ยท apple/swift-package-manager ยท GitHub.

Yes, I was using the package manager.

Despite many efforts with Google search I never landed on the specific report you show - I will follow your example and do it 'manually' .

Thanks!

Actually Adrian, the brief example in that thread provides no idea of how to link my executables with the libraries I made. The line

$ swiftc -g -c a.swift ...

does not create a module without -emit-module, and when I try the final step with the linker it barfs out a long string of errors.

I have relied on either Xcode or SPM to manage builds, is there any documentation or examples to build a project (that includes dependencies) that shows how to build things with a conventional Make file?

Thanks!

You should be able to just look at what Xcode is doing and then mimic the steps shown in the build log. I'm also hearing that @Aciid is working on adding swiftpm support for this.

I landed the SwiftPM fixes today: [Build] Fix debugging for products built by SwiftPM by aciidb0mb3r ยท Pull Request #2348 ยท apple/swift-package-manager ยท GitHub

It should be in a trunk snapshot soon so you can use that when it comes out.

1 Like