5

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?

1 Answer 1

12

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.