lldb: Couldn't materialize: couldn't get the value of variable

That error means the debug information does mention the variable, but says it has no storage location at the current PC.

That can be because the variable got optimized out (unlikely given you are just calling a function on the variable) or because the compiler flubbed the debug info for the variable and lost track of where it went.

Make sure you are compiling the code you are trying to debug at -O0 as there aren't many compilers that emit good debug information at higher optimization levels. If you are compiling at -O0, this is a compiler bug. You should probably report it to the gcc folks. You could see if you have better luck with clang. Otherwise, you have to read the assembly of the function to figure out where the variable actually lives, then tell the debugger to print the appropriately cast address.


I had this problem when I enabled the "Address Sanitizer" from my app scheme. Disable it fixed the issue.


I see this when I run a RELEASE (vs a DEBUG) build (Product->Scheme...->Edit Scheme...->Info, then set Build Configuration to "Debug".