How to solve gdb <value optimized out> problem?
Andrew Haley
aph@redhat.com
Thu May 27 21:03:00 GMT 2010
On 05/27/2010 07:41 PM, Mark Rose wrote:
>>
>> I am trying debug gcc 4.5.0 use gdb on ubuntu
>>
>> and encounter the problem by seeing "value optimized out". as fellow:
>>
>> (gdb) run -I /usr/include /cazy/add.c
>> Starting program: /home/cazy/gcc-object/gcc/cc1 -I /usr/include
>> /cazy/add.c
>> Breakpoint 4, c_parser_declaration_or_fndef (parser=0xb7f32bb4,
>> fndef_ok=1 '\001', empty_ok=1 '\001', nested=0 '\000',
>> start_attr_ok=1 '\001') at ../../project/gcc-4.5.0/gcc/c-parser.c:1170
>> 1170 {
>> (gdb) next
>> 1175 location_t here = c_parser_peek_token (parser)->location;
>> (gdb) next
>> 1170 {
>> (gdb) p here
>> $5 = <value optimized out>
>>
>>
>> This creates a lot of problem for me to debuging
>> So, I am wondering if there is anyway to solve the problem?
>>
>> thanks
>> cazy
>> --
>> View this message in context:
>> http://old.nabble.com/How-to-solve-gdb-%3Cvalue-optimized-out%3E-problem--tp28693805p28693805.html
>> Sent from the gcc - Help mailing list archive at Nabble.com.
>>
>>
>
> Are you using the -O flag? If so, don't or set it to 0.
And you do that by going into the build/gcc directory and editing the
makefile:
sed -i 's/-O2/-O0/g' Makefile ; rm *.o ; make cc1
Andrew.
More information about the Gcc-help
mailing list