Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does <value optimized out> mean in gdb?

Tags:

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 

How can gdb optimize out my value??

like image 318
gdb Avatar asked Mar 31 '11 09:03

gdb


People also ask

How do I get optimized value in GDB?

To view the "optimized-out" value of a variable during debugging, you need to turn off gcccompiler optimization, either on a per-variable basis, or program-wide. If you are interested in a particular variable in gdb, you can delare the variable as "volatile" and recompile the code.

What is optimized value?

Customer Value Optimization (CVO) is a process to create a great customer journey and maximize the ROI for all marketing activities. It focuses on optimization throughout the customer lifecycle to improve brand and loyalty—and create customers for life.


1 Answers

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).

like image 71
Paul R Avatar answered Oct 02 '22 15:10

Paul R