po in LLDB with swift

后端 未结 4 1488
无人及你
无人及你 2020-12-13 04:26

How can I plot out variable\'s value in a Swift App with LLDB?

Earlier it was like po variable_name

Now I usually get some nasty error, like:

4条回答
  •  一生所求
    2020-12-13 04:31

    Great answers in this page about swift defaulting to return the description when running lldb) po

    If it helps, when hitting errors with lldb and Swift objects I alway tried to be in a good place.

    First, tell lldb you are in a Swift context (not Objective-C):

    (lldb) settings set target.language swift

    Then I would always double-check I had imported the Framework..

    lldb) exp import WebKit
    (lldb) expr let $ds = unsafeBitCast(0x6000006d74b0, to: WKWebsiteDataStore.self)
    (lldb) po $ds
    
    

提交回复
热议问题