Re: [lldb-dev] Watching reads/writes on optimized variables?

2016-08-26 Thread Greg Clayton via lldb-dev
Maybe the volatile keyword? volatile int x = 10; > On Aug 26, 2016, at 9:27 AM, Christian Convey > wrote: > > Hi Greg, > > >>> >>> Does anyone know of a way to minimize or eliminate this problem? >> >> Just take the address of your variable at some point in

Re: [lldb-dev] Watching reads/writes on optimized variables?

2016-08-26 Thread Christian Convey via lldb-dev
Hi Greg, >> >> Does anyone know of a way to minimize or eliminate this problem? > > Just take the address of your variable at some point in your code and it will > force it into memory. Thanks for your idea. I can see why taking the variable's address (in an expression that's not optimized

[lldb-dev] Watching reads/writes on optimized variables?

2016-08-26 Thread Christian Convey via lldb-dev
Hi guys, I'm trying to use watchpoints to detect user-space reads/writes of an arbitrary C/C++ program variable. For example: void foo() { int x; // <-- I'm interested in 'x' x = 10; // <-- I want to detect this for (int i = 0; i < 4; ++i) { x = i; // <-- And