From: Girish Shilamkar <girish@linsyssoft.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] Read arm core files
Date: Wed, 15 Feb 2006 11:05:00 -0000 [thread overview]
Message-ID: <1140001485.3359.12.camel@krypton> (raw)
[-- Attachment #1: Type: text/plain, Size: 61 bytes --]
Hi,
The patch enables gdb to read arm core files.
-Girish.
[-- Attachment #2: gdb-6.4-arm-core.patch --]
[-- Type: text/x-patch, Size: 3684 bytes --]
2006-02-15 Girish Shilamkar <girish@linsyssoft.com>
* arm-linux-tdep.c Core file handler has been added.
* config/arm/linux.mt Compiles corelow.c required for
deprecated_add_core_fns
Index: cvs-6.4/gdb/arm-linux-tdep.c
===================================================================
--- cvs-6.4.orig/gdb/arm-linux-tdep.c 2006-01-15 13:28:58.000000000 -0500
+++ cvs-6.4/gdb/arm-linux-tdep.c 2006-02-15 05:34:38.200467944 -0500
@@ -70,6 +70,18 @@
#define ARM_LINUX_JB_ELEMENT_SIZE INT_REGISTER_SIZE
#define ARM_LINUX_JB_PC 21
+/* Following enums used to implement the core file support. */
+enum {
+ ELF_NGREG = 18, /* core reg size is 72 */
+ ELF_NFPREG = 33,
+ ELF_NVRREG = 33
+};
+
+enum {
+ ELF_GREGSET_SIZE = (ELF_NGREG * 4),
+ ELF_FPREGSET_SIZE = (ELF_NFPREG * 12) /* FP_REGISTER_SIZE is 12 */
+};
+
/* Extract from an array REGBUF containing the (raw) register state
a function return value of type TYPE, and copy that, in virtual format,
into VALBUF. */
@@ -372,8 +384,74 @@
}
void
+arm_linux_supply_gregset (char *buf)
+{
+ int regi;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+
+ for (regi = 0; regi < 16; regi++)
+ regcache_raw_supply(current_regcache, regi, buf + 4 * regi);
+
+ regcache_raw_supply (current_regcache, ARM_FPS_REGNUM, buf + 4 * 16);
+ regcache_raw_supply (current_regcache, ARM_PS_REGNUM, buf + 4 * 17);
+}
+
+void
+arm_linux_supply_fpregset (char *buf)
+{
+ int regi;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+
+ for (regi = 0; regi < 32; regi++)
+ regcache_raw_supply (current_regcache, FP0_REGNUM + regi, buf + 8 * regi);
+}
+
+/*
+ Use a local version of this function to get the correct types for regsets.
+*/
+
+static void
+fetch_core_registers (char *core_reg_sect,
+ unsigned core_reg_size,
+ int which,
+ CORE_ADDR reg_addr)
+{
+ if (which == 0)
+ {
+ /* handle Integer register set */
+ if (core_reg_size == ELF_GREGSET_SIZE)
+ arm_linux_supply_gregset (core_reg_sect);
+ else
+ warning ("wrong size gregset struct in core file");
+ }
+ else if (which == 2)
+ {
+ /* handle Floating point register set */
+ if (core_reg_size == ELF_FPREGSET_SIZE)
+ arm_linux_supply_fpregset (core_reg_sect);
+ else
+ warning ("wrong size fpregset struct in core file");
+ }
+}
+
+/* Register that we are able to handle ELF file formats using standard
+ procfs "regset" structures. */
+
+static struct core_fns arm_linux_regset_core_fns =
+{
+ bfd_target_elf_flavour, /* core_flavour */
+ default_check_format, /* check_format */
+ default_core_sniffer, /* core_sniffer */
+ fetch_core_registers, /* core_read_registers */
+ NULL /* next */
+};
+
+void
_initialize_arm_linux_tdep (void)
{
gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_LINUX,
arm_linux_init_abi);
+
+ /* register core file handling functions */
+ deprecated_add_core_fns (&arm_linux_regset_core_fns);
}
Index: cvs-6.4/gdb/config/arm/linux.mt
===================================================================
--- cvs-6.4.orig/gdb/config/arm/linux.mt 2005-02-09 10:58:50.000000000 -0500
+++ cvs-6.4/gdb/config/arm/linux.mt 2006-02-15 04:59:40.934300864 -0500
@@ -1,3 +1,3 @@
# Target: ARM based machine running GNU/Linux
DEPRECATED_TM_FILE= tm-linux.h
-TDEPFILES= arm-tdep.o arm-linux-tdep.o glibc-tdep.o solib.o solib-svr4.o solib-legacy.o symfile-mem.o
+TDEPFILES= arm-tdep.o arm-linux-tdep.o glibc-tdep.o solib.o solib-svr4.o solib-legacy.o symfile-mem.o corelow.o
next reply other threads:[~2006-02-15 11:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-15 11:05 Girish Shilamkar [this message]
2006-02-15 11:51 ` Richard Earnshaw
2006-02-15 13:05 ` Girish Shilamkar
2006-02-15 11:55 ` Mark Kettenis
2006-02-24 14:01 ` Girish Shilamkar
2006-02-24 22:41 ` Mark Kettenis
2006-03-08 15:38 ` Girish Shilamkar
2006-03-13 20:21 ` Girish Shilamkar
2006-03-14 3:36 ` Daniel Jacobowitz
[not found] ` <1142260008.2867.13.camel@krypton>
2006-03-14 15:44 ` Daniel Jacobowitz
[not found] ` <20060313202419.GB24419@nevyn.them.org>
2006-03-15 14:47 ` Girish Shilamkar
2006-03-15 16:11 ` Daniel Jacobowitz
2006-02-25 4:38 ` Randolph Chung
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1140001485.3359.12.camel@krypton \
--to=girish@linsyssoft.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox