[swift-users] libswiftCore.dylib was compiled with optimization - stepping may behave oddly;

David Liu david.yang.liu at gmail.com
Thu Aug 25 23:36:09 CDT 2016


Hi all,  can any one here give me some pointers on debugging the standard
library?
I may be compiling the toolchain incorrectly when i step through the code
variables on the stack frame are not available.
I think its due to this message when i start the REPL
`libswiftCore.dylib was compiled with optimization - stepping may behave
oddly; variables may not be available.`
I am using the /utils/build-toolchain command and did not touch the
presets.ini file.
Any help is appreciated!

Thanks in advance

Dave

Process 13833 stopped

* thread #1: tid = 0x3a6ffe, 0x00000001000c3603
libswiftCore.dylib`ManagedBufferPointer.init(_uncheckedBufferClass :
AnyObject.Type, minimumCapacity : Int) -> ManagedBufferPointer<A, B>
[inlined] Swift._roundUp (Swift.Int, toAlignment : Swift.Int) -> Swift.Int
at Builtin.swift:72, queue = 'com.apple.main-thread', stop reason = step in

    frame #0: 0x00000001000c3603
libswiftCore.dylib`ManagedBufferPointer.init(_uncheckedBufferClass :
AnyObject.Type, minimumCapacity : Int) -> ManagedBufferPointer<A, B>
[inlined] Swift._roundUp (Swift.Int, toAlignment : Swift.Int) -> Swift.Int
at Builtin.swift:72 [opt]

   69  @_versioned

   70  internal func _roundUp(_ offset: Int, toAlignment alignment: Int) ->
Int {

   71    _sanityCheck(offset >= 0)

-> 72    return Int(_roundUpImpl(UInt(bitPattern: offset), toAlignment:
alignment))

   73  }

   74

   75  // This function takes a raw pointer and returns a typed pointer. It
implicitly

(lldb) fr v

(lldb) po offset

error: <EXPR>:3:1: error: use of unresolved identifier 'offset'

offset

^~~~~~

(lldb) fr v offset

error: no variable named 'offset' found in this frame

(lldb) s

Process 13833 stopped

* thread #1: tid = 0x3a6ffe, 0x00000001000c3603
libswiftCore.dylib`ManagedBufferPointer.init(_uncheckedBufferClass :
AnyObject.Type, minimumCapacity : Int) -> ManagedBufferPointer<A, B>
[inlined] Swift._roundUpImpl (Swift.UInt, toAlignment : Swift.Int) ->
Swift.UInt at Builtin.swift:58, queue = 'com.apple.main-thread', stop
reason = step in

    frame #0: 0x00000001000c3603
libswiftCore.dylib`ManagedBufferPointer.init(_uncheckedBufferClass :
AnyObject.Type, minimumCapacity : Int) -> ManagedBufferPointer<A, B>
[inlined] Swift._roundUpImpl (Swift.UInt, toAlignment : Swift.Int) ->
Swift.UInt at Builtin.swift:58 [opt]

   55    _sanityCheck(_isPowerOf2(alignment))

   56    // Note, given that offset is >= 0, and alignment > 0, we don't

   57    // need to underflow check the -1, as it can never underflow.

-> 58    let x = offset + UInt(bitPattern: alignment) &- 1

   59    // Note, as alignment is a power of 2, we'll use masking to
efficiently

   60    // get the aligned value

   61    return x & ~(UInt(bitPattern: alignment) &- 1)

(lldb) fr v

(lldb) fr v -R

(lldb) fr v aligment

error: no variable named 'aligment' found in this frame

(lldb) fr v alignment

error: no variable named 'alignment' found in this frame
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160825/45906215/attachment.html>


More information about the swift-users mailing list