I'm having a pretty annoying problem in the Swift debugger when I'm trying to print out the description of an object. When trying to print and object, either using the po
command or fr v
command, I get messages like
error: <EXPR>:1:1: error: use of unresolved identifier 'self'
self
^
or
self = <Unable to determine byte size.>
What's going on here? Are there reasons why the debugger isn't able to read something like self
?
<Unable to determine byte size>
is the (admittedly somewhat cryptic) error message that LLDB will print out when it does not understand the type of something.
Let me elaborate a little bit more. When you type an expression, or do a frame variable, the debugger has to evaluate whatever code you provided, or lookup the variable(s) you asked for.
In order to present the results of that to you, it also has to understand the type of things. For instance, an Int is a thing that has a numeric value whose size matches the pointer size on your machine, ... (well, to be 100% precise, an Int is a thing that has a member that has a numeric value..., but LLDB abstracts that away from you). A String is a thing that has some text (again, it's a little trickier, but LLDB abstracts that). One of the things the debugger likes to know is the "byte size" of a type, as in how many bytes in memory does an object of this type occupy?
Sometimes, the debugger can't understand the types that are being talked about. When that happens, obviously, one of the things that can't be determined is the byte size. Hence, the message.
If you run into situations where the debugger can't infer types in your apps, please file bugs http://bugreport.apple.com
As Scott D mentioned, this can be something with Fabric. If you are using Fabric, especially with TwitterKit go to TwitterKit framework and edit TwitterKit.h manually. Replacing
#import <TwitterCore/TwitterCore.h>
with
@import TwitterCore;
makes debugger usable again. Sidenote: Fabric and Crahlytics pods are updated and don't break debugger anymore.
EDIT: Twitter pods from fabric also were updated and starting version 1.12.0 they don't break the debugger. Yay!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With