diff options
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/coffread.c | 2 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 16 | ||||
-rw-r--r-- | gdb/elfread.c | 2 | ||||
-rw-r--r-- | gdb/symfile.h | 2 |
5 files changed, 29 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2ad5ec2..6ce0ef9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2007-10-21 Daniel Jacobowitz <dan@codesourcery.com> + + * coffread.c (coff_symfile_finish): Call dwarf2_free_objfile. + * dwarf2read.c (dwarf2_free_objfile): New. + * elfread.c (elf_symfile_finish): Call dwarf2_free_objfile. + * symfile.h (dwarf2_free_objfile): Declare. + 2007-10-21 Joel Brobecker <brobecker@adacore.com> * hppa-hpux-nat.c (hppa_hpux_store_register): Add missing semi-colon. diff --git a/gdb/coffread.c b/gdb/coffread.c index c492749..d1a4246 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -665,6 +665,8 @@ coff_symfile_finish (struct objfile *objfile) /* Let stabs reader clean up */ stabsread_clear_cache (); + + dwarf2_free_objfile (objfile); } diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index e5e8aa4..dbbe019 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -9964,6 +9964,22 @@ free_one_cached_comp_unit (void *target_cu) } } +/* Release all extra memory associated with OBJFILE. */ + +void +dwarf2_free_objfile (struct objfile *objfile) +{ + dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key); + + if (dwarf2_per_objfile == NULL) + return; + + /* Cached DIE trees use xmalloc and the comp_unit_obstack. */ + free_cached_comp_units (NULL); + + /* Everything else should be on the objfile obstack. */ +} + /* A pair of DIE offset and GDB type pointer. We store these in a hash table separate from the DIEs, and preserve them when the DIEs are flushed out of cache. */ diff --git a/gdb/elfread.c b/gdb/elfread.c index 7b317b8..e479a76 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -709,6 +709,8 @@ elf_symfile_finish (struct objfile *objfile) { xfree (objfile->deprecated_sym_stab_info); } + + dwarf2_free_objfile (objfile); } /* ELF specific initialization routine for reading symbols. diff --git a/gdb/symfile.h b/gdb/symfile.h index fd14215..8876df2 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -365,6 +365,8 @@ extern int dwarf2_has_info (struct objfile *); extern void dwarf2_build_psymtabs (struct objfile *, int); extern void dwarf2_build_frame_info (struct objfile *); +void dwarf2_free_objfile (struct objfile *); + /* From mdebugread.c */ /* Hack to force structures to exist before use in parameter list. */ |