Re: CONFIG_DEBUG_INFO and debugging the kernel with "gdb"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Robert....

On Fri, Jul 31, 2009 at 2:24 AM, Robert P. J. Day<rpjday@xxxxxxxxxxxxxx> wrote:
>
>  i plan on writing my next kernel newbie column on debugging both the
> kernel and loadable modules with gdb (based on that section from
> LDD3), but there are a few issues i want to clarify.
>
>  in ch 4 of LDD3 (readable online at http://lwn.net/Kernel/LDD3/), on
> p 100, one reads:
>
> "Note that, in order to have symbol information available for gdb, you
> must compile your kernel with the CONFIG_DEBUG_INFO option set. The
> result is a far larger kernel image on disk, but, without that
> information, digging through kernel variables is almost impossible."
>
>  i'm pretty sure that isn't strictly true.  if i recall correctly,
> even eithout CONFIG_DEBUG_INFO, you can still debug by simple variable
> name -- it's only the more complicated structures that you can't
> debug.  does anyone know the exact limitations on debugging if you
> choose *not* to set CONFIG_DEBUG_INFO?  thanks.

Here's my understanding: if you choose not to compile kernel with
CONFIG_DEBUG_INFO, that means you don't use -g option of gcc compiler.
-g itself will create object file with DWARF information embedded in
it. Suffice to say that DWARF is kinda mapping to some objects in your
code to the related symbols e.g group of codes mapped as function
calling, memory access as variable access and so on.

So, you'll miss this capability and have to rely on your own
understanding of assembly code to know what's exactly been doing by
kernel. Mind that -g sometimes won't mix nicely together optimization
options of gcc.

Again, this is my own understanding. If you check gcc manual, you'll
see that you can control how much debug information you can embed by
appending number after -g (e.g -g3 means more info that -g2, the
default).

perhaps you could take a look on my article here
http://onlamp.com/pub/a/onlamp/2007/04/03/getting-familiar-with-gcc-parameters.html
 (jump to page 3, it explains about -g) and see if it gives you better
information.



-- 
regards,

Mulyadi Santosa
Freelance Linux trainer
blog: the-hydra.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux