Hi all was wondering if it was something I am doing wrong and if this issue affects me only and should I create a Jira ticket from this?
During debugging sessions either in Xcode or from LLDB(REPL) in Terminal I get the AST error when i try to investigate my stack variables. Any help would be much appreciated!
How i cloned:
branch: master
clone: git clone GitHub - apple/swift: The Swift Programming Language
./swift/utils/update-checkout --clone
How i built:
terminal: utils/build-script --release --debug-swift --debug-swift-stdlib
Xcode: utils/build-script --debug --xcode
How i am testing:
Xcode: build and run
terminal: lldb attached to Ninja-RelWithDebInfoAssert+stdlib-DebugAssert/swift-macosx-x86_64/bin/swift
Expected results - able to investigate my local variables on stack frame
Actual - error: in auto-import:
failed to get module 'Builtin' from AST context
ocess 20684 stopped
thread #2, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x000000010b01f657 libswiftCore.dylib`Array.stuffz.getter(self=) at Array.swift:328
325 }
326
327 public var stuffz:String {
-> 328 let x = "foobar"
329 let y = "dem breakpoints"
330 let combined = x + y
331 return combined
Target 0: (swift) stopped.
(lldb) n
Process 20684 stopped
thread #2, queue = 'com.apple.main-thread', stop reason = step over
frame #0: 0x000000010b01f67c libswiftCore.dylib`Array.stuffz.getter(self=) at Array.swift:329
326
327 public var stuffz:String {
328 let x = "foobar"
-> 329 let y = "dem breakpoints"
330 let combined = x + y
331 return combined
332 }
Target 0: (swift) stopped.
(lldb) po x
error: in auto-import:
failed to get module 'Builtin' from AST context
(lldb) s
Process 20684 stopped
thread #2, queue = 'com.apple.main-thread', stop reason = step in
frame #0: 0x000000010b0178d8 libswiftCore.dylib`String.init(start=0x000000010b75dc1f "dem breakpoints", utf8CodeUnitCount=15, isASCII=1) at String.swift:513
510 utf8CodeUnitCount: Builtin.Word,
511 isASCII: Builtin.Int1
512 ) {
-> 513 let bufPtr = UnsafeBufferPointer(
514 start: UnsafeRawPointer(start).assumingMemoryBound(to: UInt8.self),
515 count: Int(utf8CodeUnitCount))
516 if let smol = _SmallString(bufPtr) {
Target 0: (swift) stopped.
(lldb) s
Process 20684 stopped
thread #2, queue = 'com.apple.main-thread', stop reason = step in
frame #0: 0x000000010b01b1ff libswiftCore.dylib`UnsafeBufferPointer.init(start=, count=15) at UnsafeBufferPointer.swift:892
889 @inlinable // unsafe-performance
890 public init(start: UnsafePointer?, count: Int) {
891 _precondition(
-> 892 count >= 0, "UnsafeBufferPointer with negative count")
893 _precondition(
894 count == 0 || start != nil,
895 "UnsafeBufferPointer has a nil start and nonzero count")
Target 0: (swift) stopped.
(lldb) po count
error: in auto-import:
failed to get module 'Builtin' from AST context
If you are building your own Swift compiler (at this point in time) you need to debug programs compiled with that compiler with a matching LLDB. To build LLDB, just add -l (--llldb) to the build script invocation.
I got fixed the codesigin issue but now not sure what to do.
I tried using the Ninja-DebugAssert/lldb-macosx-x86_64/CustomSwift-Debug/lldb to run the '../../swift-macosx-x86_64/bin/swift but that does not work. not sure how to get to REPL and debug
@manojkarki do you have a project you can share where this reproduces? If so, can you file a JIRA ticket for us to look at ? (add me to the cc:list so I'll see it)