[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gdb-bugs
Subject:    Re: gdb show ?? symbols
From:       Alexandre Rusev <arusev () ru ! mvista ! com>
Date:       2009-12-28 13:20:55
Message-ID: 4B38B0B7.4020803 () ru ! mvista ! com
[Download RAW message or body]

清水河 wrote:
> On Dec 24, 2:00 am, Alexandre Rusev <aru...@ru.mvista.com> wrote:
>   
>> ä½ å¥½!;)
>>
>> 清水河 wrote:
>>     
>>> Hi, I tried to use gdb to debug kernel code.
>>> I compiled with -g -ggdb flags, but it seems gdb cannot show symbols
>>> correctly, instead it shows all ??
>>>       
>> compile kernel with debug information.
>> In kernel compilation menu "make menuconfig" select Kernel
>> Hucking->Compile kernel with Debug information,
>> there are anumber of kernel debugging related options to turn on.
>>
>> Which processor architecture you compiling your kernel for?
>>     
>
> Hi, it is i386. Seems there is no "Compile kernel with Debug
>   
the mainstream i386 architecture usually works fine ... strange
> information" option, under "kernel debugging", there are several debug
> options, like "Debug shared IRQ handlers", "Detect Soft Lockups", etc,
> but which one is the option that have the source information?
>
>   
Typical settings in .config file (and make menuconfig) would be:

CONFIG_DEBUG_KERNEL                       Kernel debugging
CONFIG_DEBUG_LL                                  Compile the kernel with
debug info
CONFIG_DEBUG_BUGVERBOSE          Verbose BUG() reporting


Make sure that you are debugging an executable "vmlinux" in your GDB
session.

Got to the directory you compiled your kernel and start debugging of
vmlinux likes this:

cd linux-2.6.xx
gdb vmlinux
gdb target remote /dev/pts/11
...

your GDB tool have to have the ELF image of the kernel being debugged and
the sources should present starting from the current path.
I guess that there also may be some issues with GDB itself when you
debugging the kernel modules,
but if you compile the solid kernel (modules compiled in kernel image)
the code of
these modules must be step debugged quite well

At the machine you are debugging the kernel run "cat  /proc/kallsyms"
and see if the information about symbol names is really available

Here is beginning of an example of output at x86 target:
cat  /proc/kallsyms
c01002c0 T _stext
c01002c0 t run_init_process
c01002c0 T stext
c01002fc t init
c01005b8 t rest_init
c01005d8 t try_name
c010079f T name_to_dev_t
c0100a0c T calibrate_delay
c0100c70 T hard_smp_processor_id
c0100c80 t target_cpus
c0100c87 t check_apicid_used
c0100c8a t check_apicid_present
c0100c90 t multi_timer_check
c0100c93 t apic_id_registered
c0100c99 t apicid_to_node
c0100c9d t cpu_to_logical_apicid
c0100cb1 t cpu_present_to_apicid
...

>>> Remote debugging using /dev/pts/11
>>> 0xc0467118 in ?? ()
>>> (gdb) where
>>> #0  0xc0467118 in ?? ()
>>> #1  0xc077db2d in ?? ()
>>> #2  0x00000000 in ?? ()
>>>       
>>> how to solve this problem?
>>> _______________________________________________
>>> bug-gdb mailing list
>>> bug-...@gnu.org
>>> http://lists.gnu.org/mailman/listinfo/bug-gdb
>>>       
>
> _______________________________________________
> bug-gdb mailing list
> bug-gdb@gnu.org
> http://lists.gnu.org/mailman/listinfo/bug-gdb
>   


[Attachment #3 (text/html)]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
清水河 wrote:
<blockquote
 cite="midc94e73a4-2df8-4c7c-80ed-5d05ffd7ef90@o28g2000yqh.googlegroups.com"
 type="cite">
  <pre wrap="">On Dec 24, 2:00 am, Alexandre Rusev <a class="moz-txt-link-rfc2396E" \
href="mailto:aru...@ru.mvista.com">&lt;aru...@ru.mvista.com&gt;</a> wrote:  </pre>
  <blockquote type="cite">
    <pre wrap="">你好!;)

清水河 wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">Hi, I tried to use gdb to debug kernel code.
I compiled with -g -ggdb flags, but it seems gdb cannot show symbols
correctly, instead it shows all ??
      </pre>
    </blockquote>
    <pre wrap="">compile kernel with debug information.
In kernel compilation menu "make menuconfig" select Kernel
Hucking-&gt;Compile kernel with Debug information,
there are anumber of kernel debugging related options to turn on.

Which processor architecture you compiling your kernel for?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Hi, it is i386. Seems there is no "Compile kernel with Debug
  </pre>
</blockquote>
the mainstream i386 architecture usually works fine ... strange<br>
<blockquote
 cite="midc94e73a4-2df8-4c7c-80ed-5d05ffd7ef90@o28g2000yqh.googlegroups.com"
 type="cite">
  <pre wrap="">information" option, under "kernel debugging", there are several debug
options, like "Debug shared IRQ handlers", "Detect Soft Lockups", etc,
but which one is the option that have the source information?

  </pre>
</blockquote>
Typical settings in .config file (and make menuconfig) would be:<br>
<br>
CONFIG_DEBUG_KERNEL                       Kernel debugging<br>
CONFIG_DEBUG_LL                                  Compile the kernel
with debug info<br>
CONFIG_DEBUG_BUGVERBOSE          Verbose BUG() reporting<br>
<br>
<br>
Make sure that you are debugging an executable "vmlinux" in your GDB
session.<br>
<br>
Got to the directory you compiled your kernel and start debugging of
vmlinux likes this:<br>
<br>
cd linux-2.6.xx<br>
gdb vmlinux<br>
gdb target remote /dev/pts/11<br>
...<br>
<br>
your GDB tool have to have the ELF image of the kernel being debugged
and<br>
the sources should present starting from the current path.<br>
I guess that there also may be some issues with GDB itself when you
debugging the kernel modules,<br>
but if you compile the solid kernel (modules compiled in kernel image)
the code of<br>
these modules must be step debugged quite well<br>
<br>
At the machine you are debugging the kernel run "cat  /proc/kallsyms"<br>
and see if the information about symbol names is really available<br>
<br>
Here is beginning of an example of output at x86 target:<br>
cat  /proc/kallsyms<br>
c01002c0 T _stext<br>
c01002c0 t run_init_process<br>
c01002c0 T stext<br>
c01002fc t init<br>
c01005b8 t rest_init<br>
c01005d8 t try_name<br>
c010079f T name_to_dev_t<br>
c0100a0c T calibrate_delay<br>
c0100c70 T hard_smp_processor_id<br>
c0100c80 t target_cpus<br>
c0100c87 t check_apicid_used<br>
c0100c8a t check_apicid_present<br>
c0100c90 t multi_timer_check<br>
c0100c93 t apic_id_registered<br>
c0100c99 t apicid_to_node<br>
c0100c9d t cpu_to_logical_apicid<br>
c0100cb1 t cpu_present_to_apicid<br>
...<br>
<br>
<blockquote
 cite="midc94e73a4-2df8-4c7c-80ed-5d05ffd7ef90@o28g2000yqh.googlegroups.com"
 type="cite">
  <pre wrap=""></pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">Remote debugging using /dev/pts/11
0xc0467118 in ?? ()
(gdb) where
#0  0xc0467118 in ?? ()
#1  0xc077db2d in ?? ()
#2  0x00000000 in ?? ()
      </pre>
    </blockquote>
    <blockquote type="cite">
      <pre wrap="">how to solve this problem?
_______________________________________________
bug-gdb mailing list
<a class="moz-txt-link-abbreviated" href="mailto:bug-...@gnu.org">bug-...@gnu.org</a>
<a class="moz-txt-link-freetext" \
href="http://lists.gnu.org/mailman/listinfo/bug-gdb">http://lists.gnu.org/mailman/listinfo/bug-gdb</a>
  </pre>
    </blockquote>
  </blockquote>
  <pre wrap=""><!---->
_______________________________________________
bug-gdb mailing list
<a class="moz-txt-link-abbreviated" href="mailto:bug-gdb@gnu.org">bug-gdb@gnu.org</a>
<a class="moz-txt-link-freetext" \
href="http://lists.gnu.org/mailman/listinfo/bug-gdb">http://lists.gnu.org/mailman/listinfo/bug-gdb</a>
  </pre>
</blockquote>
<br>
</body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic