debugging enabled? (was Re: KGDB command line options not working for kernel 2.6.32)

Spiro Trikaliotis ml-kernelnewbies at spiro.trikaliotis.net
Mon Jun 27 14:40:43 EDT 2011


Hello,

* On Mon, Jun 27, 2011 at 09:51:53PM +0700 Mulyadi Santosa wrote:
> >I have one question in this context. Should we disable optimization when
> >building the kernel when we wish to enable kgdb or should we leave it intact.
> 
> Whenever possible, yes...disable optimization.... -O option and -g in
> gcc don't play nicely together according to my experience. The DWARF
> info will be somewhat fuzzed or even "corrupted"....so it might point
> to wrong source line etc

On the one hand, you are right. With optimisations on, following the
code lines does not give much fun. Some locals are not visible as they
are optimised out, and so on.

On the other hand: With optimisations disabled, the kernel behaves
differently than it would with optimisations. That's why many people
prefer to keep them switched on, and only disable them partially if
really, really needed.

Anyway, the opinions vary a lot here. I think one should try both and
find out what fits most to ones way of doing it.

Best regards
Spiro.

-- 
Spiro R. Trikaliotis                              http://opencbm.sf.net/
http://www.trikaliotis.net/                     http://www.viceteam.org/



More information about the Kernelnewbies mailing list