2

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
^

Code sample Inspection console output

phoganuci
  • 4,984
  • 9
  • 39
  • 50
  • 1
    I often have similar issues. In my case, it appears to happen because the library needs non-standard header search paths to build and LLDB can't parse the module correctly because of that. You can see if that works by running [`p @import LibraryName`](https://developer.apple.com/library/ios/releasenotes/DeveloperTools/RN-Xcode/Chapters/xc6_release_notes.html#//apple_ref/doc/uid/TP40001051-CH4-SW10) in the lldb console, and looking at the results. – zneak Apr 17 '15 at 15:39
  • Does not look to good: `(lldb) p @import BDModules error: :1:2: error: expected an attribute name @import BDModules ^` – phoganuci Apr 17 '15 at 15:41
  • Are you using Xcode 6.3? – zneak Apr 17 '15 at 15:42
  • I am using Xcode 6.3 – phoganuci Apr 17 '15 at 15:42
  • Well, that's weird; it's not even a module load error, it just didn't get what you asked for. – zneak Apr 17 '15 at 15:43
  • If you are interested in looking further, here is a link to the workspace: https://github.com/banDedo/BDModules. It is nested in the `Harness` directory. Must run pod install first to install development pods. I specifically set a breakpoint on line 155 of `APISessionManager.swift` and launch app/login to see issue. – phoganuci Apr 17 '15 at 15:45

1 Answers1

0

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

rustyMagnet
  • 3,479
  • 1
  • 31
  • 41