[linux-yocto] gdb target kernel debug

Bruce Ashfield bruce.ashfield at windriver.com
Wed Apr 3 07:25:54 PDT 2013


On 13-04-03 03:55 AM, Lai Eddy wrote:
> I want to debug the kernel module loaded in the x86_64 (jasperforest)
> linux-yocto target,
> so I load the 'vmlinux' with gdb on the host PC (CentOS 6.4_x64) ,
> but looks like the gdb failed to connect the target,
> should I add any 'kernel boot parameters' to enable the kgdb use ttyS0 ?
>
> my target boot from a USB drive with SYSLINUX, the target's ttyS0 is
> used as console output,
> should I use ttyS1 on target as debug port instead of ttyS0? how can I
> set that?

It's definitely easier if you can share the console. But you do need
to perform some setup for KGDB.

Have you looked at the KGDB documentation that comes with the mainline
kernel with respect to KGDB connection and setup ?

If you are sharing the console and KGDB connection, have a look at
agent-proxy:

   https://kernel.googlesource.com/pub/scm/utils/kernel/kgdb/agent-proxy/

We could look into adding this to the yocto layers if it is useful.

The general flow is something like this:

  on the target -- echo "ttyS0,115200" > /sys/modules/kgdboc/parameters
  on your host -- agent-proxy 4440^4441 0 /dev/ttyS0,115200
  then telnet to localhost 4440 for console
  in your gdb session: tar rem ::4441

Cheers,

Bruce

>
> and , when I run "echo g > /proc/sysrq-trigger" on target console, the
> target machine not freeze as expect.
>
> ----------------------------------------------------------------------------------------------------------------------
> [root at localhost linux-jasperforest-standard-build]#
> x86_64-poky-linux-gdb vmlinux
> GNU gdb (GDB) 7.5
> Copyright (C) 2012 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "--host=x86_64-pokysdk-linux
> --target=x86_64-poky-linux".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> Reading symbols
> fromtmp/work/jasperforest-poky-linux/linux-yocto/3.4.26+gitAUTOINC+4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993_840bb8c059418c4753415df56c9aff1c0d5354c8-r4.3/linux-jasperforest-standard-build/vmlinux...done.
> (gdb) target remote /dev/ttyS0
> Remote debugging using /dev/ttyS0
> Ignoring packet error, continuing...
> warning: unrecognized item "qRelocInsn+���b5" in "qSupported" response
> Ignoring packet error, continuing...
> Ignoring packet error, continuing...
> Ignoring packet error, continuing...
> Ignoring packet error, continuing...
> Ignoring packet error, continuing...
> Ignoring packet error, continuing...
> Malformed response to offset query, qOffsets���4bftiprocess
> (gdb)
>
>
>
> _______________________________________________
> linux-yocto mailing list
> linux-yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/linux-yocto
>




More information about the linux-yocto mailing list