From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21780 invoked by alias); 25 Mar 2004 01:53:19 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 21772 invoked from network); 25 Mar 2004 01:53:18 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 25 Mar 2004 01:53:18 -0000 Received: from drow by nevyn.them.org with local (Exim 4.30 #1 (Debian)) id 1B6K3Z-0002eK-Me; Wed, 24 Mar 2004 20:53:17 -0500 Date: Thu, 25 Mar 2004 01:53:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Cc: cagney@gnu.org Subject: [rfa/mips] Fix reread.exp on mips-linux Message-ID: <20040325015317.GA10143@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com, cagney@gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.1i X-SW-Source: 2004-03/txt/msg00586.txt.bz2 My goof, from two years or so ago. This is allocated on the objfile obstack, and we stashed it in obj_private; but obj_private doesn't get cleared. If we put it in the new objfile_data machinery like a good little interface user, then it gets cleared at the right time. This prevents segfaulting as soon as the executable changes. OK for head/6.1? -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer 2004-03-24 Daniel Jacobowitz * mips-tdep.c (mips_pdr_data): New. (non_heuristic_proc_desc): Use objfile_data and set_objfile_data. (_initialize_mips_tdep): Initialize mips_pdr_data. Index: mips-tdep.c =================================================================== RCS file: /big/fsf/rsync/src-cvs/src/gdb/mips-tdep.c,v retrieving revision 1.285 diff -u -p -r1.285 mips-tdep.c --- mips-tdep.c 23 Mar 2004 14:47:56 -0000 1.285 +++ mips-tdep.c 25 Mar 2004 01:47:54 -0000 @@ -54,6 +54,8 @@ #include "frame-base.h" #include "trad-frame.h" +static const struct objfile_data *mips_pdr_data; + static void set_reg_offset (CORE_ADDR *saved_regs, int regnum, CORE_ADDR off); static struct type *mips_register_type (struct gdbarch *gdbarch, int regnum); @@ -2298,7 +2300,7 @@ non_heuristic_proc_desc (CORE_ADDR pc, C sec = find_pc_section (pc); if (sec != NULL) { - priv = (struct mips_objfile_private *) sec->objfile->obj_private; + priv = (struct mips_objfile_private *) objfile_data (sec->objfile, mips_pdr_data); /* Search the ".pdr" section generated by GAS. This includes most of the information normally found in ECOFF PDRs. */ @@ -2316,7 +2318,7 @@ non_heuristic_proc_desc (CORE_ADDR pc, C priv = obstack_alloc (&sec->objfile->objfile_obstack, sizeof (struct mips_objfile_private)); priv->size = 0; - sec->objfile->obj_private = priv; + set_objfile_data (sec->objfile, mips_pdr_data, priv); } else if (priv == NULL) { @@ -2344,7 +2346,7 @@ non_heuristic_proc_desc (CORE_ADDR pc, C else priv->size = 0; - sec->objfile->obj_private = priv; + set_objfile_data (sec->objfile, mips_pdr_data, priv); } the_bfd = NULL; @@ -6101,6 +6103,8 @@ _initialize_mips_tdep (void) internal_error (__FILE__, __LINE__, "mips_abi_strings out of sync"); gdbarch_register (bfd_arch_mips, mips_gdbarch_init, mips_dump_tdep); + + mips_pdr_data = register_objfile_data (); /* Add root prefix command for all "set mips"/"show mips" commands */ add_prefix_cmd ("mips", no_class, set_mips_command,