is< value optimized out>在gdb中有问题? [英] Is <value optimized out> in gdb a problem?
问题描述
我有一个应用程序只在-O2优化崩溃(用gcc 4.2.4编译)。当我遍历代码并到达崩溃的地方,并尝试检查值,我得到一个值优化出来在gdb。
I have an application that only crashes in -O2 optimization (compiled with gcc 4.2.4). When I step through the code and get to the spot that crashes and try to inspect the value, I get a "value optimized out" in gdb.
互联网,这意味着该值存储在寄存器中。我想知道如果我的崩溃可能与一些事实,一些信息放在寄存器相关?有没有办法打印什么是寄存器,看看它是否已损坏?有没有办法保持优化,但不使用寄存器?
I read on the internet that this means that the value is stored in the register. I was wondering if my crash could be related to the fact that some information is placed in registers? Is there a way to print what is in the registers to see if it has been corrupted? Is there a way to keep optimizations but not use registers?
谢谢!
推荐答案
99%可能是代码中的错误,1%可能是编译器代码生成错误。因此,花费一定的时间在代码中寻找潜在的错误,但是请注意,您只是可能发现了代码生成错误(在这种情况下,您需要仔细研究编译器生成的代码看看有什么问题)。
It's 99% likely to be a bug in your code and 1% likely to be a compiler code generation bug. So spend a proportionate amount of time looking for latent bugs in your code but be aware that you just may have found a code generation bug (in which case you'll need to study the compiler generated code carefully to see what the problem is).
这篇关于is< value optimized out>在gdb中有问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!