kgdb support for gdb

Mark Kettenis
Sat Oct 2 22:48:00 GMT 2004

   From: "Amit S. Kale" <>
   Date: Sat, 2 Oct 2004 09:21:45 +0530

   On Saturday 02 Oct 2004 3:30 am, Mark Kettenis wrote:
   >    From: "Amit S. Kale" <>
   >    Date: Fri, 1 Oct 2004 13:14:33 +0530
   >    Hi,
   >    Attached patches add kgdb support to gdb. They define two new
   >    targets i386-lk and x86_64-lk. Because of the definition of these
   >    targets, one can build a gdb with does not contain the linux
   >    operating environment specific things which are inappropriate for
   >    the kernel, like signal trampoline frame parsing.
   > I don't think you/we should add a new target triple for this stuff.
   > Instead you should add a special OS ABI variant for the kernel, and
   > use that to define your own kernel architecture vector.  I suppose
   > there is a way to detect that a binary is a Linux kernel instead of a
   > normal ELF executable?

   Yes. There is a way to detect that. I'll look into this and get back with a 
   different patch.

Before I give some more comments, here's a bit more mrotivation for
the request.  I think it would be best if the user doesn't have to do
anything special to do kernel debugging.  Loading a kernel into GDB
and connecting to it should be enough.  Therefore it seems a bit
artificial to seperate the code from the normal Linux code.

So here are some more comments:

* Could you use a somewhat more descriptive name than OSABI_LK?  I'd
  suggest OSABI_LINUX_KERNEL.  Please put it close to the exitsing
  OSABI_LINUX entry.

* Something similar for the lk-tdep.c file.  Why not name it
  linux-tdep.c?  The same goes for i386-lk-tdep.c and
  x86-64-lk-tdep.c.  The amount of code is minimal, so just put it in
  the exitsing i386-linux-tdep.c and amd64-linux.c files.

* Please use a linux_-prefix for the function names in
  lk-tdep.c/linux-tdep.c.  It sort of is our conventions, and prevents
  any (future) name space collisions.

   > Oh, and if you want this code to be included in the official GDB
   > sources, you'll have to assign copyright to the FSF of course.

   Definitely. Do I have to change the copyright message on the cfiles
   myself, or the gdb folks do it while including them into the gdb
   cvs tree? I have already signed a blanket copyright disclaimer for
   gdb contributions from myself as an individual. I'll have to sign
   one more for my company, LinSysSoft.

Yes, please change the copyright messages yourself.  If you (or your
boss) want it, you can add something like "Contributed by LinSysSoft"
to any new source files.

Anyway, even though I don't use Linux anymore, I think this is great stuff to have integrated in GDB.


More information about the Gdb-patches mailing list