In an objective-c project, this command works well. but in Swift,
(lldb) expr unsigned int $foo = 5
error: :1:4: error: consecutive statements on a line must be separated by ';'
int $foo = 5
^ ;
How can I fix this?
The expression parser uses the compiler's parser for the language of the current frame. Presumably you are stopped in a Swift frame, so you have to use correct Swift syntax. The swift equivalent is of your ObjC example is:
(lldb) expr var $foo : Int = 10
or since Swift does type inference, you can just say:
(lldb) expr var $foo = 10
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