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

Chuck Anderson cra at WPI.EDU
Mon Feb 1 06:18:26 UTC 2010

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
    at mixasm.c:2022
2022                    playrout(dst, mylen, ch);
(gdb) p stereo
$4 = <value optimized out>


More information about the devel mailing list