<价值最优化了>在gdb中是什么意思? [英] What does <value optimized out> mean in gdb?

查看:92
本文介绍了<价值最优化了>在gdb中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(gdb) n
134   a = b = c = 0xdeadbeef + ((uint32_t)length) + initval;
(gdb) n
(gdb) p a
$30 = <value optimized out>
(gdb) p b
$31 = <value optimized out>
(gdb) p c
$32 = 3735928563

gdb如何优化我的价值?

How can gdb optimize out my value??

推荐答案

这表示您使用例如gcc -O3和gcc优化器发现您的某些变量在某种程度上是多余的,因此可以对其进行优化.在这种特殊情况下,您似乎拥有三个具有相同值的变量a,b,c,并且可以将它们全部别名为一个变量.在禁用优化的情况下进行编译,例如gcc -O0,如果您想查看此类变量(在任何情况下,这通常都是调试版本的一个好主意).

It means you compiled with e.g. gcc -O3 and the gcc optimiser found that some of your variables were redundant in some way that allowed them to be optimised away. In this particular case you appear to have three variables a, b, c with the same value and presumably they can all be aliassed to a single variable. Compile with optimisation disabled, e.g. gcc -O0, if you want to see such variables (this is generally a good idea for debug builds in any case).

这篇关于&lt;价值最优化了&gt;在gdb中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆