Appygix
Appygix

Reputation: 652

(lldb) - How pause an application and debug at the actual running UIViewController

I'm new at lldb debugging and hope you can help me :)

basically I want to express some functions as e.g.

(lldb) expr device.up()
(lldb) expr device.down()

to watch the changing behaviour of the UI at the Simulator. (lot of animations..)

I can achieve this when i set a breakpoint at my UIViewController, and then type the commands. But after pressing start again it waits for a delegate and i only can pause it manually to get the debug console again. And there comes my question: Is it possible, when I pause the application, to debug at the same environment (of the specific, activ UIViewController) as before where I set the breakpoint?

I'm glad for your tips and lldb experience and pls write if my question is unclear! :)

Upvotes: 0

Views: 1497

Answers (1)

Jim Ingham
Jim Ingham

Reputation: 27110

If the stack frame you were evaluating expression in is still on the stack somewhere, you can select that thread & frame:

(lldb) thread 5
(lldb) frame 7

then run the expression. If the frame is no longer on the stack, you can't do that. If the expression you were evaluating refer to local variables, you won't be able to recover them, the memory they occupied is gone.

But you can store values away in lldb convenience variables. For instance, if you were using C++ and "device" was a reference to an object of type SomeType, you could do:

(lldb) expr SomeType *$reference_to_device = &device

Then later you could do:

(lldb) expr $reference_to_device->up()

Capturing the address isn't going to keep the object alive, however, something actually in your program will have to do that.

Upvotes: 1

Related Questions