gdb says EVERY argument or variable is optimized out (Re: gdb and fission scheme (gcc: -gsplit-dwarf, gnu ld gold :--gdb-index ))

ISHIKAWA,chiaki ishikawa@yk.rim.or.jp
Mon Feb 2 15:40:00 GMT 2015


On 2015/01/29 3:46, ISHIKAWA,chiaki wrote:
> On 2015/01/26 17:48, Andrew Burgess wrote:
>> * ISHIKAWA,chiaki <ishikawa@yk.rim.or.jp> [2015-01-19 12:00:21 +0900]:
>>
>>> However, for debugging particular class of bugs,
>>> I really needed to print some values on the stack trace when a
>>> breakpoint is hit, as well as local variables manually.
>>> So I made sure that I passed -O instead of higher optimization.
>>
>> -O is not "no optimisation", do you get better debugging with -O0 ?
>
> This might be it!
> I will check and report next week.

Sorry for the noise.

With -O0, gdb session can print all the arguments and local variables 
(not that I checked EVERY variable, but it works like it should on a 
quick testing.)
So it is not gdb, GNU gold, or -gsplit-dwarf issue.
Funny, gcc 4.9 may do something extra in "-O" in comparison to older 
versions of gcc, and it seems that we have to suppress this new 
something by  "-O0". I checked the heavily commented local test scripts 
and they mention only "-O" for quite a while.
But the last time I did serious gdb session with mozilla software is at 
least a couple of years ago, so I can't say for sure.

Thank you again!

CI


>>> In my case, disabling -gsplit-dwarf means a very long time (several
>>> minutes) of I/O during linking process alone and this is unacceptable
>>> overhead for interactive debugging after changing a single C++
>>> source file.
>>
>> OK, but you could try it one time and see if it fixes your problem.
>> That would narrow down where the bug is coming from....
>
> I will try it once also as well as -O0 above and report back.
>
> with -gsplit-dwarf and -O0
> without -gsplit-dwarf and {-O,-O0}
>
> [Oh wait, I got a better symbol handling the year before, and I think
> I used -O instead of -O0. Well, let me try anyway afresh and report back.]
>
> Thank you for the hints!
>
> TIA
>
>>
>> Thanks,
>> Andrew
>>
>>
>
>
>



More information about the Gdb mailing list