即使使用调试编译标志,表达式也是"optimized out"
expression is "optimized out" even with debug compile flags
我的编译标志是
-mthumb -mlittle-endian -x c++ -gdwarf-2 -g3 -fomit-frame-pointer -fnothrow-opt
-ffreestanding -fverbose-asm -std=c++11 -c -fno-rtti -ffunction-sections -fdata-sections
-fno-exceptions`
注意-gdwarf-2 -g3
然而,我试图读取的许多变量都被读取为
optimized out
-g
添加了调试信息,但它不会阻碍代码优化,因此您只要求完成一半的工作。
添加-O0
或-Og
,并阅读有关调试选项的手册页面。
您还专门启用了一个优化(-fomit-frame-pointer
(;去掉它。
相关文章:
- IN, OUT, INOUT Parameters
- 即使使用调试编译标志,表达式也是"optimized out"
- C++双重释放或损坏(out)
- 将 out/in out 参数与 if/switch 的 init 语句一起使用
- 在命令行上将输入显示到数组中时如何删除 ./a.out?
- 为什么我的向量::擦除调用会抛出"vector subscript out of range"?
- 解决方案在第 25 行执行错误'out of bounds'
- C++ 向量加减抛出"expression: vector subscript out of range."错误
- 对函数的 out 字符串参数使用 swap 与赋值
- 运行编译的 a.out 后出现分段错误(核心转储)错误
- 在 Metal 着色器代码中,如何定义函数的 in/out 参数变量?
- 赋值运算符上的双重释放或损坏(out)
- "in"和"out"在参数方向上是什么意思?
- 从 MSVC14 切换到 MSVC16 会导致"compiler is out of heap space (C1060)"错误
- -bash:/a.out:无法执行二进制文件:Exec格式错误
- 庞大的初始化列表,如何修复"fatal error C1060: compiler is out of heap space"
- C++ 调用析构函数后动态模板队列"double free or corruption (out)"
- "optimized out"值是否应该是随机的?
- 具有非类型参数的类模板的静态成员的 gdb "static field value has been optimized out"
- C++ strncpy 参数 "optimized out" ;覆盖随机内存