From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: girish@linsyssoft.com
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] Read arm core files
Date: Wed, 15 Feb 2006 11:55:00 -0000 [thread overview]
Message-ID: <200602151155.k1FBtPsV003683@elgar.sibelius.xs4all.nl> (raw)
In-Reply-To: <1140001485.3359.12.camel@krypton> (message from Girish Shilamkar on Wed, 15 Feb 2006 16:34:45 +0530)
> 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--
>
next prev parent reply other threads:[~2006-02-15 11:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-15 11:05 Girish Shilamkar
2006-02-15 11:51 ` Richard Earnshaw
2006-02-15 13:05 ` Girish Shilamkar
2006-02-15 11:55 ` Mark Kettenis [this message]
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=200602151155.k1FBtPsV003683@elgar.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=gdb-patches@sources.redhat.com \
--cc=girish@linsyssoft.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