From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20421 invoked by alias); 15 Feb 2006 11:05:44 -0000 Received: (qmail 20408 invoked by uid 22791); 15 Feb 2006 11:05:43 -0000 X-Spam-Check-By: sourceware.org Received: from svr68.ehostpros.com (HELO svr68.ehostpros.com) (67.15.48.48) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 15 Feb 2006 11:05:43 +0000 Received: from [59.95.0.90] (helo=titan.linsyssoft.com) by svr68.ehostpros.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.52) id 1F9KTb-0006VA-KZ for gdb-patches@sources.redhat.com; Wed, 15 Feb 2006 03:05:40 -0800 Received: from krypton (krypton [192.168.1.13] (may be forged)) by titan.linsyssoft.com (8.13.1/8.13.1) with ESMTP id k1FApb1N005033 for ; Wed, 15 Feb 2006 16:21:37 +0530 Subject: [PATCH] Read arm core files From: Girish Shilamkar To: gdb-patches@sources.redhat.com Content-Type: multipart/mixed; boundary="=-rVIxbIbwlwsLDC8PEZQS" Date: Wed, 15 Feb 2006 11:05:00 -0000 Message-Id: <1140001485.3359.12.camel@krypton> Mime-Version: 1.0 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/msg00314.txt.bz2 --=-rVIxbIbwlwsLDC8PEZQS Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 61 Hi, The patch enables gdb to read arm core files. -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 Content-length: 3684 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--