From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19495 invoked by alias); 21 Oct 2004 12:52:33 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 19476 invoked from network); 21 Oct 2004 12:52:30 -0000 Received: from unknown (HELO svr68.ehostpros.com) (67.15.48.48) by sourceware.org with SMTP; 21 Oct 2004 12:52:30 -0000 Received: from [61.11.18.135] (helo=pythagoras) by svr68.ehostpros.com with esmtpsa (TLSv1:RC4-MD5:128) (Exim 4.43) id 1CKcQV-0000cT-1s for gdb@sources.redhat.com; Thu, 21 Oct 2004 05:52:19 -0700 From: "Amit S. Kale" Organization: LinSysSoft Technologies Pvt Ltd To: GDB discussions Subject: kgdb support for gdb: patch 1 Date: Thu, 21 Oct 2004 17:22:00 -0000 User-Agent: KMail/1.5 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_8C7dBr0AJZBjcQf" Message-Id: <200410211821.08680.amitkale@linsyssoft.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - svr68.ehostpros.com X-AntiAbuse: Original Domain - sources.redhat.com X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - linsyssoft.com X-Source: X-Source-Args: X-Source-Dir: X-SW-Source: 2004-10/txt/msg00394.txt.bz2 --Boundary-00=_8C7dBr0AJZBjcQf Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 475 Hi, I have been working on the changes suggested by Mark K and Andrew C. Here is the first patch. This adds support for a new osabi for linux kernel. I haven't added any support for detecting kernel osabi automatically. Detecting it with present kernel binary structure is rather shaky. It's safer to let users run the command "set osabi Linux-kernel". I'll be later sending more patches. Please review it and let me know if it's ok for inclusion in gdb. Thanks. -Amit --Boundary-00=_8C7dBr0AJZBjcQf Content-Type: text/x-diff; charset="us-ascii"; name="lk.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="lk.patch" Content-length: 2225 Index: gdb/gdb/i386-linux-tdep.c =================================================================== --- gdb.orig/gdb/i386-linux-tdep.c 2004-08-07 02:28:28.000000000 +0530 +++ gdb/gdb/i386-linux-tdep.c 2004-10-21 18:18:18.000000000 +0530 @@ -27,6 +27,7 @@ #include "inferior.h" #include "osabi.h" #include "reggroups.h" +#include "elf-bfd.h" #include "gdb_string.h" @@ -416,6 +417,26 @@ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver); } +static void +i386_linuxkernel_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + /* Linux Kernel uses ELF format for vmlinux file. */ + i386_elf_init_abi (info, gdbarch); + + set_gdbarch_num_regs (gdbarch, I386_LINUX_NUM_REGS); + set_gdbarch_register_name (gdbarch, i386_linux_register_name); + set_gdbarch_register_reggroup_p (gdbarch, i386_linux_register_reggroup_p); + + tdep->gregset_reg_offset = i386_linux_gregset_reg_offset; + tdep->gregset_num_regs = ARRAY_SIZE (i386_linux_gregset_reg_offset); + tdep->sizeof_gregset = 17 * 4; + + tdep->jb_pc_offset = 20; /* From . */ + +} + /* Provide a prototype to silence -Wmissing-prototypes. */ extern void _initialize_i386_linux_tdep (void); @@ -424,4 +445,6 @@ { gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_LINUX, i386_linux_init_abi); + gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_LINUXKERNEL, + i386_linuxkernel_init_abi); } Index: gdb/gdb/defs.h =================================================================== --- gdb.orig/gdb/defs.h 2004-10-12 15:36:14.000000000 +0530 +++ gdb/gdb/defs.h 2004-10-21 18:14:02.000000000 +0530 @@ -1031,6 +1031,7 @@ GDB_OSABI_SOLARIS, GDB_OSABI_OSF1, GDB_OSABI_LINUX, + GDB_OSABI_LINUX_KERNEL, GDB_OSABI_FREEBSD_AOUT, GDB_OSABI_FREEBSD_ELF, GDB_OSABI_NETBSD_AOUT, Index: gdb/gdb/osabi.c =================================================================== --- gdb.orig/gdb/osabi.c 2004-07-03 02:57:17.000000000 +0530 +++ gdb/gdb/osabi.c 2004-10-21 18:14:02.000000000 +0530 @@ -57,6 +57,7 @@ "Solaris", "OSF/1", "GNU/Linux", + "Linux-kernel", "FreeBSD a.out", "FreeBSD ELF", "NetBSD a.out", --Boundary-00=_8C7dBr0AJZBjcQf--