Maybe the volatile keyword? volatile int x = 10;
> On Aug 26, 2016, at 9:27 AM, Christian Convey <christian.con...@gmail.com> > 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 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 away) would prompt llvm to allocate > genuine stack space for it. > > However, I'm still concerned about the following scenario: > > int foo() { > int x; > dummy_func(&x); // <-- your idea, AFAICT > x = 10; > f(x); > x = 20; > g(x); > return x; > } > > I suspect it's still possible that the optimizer will (conceptually) replace: > x = 10; > f(x); > x = 20; > g(x); > return x; > with: > f(10); > f(20); > return 20; > > It's pretty important to me that at debug-time I detect the fact that > "X=10" and "X=20" (conceptually) were executed and modified the value > of "x". (Whatever approach I use also needs to detect access to "x" > which occur via aliasing.) > > - Christian _______________________________________________ lldb-dev mailing list lldb-dev@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev