From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12865 invoked by alias); 1 Feb 2006 23:14:41 -0000 Received: (qmail 12856 invoked by uid 22791); 1 Feb 2006 23:14:40 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Wed, 01 Feb 2006 23:14:37 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1F4RB8-0004Sn-6O; Wed, 01 Feb 2006 18:14:22 -0500 Date: Wed, 01 Feb 2006 23:14:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sourceware.org Cc: Andrew STUBBS , Jim Blandy Subject: Re: [RFC] Alternate approach to keeping convenience variables Message-ID: <20060201231422.GC14187@nevyn.them.org> Mail-Followup-To: gdb-patches@sourceware.org, Andrew STUBBS , Jim Blandy References: <4381DC75.80800@st.com> <8f2776cb0511212138g2adef40cr1632365c00e3bebc@mail.gmail.com> <43835114.5060401@st.com> <20051209205923.GA21331@nevyn.them.org> <20060122213118.GH27224@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060122213118.GH27224@nevyn.them.org> User-Agent: Mutt/1.5.8i X-IsSubscribed: yes 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/msg00012.txt.bz2 On Sun, Jan 22, 2006 at 04:31:18PM -0500, Daniel Jacobowitz wrote: > - gdbint; I couldn't find a vaguely appropriate place to add a > description of this, and I don't think it's such a fascinating > approach that it's worth creating a new section for. Eli convinced me otherwise. Eli, how does the below look? > 2006-01-22 Daniel Jacobowitz > > * Makefile.in (gdbtypes_h, gdbtypes.o, utils.o): Update. > * defs.h (hashtab_obstack_allocate, dummy_obstack_deallocate): Add > prototypes. > * dwarf2read.c (read_subroutine_type): Use TYPE_ZALLOC. > (hashtab_obstack_allocate, dummy_obstack_deallocate): Moved to... > * utils.c (hashtab_obstack_allocate, dummy_obstack_deallocate): > ...here. > * gdbtypes.c: Include "hashtab.h". > (build_gdbtypes): Remove extra prototype. > (struct type_pair, type_pair_hash, type_pair_eq) > (create_copied_types_hash, copy_type_recursive): New. > * gdbtypes.h: Include "hashtab.h". > (TYPE_ZALLOC): New. > (create_copied_types_hash, copy_type_recursive): New prototypes. > * objfiles.c (free_objfile): Call preserve_values. > * symfile.c (reread_symbols): Likewise. > (clear_symtab_users): Remove calls to clear_value_history and > clear_internalvars. > * value.c (clear_value_history, clear_internalvars): Removed. > (preserve_one_value, preserve_values): New functions. > * value.h (clear_value_history, clear_internalvars): Removed. > (preserve_values): New prototype. > > * tracepoint.c (_initialize_tracepoint): Do not initialize convenience > variables here. > > * doc/gdb.texinfo (Files): Remove obsolete bits from the description > of "symbol-file". I have committed this, after retesting it on x86_64-pc-linux-gnu. -- Daniel Jacobowitz CodeSourcery 2006-02-01 Daniel Jacobowitz * gdbint.texinfo (Symbol Handling): Add a section on memory management. Index: doc/gdbint.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v retrieving revision 1.237 diff -u -p -r1.237 gdbint.texinfo --- doc/gdbint.texinfo 25 Jan 2006 21:15:42 -0000 1.237 +++ doc/gdbint.texinfo 1 Feb 2006 22:53:51 -0000 @@ -9,7 +9,7 @@ @ifinfo This file documents the internals of the GNU debugger @value{GDBN}. Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005 + 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by Cygnus Solutions. Written by John Gilmore. Second Edition by Stan Shebs. @@ -49,7 +49,7 @@ Free Documentation License''. @vskip 0pt plus 1filll Copyright @copyright{} 1990,1991,1992,1993,1994,1996,1998,1999,2000,2001, - 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or @@ -1985,6 +1985,22 @@ will only ever be implemented by one obj directly. This interface should be described in a file @file{bfd/lib@var{xyz}.h}, which is included by @value{GDBN}. +@section Memory Management for Symbol Files + +Most memory associated with a loaded symbol file is stored on +its @code{objfile_obstack}. This includes symbols, types, +namespace data, and other information produced by the symbol readers. + +Because this data lives on the objfile's obstack, it is automatically +released when the objfile is unloaded or reloaded. Therefore one +objfile must not reference symbol or type data from another objfile; +they could be unloaded at different times. + +User convenience variables, et cetera, have associated types. Normally +these types live in the associated objfile. However, when the objfile +is unloaded, those types are deep copied to global memory, so that +the values of the user variables and history items are not lost. + @node Language Support