On Tue, Feb 02, 2010 at 09:18:07PM +0100, Jan Kratochvil wrote:
On Mon, 01 Feb 2010 07:18:26 +0100, 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.
[...]
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
If you list also the mixasm.c compilation line you would find: gcc -g -O0 -fpic -Wall -I.././ -O mixasm.c -o mixasm.o -c
as there is explicit -O in dev/Makefile there. After removing it getting a valid dump with no <value optimized out>.
For the -O build found one <value optimized out> as correct and one <value optimized out> as some bug in either gdb or gcc but that is out of the scope of this mail thread. -O0 -g works, NOTABUG.
Thanks a bunch for this!