0

I'm debugging a large program using LLDB and there's one bool variable that's used everywhere, generally referenced as an extern. I've been debugging it for a while and, no matter where I set my breakpoints, the value is always true. I'd like to find where this value is set - I've tried searching the code and setting breakpoints at every assignment of that variable but none of those seem to get triggered, and at a later breakpoint that value is always true. Is there any way of pinpointing the first write to a variable?

1

1 Answer 1

1

Like Flash Sheridan noted in his comment to your question, you want to use a watchpoint here. Set a breakpoint early in your app (e.g. NSApplicationMain), set a watchpoint on your (presumably global) bool variable,

(lldb) watch set variable myvar

or

(lldb) w s v myvar

and this should stop program execution every time myvar is modified.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.