* [PATCH] Read arm core files
@ 2006-02-15 11:05 Girish Shilamkar
2006-02-15 11:51 ` Richard Earnshaw
2006-02-15 11:55 ` Mark Kettenis
0 siblings, 2 replies; 13+ messages in thread
From: Girish Shilamkar @ 2006-02-15 11:05 UTC (permalink / raw)
To: gdb-patches
[-- 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
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH] Read arm core files 2006-02-15 11:05 [PATCH] Read arm core files Girish Shilamkar @ 2006-02-15 11:51 ` Richard Earnshaw 2006-02-15 13:05 ` Girish Shilamkar 2006-02-15 11:55 ` Mark Kettenis 1 sibling, 1 reply; 13+ messages in thread From: Richard Earnshaw @ 2006-02-15 11:51 UTC (permalink / raw) To: Girish Shilamkar; +Cc: gdb-patches On Wed, 2006-02-15 at 11:04, Girish Shilamkar wrote: > Hi, > The patch enables gdb to read arm core files. > -Girish. Girish, This needs some work yet before it can be accepted. BTW, do you have a copyright assignment in place? If not, then we will need one before we can proceed any further. Finally, please make sure your patches are against the most recent version of CVS rather than a release. We don't incorporate new code onto existing releases. R. 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 Please take a closer look at existing ChangeLog entries and try to copy the style there. All entries are of the form * <file modified>: (<function modified>) Sentence describing change, ending with full stop. +/* Following enums used to implement the core file support. */ Two spaces at the end of a sentence, even if it ends the entire comment. Your sentence isn't grammatically correct either: "The following enums are used to implement core file support." +enum { + ELF_NGREG = 18, /* core reg size is 72 */ All comments start with a capital letter. void +arm_linux_supply_gregset (char *buf) All functions must have a comment that precedes them describing what they do -- even in cases like this where it is fairly obvious. + regcache_raw_supply (current_regcache, FP0_REGNUM + regi, buf + 8 * regi); Watch out for line length. Wrap your code *before* you reach column 80. + warning ("wrong size gregset struct in core file"); You need to take care of i18n here. Wrap your strings thus _("My string for translation"). ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Read arm core files 2006-02-15 11:51 ` Richard Earnshaw @ 2006-02-15 13:05 ` Girish Shilamkar 0 siblings, 0 replies; 13+ messages in thread From: Girish Shilamkar @ 2006-02-15 13:05 UTC (permalink / raw) To: Richard Earnshaw; +Cc: gdb-patches > Finally, please make sure your patches are against the most recent > version of CVS rather than a release. We don't incorporate new code > onto existing releases. > Yes, the patch is for latest version, i.e. 6.4.50.20060215-cvs -Girish. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Read arm core files 2006-02-15 11:05 [PATCH] Read arm core files Girish Shilamkar 2006-02-15 11:51 ` Richard Earnshaw @ 2006-02-15 11:55 ` Mark Kettenis 2006-02-24 14:01 ` Girish Shilamkar 1 sibling, 1 reply; 13+ messages in thread From: Mark Kettenis @ 2006-02-15 11:55 UTC (permalink / raw) To: girish; +Cc: gdb-patches > From: Girish Shilamkar <girish@linsyssoft.com> > Date: Wed, 15 Feb 2006 16:34:45 +0530 > > Hi, > The patch enables gdb to read arm core files. Whoa, GDB doesn't support reading core files on ARM Linux? This is incredible but it sure looks as if it's true. Unfortunately your patch isn't quite right. You can't use deprecated_add_core_fns(), since it is, well, deprecated. Please implement arm_linux_regset_from_core_section(). I think the simplest example on how to implement it is in vax_regset_from_core_section(). Also please rename the ELF_XXX you're using into ARM_ELF_XXX to avoid potential clashes with Linux system header files. Mark > -Girish. > > > --=-rVIxbIbwlwsLDC8PEZQS > Content-Disposition: attachment; filename=gdb-6.4-arm-core.patch > Content-Type: text/x-patch; name=gdb-6.4-arm-core.patch; charset=UTF-8 > Content-Transfer-Encoding: 7bit > > 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 > > --=-rVIxbIbwlwsLDC8PEZQS-- > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Read arm core files 2006-02-15 11:55 ` Mark Kettenis @ 2006-02-24 14:01 ` Girish Shilamkar 2006-02-24 22:41 ` Mark Kettenis 2006-02-25 4:38 ` Randolph Chung 0 siblings, 2 replies; 13+ messages in thread From: Girish Shilamkar @ 2006-02-24 14:01 UTC (permalink / raw) To: Mark Kettenis, Richard Earnshaw; +Cc: gdb-patches [-- Attachment #1: Type: text/plain, Size: 222 bytes --] Hi, Thank you very much, Mark Kettenis and Richard Earnshaw, for your suggestions. I have modified the patch as per your instructions. Please let me know if there are more changes to be done. Regards, -Girish Shilamkar. [-- Attachment #2: arm-core.patch --] [-- Type: text/x-patch, Size: 4294 bytes --] 2006-02-24 Girish Shilamkar <girish@linsyssoft.com> * arm-linux-tdep.c (arm_linux_supply_gregset): Supply general purpose register set to register cache. (arm_linux_supply_fpregset): Supply floating-point register set to register cache. (arm_linux_regset_from_core_section): Return the appropriate register set for the core section. * config/arm/linux.mt: Add corelow.o. Index: cvs-6.4/gdb/arm-linux-tdep.c =================================================================== --- cvs-6.4.orig/gdb/arm-linux-tdep.c 2006-02-24 03:22:21.000000000 -0500 +++ cvs-6.4/gdb/arm-linux-tdep.c 2006-02-24 05:51:21.819726224 -0500 @@ -33,6 +33,7 @@ #include "osabi.h" #include "trad-frame.h" #include "tramp-frame.h" +#include "regset.h" #include "arm-tdep.h" #include "glibc-tdep.h" @@ -230,6 +231,18 @@ #define ARM_SET_R7_RT_SIGRETURN 0xe3a070ad #define ARM_EABI_SYSCALL 0xef000000 +/* The following enums are used to implement the core file support. */ +enum { + ARM_ELF_NGREG = 18, + ARM_ELF_NFPREG = 33, + ARM_ELF_NVRREG = 33 +}; + +enum { + ARM_ELF_GREGSET_SIZE = (ARM_ELF_NGREG * 4), + ARM_ELF_FPREGSET_SIZE = (ARM_ELF_NFPREG * 12) +}; + static void arm_linux_sigtramp_cache (struct frame_info *next_frame, struct trad_frame_cache *this_cache, @@ -315,6 +328,69 @@ arm_linux_rt_sigreturn_init }; +/* Supply register REGNUM from the buffer specified by GREGS and LEN + in the general-purpose register set REGSET to register cache + REGCACHE. */ + +void +arm_linux_supply_gregset (const struct regset *regset, + struct regcache * regcache, + int regnum, const void *gregs, size_t size) +{ + int regi; + const bfd_byte *buf = gregs; + + for (regi = 0; regi < 16; regi++) + regcache_raw_supply(regcache, regi, buf + 4 * regi); + + regcache_raw_supply (regcache, ARM_FPS_REGNUM, buf + 4 * 16); + regcache_raw_supply (regcache, ARM_PS_REGNUM, buf + 4 * 17); +} + +static struct regset arm_linux_gregset = { + NULL, + arm_linux_supply_gregset +}; + +/* Supply register REGNUM from the buffer specified by FPREGS and LEN + in the floating-point register set REGSET to register cache + REGCACHE. */ + +void +arm_linux_supply_fpregset (const struct regset *regset, + struct regcache * regcache, + int regnum, const void *fpregs, size_t size) +{ + int regi; + const bfd_byte *buf = fpregs; + + for (regi = 0; regi < 32; regi++) + regcache_raw_supply (regcache, FP0_REGNUM + regi, buf + 8 * regi); +} + +static struct regset arm_linux_fpregset = { + NULL, + arm_linux_supply_fpregset +}; + +/* Return the appropriate register set for the core section identified + by SECT_NAME and SECT_SIZE. */ + +static const struct regset * +arm_linux_regset_from_core_section (struct gdbarch *core_arch, + const char *sect_name, size_t sect_size) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (core_arch); + + if (strcmp (sect_name, ".reg") == 0 && sect_size == ARM_ELF_GREGSET_SIZE) + return &arm_linux_gregset; + + if (strcmp (sect_name, ".reg2") == 0 && sect_size == ARM_ELF_FPREGSET_SIZE) + return &arm_linux_fpregset; + + return NULL; +} + static void arm_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) @@ -361,6 +437,9 @@ set_gdbarch_fetch_tls_load_module_address (gdbarch, svr4_fetch_objfile_link_map); + set_gdbarch_regset_from_core_section + (gdbarch, arm_linux_regset_from_core_section); + tramp_frame_prepend_unwinder (gdbarch, &arm_linux_sigreturn_tramp_frame); tramp_frame_prepend_unwinder (gdbarch, Index: cvs-6.4/gdb/config/arm/linux.mt =================================================================== --- cvs-6.4.orig/gdb/config/arm/linux.mt 2006-02-24 03:22:21.000000000 -0500 +++ cvs-6.4/gdb/config/arm/linux.mt 2006-02-24 03:22:27.000000000 -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 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Read arm core files 2006-02-24 14:01 ` Girish Shilamkar @ 2006-02-24 22:41 ` Mark Kettenis 2006-03-08 15:38 ` Girish Shilamkar 2006-02-25 4:38 ` Randolph Chung 1 sibling, 1 reply; 13+ messages in thread From: Mark Kettenis @ 2006-02-24 22:41 UTC (permalink / raw) To: girish; +Cc: rearnsha, gdb-patches > From: Girish Shilamkar <girish@linsyssoft.com> > Date: Fri, 24 Feb 2006 17:11:44 +0530 > > Hi, > Thank you very much, Mark Kettenis and Richard Earnshaw, for your > suggestions. I have modified the patch as per your instructions. Please > let me know if there are more changes to be done. Looks good to me, although I can't really judge the ARM-specific bits. > 2006-02-24 Girish Shilamkar <girish@linsyssoft.com> > > * arm-linux-tdep.c (arm_linux_supply_gregset): Supply general purpose > register set to register cache. > (arm_linux_supply_fpregset): Supply floating-point register set to > register cache. > (arm_linux_regset_from_core_section): Return the appropriate register > set for the core section. > * config/arm/linux.mt: Add corelow.o. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Read arm core files 2006-02-24 22:41 ` Mark Kettenis @ 2006-03-08 15:38 ` Girish Shilamkar 2006-03-13 20:21 ` Girish Shilamkar 0 siblings, 1 reply; 13+ messages in thread From: Girish Shilamkar @ 2006-03-08 15:38 UTC (permalink / raw) To: tausq; +Cc: rearnsha, Mark Kettenis, gdb-patches [-- Attachment #1: Type: text/plain, Size: 163 bytes --] Hi, Thanks Randolph, I have added $(regset_h) to the dependency list of arm-linux-tdep.o in Makefile.in. I have attached the updated patch. Regards, -Girish. [-- Attachment #2: arm-core.patch --] [-- Type: text/x-patch, Size: 5187 bytes --] 2006-03-08 Girish Shilamkar <girish@linsyssoft.com> * arm-linux-tdep.c (arm_linux_supply_gregset): Supply general purpose register set to register cache. (arm_linux_supply_fpregset): Supply floating-point register set to register cache. (arm_linux_regset_from_core_section): Return the appropriate register set for the core section. * config/arm/linux.mt: Add corelow.o. * Makefile.in: Add $(regset_h) to dependency list of arm-linux-tdep.o. Index: cvs-6.4/gdb/arm-linux-tdep.c =================================================================== --- cvs-6.4.orig/gdb/arm-linux-tdep.c 2006-02-24 06:11:11.000000000 -0500 +++ cvs-6.4/gdb/arm-linux-tdep.c 2006-03-08 02:13:20.712798880 -0500 @@ -33,6 +33,7 @@ #include "osabi.h" #include "trad-frame.h" #include "tramp-frame.h" +#include "regset.h" #include "arm-tdep.h" #include "glibc-tdep.h" @@ -230,6 +231,18 @@ #define ARM_SET_R7_RT_SIGRETURN 0xe3a070ad #define ARM_EABI_SYSCALL 0xef000000 +/* The following enums are used to implement the core file support. */ +enum { + ARM_ELF_NGREG = 18, + ARM_ELF_NFPREG = 33, + ARM_ELF_NVRREG = 33 +}; + +enum { + ARM_ELF_GREGSET_SIZE = (ARM_ELF_NGREG * 4), + ARM_ELF_FPREGSET_SIZE = (ARM_ELF_NFPREG * 12) +}; + static void arm_linux_sigtramp_cache (struct frame_info *next_frame, struct trad_frame_cache *this_cache, @@ -315,6 +328,69 @@ arm_linux_rt_sigreturn_init }; +/* Supply register REGNUM from the buffer specified by GREGS and LEN + in the general-purpose register set REGSET to register cache + REGCACHE. */ + +void +arm_linux_supply_gregset (const struct regset *regset, + struct regcache * regcache, + int regnum, const void *gregs, size_t size) +{ + int regi; + const bfd_byte *buf = gregs; + + for (regi = 0; regi < 16; regi++) + regcache_raw_supply(regcache, regi, buf + 4 * regi); + + regcache_raw_supply (regcache, ARM_FPS_REGNUM, buf + 4 * 16); + regcache_raw_supply (regcache, ARM_PS_REGNUM, buf + 4 * 17); +} + +static struct regset arm_linux_gregset = { + NULL, + arm_linux_supply_gregset +}; + +/* Supply register REGNUM from the buffer specified by FPREGS and LEN + in the floating-point register set REGSET to register cache + REGCACHE. */ + +void +arm_linux_supply_fpregset (const struct regset *regset, + struct regcache * regcache, + int regnum, const void *fpregs, size_t size) +{ + int regi; + const bfd_byte *buf = fpregs; + + for (regi = 0; regi < 32; regi++) + regcache_raw_supply (regcache, FP0_REGNUM + regi, buf + 8 * regi); +} + +static struct regset arm_linux_fpregset = { + NULL, + arm_linux_supply_fpregset +}; + +/* Return the appropriate register set for the core section identified + by SECT_NAME and SECT_SIZE. */ + +static const struct regset * +arm_linux_regset_from_core_section (struct gdbarch *core_arch, + const char *sect_name, size_t sect_size) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (core_arch); + + if (strcmp (sect_name, ".reg") == 0 && sect_size == ARM_ELF_GREGSET_SIZE) + return &arm_linux_gregset; + + if (strcmp (sect_name, ".reg2") == 0 && sect_size == ARM_ELF_FPREGSET_SIZE) + return &arm_linux_fpregset; + + return NULL; +} + static void arm_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) @@ -361,6 +437,9 @@ set_gdbarch_fetch_tls_load_module_address (gdbarch, svr4_fetch_objfile_link_map); + set_gdbarch_regset_from_core_section + (gdbarch, arm_linux_regset_from_core_section); + tramp_frame_prepend_unwinder (gdbarch, &arm_linux_sigreturn_tramp_frame); tramp_frame_prepend_unwinder (gdbarch, Index: cvs-6.4/gdb/config/arm/linux.mt =================================================================== --- cvs-6.4.orig/gdb/config/arm/linux.mt 2006-02-24 06:11:11.000000000 -0500 +++ cvs-6.4/gdb/config/arm/linux.mt 2006-03-08 02:13:20.727796600 -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 Index: cvs-6.4/gdb/Makefile.in =================================================================== --- cvs-6.4.orig/gdb/Makefile.in 2006-03-08 02:12:38.633195952 -0500 +++ cvs-6.4/gdb/Makefile.in 2006-03-08 02:15:00.322655880 -0500 @@ -1748,7 +1748,8 @@ arm-linux-tdep.o: arm-linux-tdep.c $(defs_h) $(target_h) $(value_h) \ $(gdbtypes_h) $(floatformat_h) $(gdbcore_h) $(frame_h) $(regcache_h) \ $(doublest_h) $(solib_svr4_h) $(osabi_h) $(arm_tdep_h) \ - $(glibc_tdep_h) $(trad_frame_h) $(tramp_frame_h) $(gdb_string_h) + $(glibc_tdep_h) $(trad_frame_h) $(tramp_frame_h) $(gdb_string_h) \ + $(regset_h) armnbsd-nat.o: armnbsd-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) \ $(regcache_h) $(target_h) $(gdb_string_h) $(arm_tdep_h) $(inf_ptrace_h) armnbsd-tdep.o: armnbsd-tdep.c $(defs_h) $(osabi_h) $(gdb_string_h) \ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Read arm core files 2006-03-08 15:38 ` Girish Shilamkar @ 2006-03-13 20:21 ` Girish Shilamkar 2006-03-14 3:36 ` Daniel Jacobowitz 0 siblings, 1 reply; 13+ messages in thread From: Girish Shilamkar @ 2006-03-13 20:21 UTC (permalink / raw) To: gdb-patches [-- Attachment #1: Type: text/plain, Size: 335 bytes --] Hi, Please let me know if the patch requires more work or is it good enough. Regards, -Girish. On Wed, 2006-03-08 at 13:03 +0530, Girish Shilamkar wrote: > Hi, > Thanks Randolph, I have added $(regset_h) to the > dependency list of arm-linux-tdep.o in Makefile.in. I have attached the > updated patch. > > Regards, > -Girish. [-- Attachment #2: arm-core.patch --] [-- Type: text/x-patch, Size: 5187 bytes --] 2006-03-08 Girish Shilamkar <girish@linsyssoft.com> * arm-linux-tdep.c (arm_linux_supply_gregset): Supply general purpose register set to register cache. (arm_linux_supply_fpregset): Supply floating-point register set to register cache. (arm_linux_regset_from_core_section): Return the appropriate register set for the core section. * config/arm/linux.mt: Add corelow.o. * Makefile.in: Add $(regset_h) to dependency list of arm-linux-tdep.o. Index: cvs-6.4/gdb/arm-linux-tdep.c =================================================================== --- cvs-6.4.orig/gdb/arm-linux-tdep.c 2006-02-24 06:11:11.000000000 -0500 +++ cvs-6.4/gdb/arm-linux-tdep.c 2006-03-08 02:13:20.712798880 -0500 @@ -33,6 +33,7 @@ #include "osabi.h" #include "trad-frame.h" #include "tramp-frame.h" +#include "regset.h" #include "arm-tdep.h" #include "glibc-tdep.h" @@ -230,6 +231,18 @@ #define ARM_SET_R7_RT_SIGRETURN 0xe3a070ad #define ARM_EABI_SYSCALL 0xef000000 +/* The following enums are used to implement the core file support. */ +enum { + ARM_ELF_NGREG = 18, + ARM_ELF_NFPREG = 33, + ARM_ELF_NVRREG = 33 +}; + +enum { + ARM_ELF_GREGSET_SIZE = (ARM_ELF_NGREG * 4), + ARM_ELF_FPREGSET_SIZE = (ARM_ELF_NFPREG * 12) +}; + static void arm_linux_sigtramp_cache (struct frame_info *next_frame, struct trad_frame_cache *this_cache, @@ -315,6 +328,69 @@ arm_linux_rt_sigreturn_init }; +/* Supply register REGNUM from the buffer specified by GREGS and LEN + in the general-purpose register set REGSET to register cache + REGCACHE. */ + +void +arm_linux_supply_gregset (const struct regset *regset, + struct regcache * regcache, + int regnum, const void *gregs, size_t size) +{ + int regi; + const bfd_byte *buf = gregs; + + for (regi = 0; regi < 16; regi++) + regcache_raw_supply(regcache, regi, buf + 4 * regi); + + regcache_raw_supply (regcache, ARM_FPS_REGNUM, buf + 4 * 16); + regcache_raw_supply (regcache, ARM_PS_REGNUM, buf + 4 * 17); +} + +static struct regset arm_linux_gregset = { + NULL, + arm_linux_supply_gregset +}; + +/* Supply register REGNUM from the buffer specified by FPREGS and LEN + in the floating-point register set REGSET to register cache + REGCACHE. */ + +void +arm_linux_supply_fpregset (const struct regset *regset, + struct regcache * regcache, + int regnum, const void *fpregs, size_t size) +{ + int regi; + const bfd_byte *buf = fpregs; + + for (regi = 0; regi < 32; regi++) + regcache_raw_supply (regcache, FP0_REGNUM + regi, buf + 8 * regi); +} + +static struct regset arm_linux_fpregset = { + NULL, + arm_linux_supply_fpregset +}; + +/* Return the appropriate register set for the core section identified + by SECT_NAME and SECT_SIZE. */ + +static const struct regset * +arm_linux_regset_from_core_section (struct gdbarch *core_arch, + const char *sect_name, size_t sect_size) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (core_arch); + + if (strcmp (sect_name, ".reg") == 0 && sect_size == ARM_ELF_GREGSET_SIZE) + return &arm_linux_gregset; + + if (strcmp (sect_name, ".reg2") == 0 && sect_size == ARM_ELF_FPREGSET_SIZE) + return &arm_linux_fpregset; + + return NULL; +} + static void arm_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) @@ -361,6 +437,9 @@ set_gdbarch_fetch_tls_load_module_address (gdbarch, svr4_fetch_objfile_link_map); + set_gdbarch_regset_from_core_section + (gdbarch, arm_linux_regset_from_core_section); + tramp_frame_prepend_unwinder (gdbarch, &arm_linux_sigreturn_tramp_frame); tramp_frame_prepend_unwinder (gdbarch, Index: cvs-6.4/gdb/config/arm/linux.mt =================================================================== --- cvs-6.4.orig/gdb/config/arm/linux.mt 2006-02-24 06:11:11.000000000 -0500 +++ cvs-6.4/gdb/config/arm/linux.mt 2006-03-08 02:13:20.727796600 -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 Index: cvs-6.4/gdb/Makefile.in =================================================================== --- cvs-6.4.orig/gdb/Makefile.in 2006-03-08 02:12:38.633195952 -0500 +++ cvs-6.4/gdb/Makefile.in 2006-03-08 02:15:00.322655880 -0500 @@ -1748,7 +1748,8 @@ arm-linux-tdep.o: arm-linux-tdep.c $(defs_h) $(target_h) $(value_h) \ $(gdbtypes_h) $(floatformat_h) $(gdbcore_h) $(frame_h) $(regcache_h) \ $(doublest_h) $(solib_svr4_h) $(osabi_h) $(arm_tdep_h) \ - $(glibc_tdep_h) $(trad_frame_h) $(tramp_frame_h) $(gdb_string_h) + $(glibc_tdep_h) $(trad_frame_h) $(tramp_frame_h) $(gdb_string_h) \ + $(regset_h) armnbsd-nat.o: armnbsd-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) \ $(regcache_h) $(target_h) $(gdb_string_h) $(arm_tdep_h) $(inf_ptrace_h) armnbsd-tdep.o: armnbsd-tdep.c $(defs_h) $(osabi_h) $(gdb_string_h) \ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Read arm core files 2006-03-13 20:21 ` Girish Shilamkar @ 2006-03-14 3:36 ` Daniel Jacobowitz [not found] ` <1142260008.2867.13.camel@krypton> 0 siblings, 1 reply; 13+ messages in thread From: Daniel Jacobowitz @ 2006-03-14 3:36 UTC (permalink / raw) To: Girish Shilamkar; +Cc: gdb-patches On Mon, Mar 13, 2006 at 06:18:41PM +0530, Girish Shilamkar wrote: > Hi, > Please let me know if the patch requires more work or is it good > enough. Richard asked: > BTW, do you have a copyright assignment in place? If not, then we will > need one before we can proceed any further. I don't remember seeing a response to this, nor can I find an assignment for you or your employer. -- Daniel Jacobowitz CodeSourcery ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <1142260008.2867.13.camel@krypton>]
* Re: [PATCH] Read arm core files [not found] ` <1142260008.2867.13.camel@krypton> @ 2006-03-14 15:44 ` Daniel Jacobowitz [not found] ` <20060313202419.GB24419@nevyn.them.org> 1 sibling, 0 replies; 13+ messages in thread From: Daniel Jacobowitz @ 2006-03-14 15:44 UTC (permalink / raw) To: gdb-patches On Mon, Mar 13, 2006 at 07:56:48PM +0530, Girish Shilamkar wrote: > > > Richard asked: > > > > > BTW, do you have a copyright assignment in place? If not, then we will > > > need one before we can proceed any further. > > > > I don't remember seeing a response to this, nor can I find an > > assignment for you or your employer. > > > Ohh, those email transactions had not been cc'ed to mailing list. > I am attaching the last mail with respect to copyright assignment issue. I'll follow up on this off list. -- Daniel Jacobowitz CodeSourcery ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <20060313202419.GB24419@nevyn.them.org>]
* Re: [PATCH] Read arm core files [not found] ` <20060313202419.GB24419@nevyn.them.org> @ 2006-03-15 14:47 ` Girish Shilamkar 2006-03-15 16:11 ` Daniel Jacobowitz 0 siblings, 1 reply; 13+ messages in thread From: Girish Shilamkar @ 2006-03-15 14:47 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: Ashish Karkare, GDB patches Hi, Now since I am doing this work for TimeSys Corporation and the work is owned by TimeSys. Do I need get something signed from TimeSys with this regard ? Kindly let me know more about this. Thanks & Regards, -Girish. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Read arm core files 2006-03-15 14:47 ` Girish Shilamkar @ 2006-03-15 16:11 ` Daniel Jacobowitz 0 siblings, 0 replies; 13+ messages in thread From: Daniel Jacobowitz @ 2006-03-15 16:11 UTC (permalink / raw) To: Girish Shilamkar; +Cc: Ashish Karkare, GDB patches On Tue, Mar 14, 2006 at 08:35:23PM +0530, Girish Shilamkar wrote: > Hi, > Now since I am doing this work for TimeSys Corporation and the work is > owned by TimeSys. Do I need get something signed from TimeSys with this > regard ? > Kindly let me know more about this. I sent you some additional mail about this off list. Did you get it? Exactly what you need will depend on the contract between the two companies; I recommend you contact the FSF assignments clerk if you have a question, since only the FSF can give you a definite answer. -- Daniel Jacobowitz CodeSourcery ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Read arm core files 2006-02-24 14:01 ` Girish Shilamkar 2006-02-24 22:41 ` Mark Kettenis @ 2006-02-25 4:38 ` Randolph Chung 1 sibling, 0 replies; 13+ messages in thread From: Randolph Chung @ 2006-02-25 4:38 UTC (permalink / raw) To: gdb-patches > Thank you very much, Mark Kettenis and Richard Earnshaw, for your > suggestions. I have modified the patch as per your instructions. Please > let me know if there are more changes to be done. For this bit: > Index: cvs-6.4/gdb/arm-linux-tdep.c > =================================================================== > --- cvs-6.4.orig/gdb/arm-linux-tdep.c 2006-02-24 03:22:21.000000000 -0500 > +++ cvs-6.4/gdb/arm-linux-tdep.c 2006-02-24 05:51:21.819726224 -0500 > @@ -33,6 +33,7 @@ > #include "osabi.h" > #include "trad-frame.h" > #include "tramp-frame.h" > +#include "regset.h" I think you need to also modify Makefile.in to add $(regset_h) to the dependency list of arm-linux-tdep.o. randolph ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2006-03-14 15:44 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-15 11:05 [PATCH] Read arm core files Girish Shilamkar
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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox