Re: a couple questions about "gdb vmlinux /proc/kcore"

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

 



On Sat, 1 Aug 2009, Robert P. J. Day wrote:

>
>   for an upcoming column on how to debug the kernel (and modules) with
> gdb, i'm showing how to use the above and, since it's been a while, i
> need a refresher.
>
>   once i'm in gdb, i can list the section breakdown of the vmlinux
> file with:
>
> (gdb) info files
> ...
> Local exec file:
> 	`/home/rpjday/k/f11/vmlinux', file type elf64-x86-64.
> 	Entry point: 0x1000000
> 	0xffffffff81000000 - 0xffffffff81009000 is .text.head
> 	0xffffffff81009000 - 0xffffffff813f2d3f is .text
> 	0xffffffff813f2d40 - 0xffffffff813f2ebc is .notes
> 	0xffffffff813f2ec0 - 0xffffffff813f6f80 is __ex_table
> 	0xffffffff813f7000 - 0xffffffff8158e10a is .rodata
> 	0xffffffff8158e110 - 0xffffffff8159417c is __bug_table
> 	0xffffffff81594180 - 0xffffffff81595810 is .pci_fixup
> 	0xffffffff81595810 - 0xffffffff81595838 is .tracedata
> 	0xffffffff81595840 - 0xffffffff815a26c0 is __ksymtab
> 	0xffffffff815a26c0 - 0xffffffff815a91d0 is __ksymtab_gpl
> 	0xffffffff815a91d0 - 0xffffffff815a91e0 is __ksymtab_unused
> 	0xffffffff815a91e0 - 0xffffffff815bf743 is __ksymtab_strings
> 	0xffffffff815bf750 - 0xffffffff815eacd0 is __init_rodata
> 	0xffffffff815eacd0 - 0xffffffff815ed000 is __param
> 	0xffffffff815ed000 - 0xffffffff8165ae60 is .data
>         ... and so on.
>
> if i try to list the variables (obviously a looooong list) with
>
> (gdb) info variables
>
> gdb just goes away (perhaps I'm just asking for too much?).  is there
> a way to ask for the variable/symbol list within a single section?  i
> don't see the gdb command for that.

  as an additional query related to the above, i'm testing debugging a
simple loadable module whose file scope variable i want to print from
gdb.  so i loaded the module, then ran the obligatory:

(gdb) add-symbol-file rday.ko <text addr> \
      -s .data <data addr> \
      -s .bss <bss addr>

whose addresses i obviously got from under /sys/module.  and, sure
enough, i can print the variable in question and i get the right
answer, which clearly proves that gdb understands the symbols
properly.

  however, running

(gdb) info files

tells me nothing about the new symbol file i've added -- all i see is
for the original vmlinux file.  is there a gdb command that will show
me the properties for subsequently added symbol files?

  and, finally, if i unload the module, what will happen if i try to
print the value of that variable again?  i'm scared to try it just in
case my kernel chokes.  is there a corresponding gdb command to
*unload* the symbols from a symbol file you added earlier?

  any other neat (but still simple) tricks related to using gdb to
debug the kernel or a loadable module gratefully accepted for
inclusion in the upcoming column.

rday
--

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

        Linux Consulting, Training and Annoying Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
"Kernel Newbie Corner" column @ linux.com:          http://cli.gs/WG6WYX
========================================================================

--
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