From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8889 invoked by alias); 13 Mar 2006 12:53:42 -0000 Received: (qmail 8653 invoked by uid 22791); 13 Mar 2006 12:53:39 -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; Mon, 13 Mar 2006 12:53:33 +0000 Received: from [61.11.18.135] (helo=titan.linsyssoft.com) by svr68.ehostpros.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.52) id 1FImYC-0004Fn-Cj for gdb-patches@sources.redhat.com; Mon, 13 Mar 2006 04:53:29 -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 k2DCcaN4005821 for ; Mon, 13 Mar 2006 18:08:36 +0530 Subject: Re: [PATCH] Read arm core files From: Girish Shilamkar To: gdb-patches@sources.redhat.com In-Reply-To: <1141803193.3302.8.camel@krypton> References: <1140001485.3359.12.camel@krypton> <200602151155.k1FBtPsV003683@elgar.sibelius.xs4all.nl> <1140781305.3228.13.camel@krypton> <200602241929.k1OJT0ie013339@elgar.sibelius.xs4all.nl> <1141803193.3302.8.camel@krypton> Content-Type: multipart/mixed; boundary="=-f1Ojl0qA1rc5m0afKt2G" Date: Mon, 13 Mar 2006 20:21:00 -0000 Message-Id: <1142254121.2867.4.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-03/txt/msg00179.txt.bz2 --=-f1Ojl0qA1rc5m0afKt2G Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 335 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. --=-f1Ojl0qA1rc5m0afKt2G Content-Disposition: attachment; filename=arm-core.patch Content-Type: text/x-patch; name=arm-core.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 5187 2006-03-08 Girish Shilamkar * 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) \ --=-f1Ojl0qA1rc5m0afKt2G--