简体   繁体   中英

lldb inspection of swift variables within dynamic framework

I am unable to inspect variable state within dynamic frameworks in the lldb debugging console. I am able to inspect the same code when I add it to the main application. Why is this? Is there a workaround? Any ideas?

(lldb) po URLSessionDataTask
error: <EXPR>:1:1: error: use of unresolved identifier 'URLSessionDataTask'
URLSessionDataTask
^

代码样例检查控制台输出

I had the same situation. I could create a class instant of anything in the main app but nothing in the dynamic libraries, when it was Swift code.

(lldb) exp let $a = RustyAppInfo()  //class from framework
error: <EXPR>:3:10: error: use of unresolved identifier 'RustyAppInfo'

Fix for me:

(lldb) expr -- import rusty_nails //framework name
(lldb) exp let $a = RustyAppInfo()

My lldb version: 902.0.79.7 . Notice, lldb knew I was trying to write swift code. In an iOS app, where you have Swift and Objective-C code, I always find it useful to type:

(lldb) settings set target.language swift

Answer was inspired by LLDB (Swift): Casting Raw Address into Usable Type

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM