How does one cast a pointer to a known Swift object type in lldb when debugging an iOS app in Xcode 9?
I am trying to print an object's description in Swift given its memory address in Xcode 9 / iOS 11 SDK. I had been using the technique described here: LLDB (Swift): Casting Raw Address into Usable Type (Note: this technique works fine when debugging a macOS app.)
(lldb) p unsafeBitCast(0x00006080000e2280, to: UIViewController.self)
But typing a similar statement in lldb in Xcode 9 while debugging an iOS app yields the following error message:
error: use of undeclared identifier 'to'
. Or removing the "to:" part:
error: use of undeclared identifier 'unsafeBitCast'
.
I searched for documentation of a replacement for the Swift unsafeBitCast()
method, but I have found no mention of its deprecation. Is this a bug in lldb / Swift iOS runtime?
Broken: Xcode 9 + iOS 11 Simulator, Xcode 9 + iOS 9.x Simulator, Xcode 9 + iOS 9.x device
Working: Xcode 8 + iOS Simulator/Device, Xcode 9 + macOS 10.12 app
Thanks for your insights.