<value optimized out> even with gcc -g -O0

David Malcolm dmalcolm at redhat.com
Mon Feb 1 15:34:51 UTC 2010


On Mon, 2010-02-01 at 01:18 -0500, Chuck Anderson wrote:
> I'm trying to debug an issue for the upstream author of ocp and am 
> running into an issue where gdb is showing "<value optimized out>" for 
> variables even though I've compiled the program with gcc -g -O0.  Are 
> there any gcc/gdb gurus who can help?  
> 
> Compiler excerpts:
> 
> gcc -g -O0 -fPIC -Wall -I.././ -I.././gnulib kickload.c -o kickload.o -c
> gcc -g -O0 -fPIC -Wall -I.././ -I.././gnulib compdate.c -o compdate.o -c
> ...
> gcc -g -O0 -fPIC -Wall -I./ -I./gnulib  -o ocp boot/kickload.o -pthread -ldl  goodies/helpc/ocphhc doc/opencp.dox ocp.hlp
> 
> gdb output:
> 
> Program received signal SIGSEGV, Segmentation fault.
> playmonoi16 (dst=0x76ddc0, len=<value optimized out>,
>     ch=<value optimized out>) at mixasm.c:1746
> 1746                    *(dst++)+=voltabs[0]
> (gdb) p dst
> $1 = (int32_t *) 0x76ddc0
> (gdb) p len
> $2 = <value optimized out>
> (gdb) p ch
> $3 = <value optimized out>
> (gdb) p *ch
> Cannot access memory at address 0x0
> (gdb) up
> #1  0x00007ffff5948257 in mixPlayChannel (dst=<value optimized out>,
>     len=<value optimized out>, ch=0x779df0, stereo=<value optimized
> out>)
>     at mixasm.c:2022
> 2022                    playrout(dst, mylen, ch);
> (gdb) p stereo
> $4 = <value optimized out>
Not sure if it's the same bug, but I ran into similar issue when trying
to debug Python; see:
https://bugzilla.redhat.com/show_bug.cgi?id=556975
"Variables optimized out (python)"

Hope this is helpful
Dave




More information about the devel mailing list