C++学习(四八六)lldb parent failed to evaluate variable not available

Posted hankern

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C++学习(四八六)lldb parent failed to evaluate variable not available相关的知识,希望对你有一定的参考价值。

android Studio的JNI调试c++程序时遇到的问题。

有些值获取失败,比如key等变量。

 还会出现有些值看不到的情况(未提示获取失败),如localLOD。

通过lldb命令查看,也是同样的结果

可能和程序优化有关

https://stackoverflow.com/questions/13040777/lldb-error-variable-not-available

This is an artifact of debugging optimized code. When the compiler's optimization is enabled in your build settings, it moves variables between memory and registers as it decides is best. At the point where you're examining the variable in lldb, it may not exist in registers or memory at all -- even though it looks like it should still be available for display.

It's possible it is a shortcoming of the debug information output by the compiler. Sometimes the compiler will copy a variable into a register for its use and only list that register location in the debug information. Later the register is repurposed for other uses; value is still present on the stack but the compiler hasn't told the debugger that the value can be found there.

The only way to really tell whether it's insufficient debug info or if the value genuinely doesn't exist at that particular instruction is to examine the assembly code by hand. As soon as you turn on optimization with the compiler, the source code becomes a weak view into what's actually being executed in any particular order.

Instead of wandering too far into the wacky world of optimized code debugging, I strongly recommend turning off optimization (Optimization Level in your Build Settings) for your build and debugging it that way, if at all possible. If you do need to debug your app with optimization, make sure you're building with the latest Apple LLVM compiler supported by your Xcode -- there is always work being done to improve optimized code debugging and you want to avail yourself of the most up to date tools you can.

以上是关于C++学习(四八六)lldb parent failed to evaluate variable not available的主要内容,如果未能解决你的问题,请参考以下文章

C++学习(四八一)peek

C++学习(四八四)anaconda常用命令

C++学习(四八四)anaconda常用命令

C++学习(四八二)zlib的inflate

C++学习(三八六)gdal:cpl Common Portability Library

C++学习(四四八)fstream写文件