From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11594 invoked by alias); 15 Feb 2006 11:55:47 -0000 Received: (qmail 11583 invoked by uid 22791); 15 Feb 2006 11:55:46 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 15 Feb 2006 11:55:34 +0000 Received: from elgar.sibelius.xs4all.nl (root@elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.4/8.13.4) with ESMTP id k1FBtQMR006724; Wed, 15 Feb 2006 12:55:26 +0100 (CET) Received: from elgar.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.13.4/8.13.3) with ESMTP id k1FBtQcC024883; Wed, 15 Feb 2006 12:55:26 +0100 (CET) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.4/8.13.4/Submit) id k1FBtPsV003683; Wed, 15 Feb 2006 12:55:25 +0100 (CET) Date: Wed, 15 Feb 2006 11:55:00 -0000 Message-Id: <200602151155.k1FBtPsV003683@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: girish@linsyssoft.com CC: gdb-patches@sources.redhat.com In-reply-to: <1140001485.3359.12.camel@krypton> (message from Girish Shilamkar on Wed, 15 Feb 2006 16:34:45 +0530) Subject: Re: [PATCH] Read arm core files References: <1140001485.3359.12.camel@krypton> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-02/txt/msg00317.txt.bz2 > From: Girish Shilamkar > 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 > > * 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-- >