This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Alternate approach to keeping convenience variables


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  <dan@codesourcery.com>
> 
> 	* 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  <dan@codesourcery.com>

	* 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
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]