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?
Asked
Active
Viewed 220 times
0

benwad
- 6,414
- 10
- 59
- 93
-
See “[http://stackoverflow.com/questions/11199421/xcode-lldb-watchpoints][1].” [1]: http://stackoverflow.com/questions/11199421/xcode-lldb-watchpoints – Flash Sheridan Dec 11 '12 at 15:32
1 Answers
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.

Jason Molenda
- 14,835
- 1
- 59
- 61