aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile-mem.c
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2014-06-02 11:35:22 +0200
committerMarkus Metzger <markus.t.metzger@intel.com>2014-06-06 09:40:02 +0200
commitc33b2f12584e8ae5be0e7a54927194d6b5851623 (patch)
treedeb833c67b35e54cd9b0dac52132b84be1ea86d0 /gdb/symfile-mem.c
parent34fd659b79bed7333311a092e18f990e3bd31b2f (diff)
downloadgdb-c33b2f12584e8ae5be0e7a54927194d6b5851623.zip
gdb-c33b2f12584e8ae5be0e7a54927194d6b5851623.tar.gz
gdb-c33b2f12584e8ae5be0e7a54927194d6b5851623.tar.bz2
symfile, vdso: remove target sections
Target sections added by the add-symbol-file-from-memory command are not removed when the process exits. In fact, they are not removed, at all. This causes GDB to crash in gdb.base/break-interp.exp. Change the owner of those target sections to the object file generated in symbol_file_add_from_memory and generalize the free_objfile observer in symfile.c to remove target sections of any freed object file.
Diffstat (limited to 'gdb/symfile-mem.c')
-rw-r--r--gdb/symfile-mem.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index b29421e..ef48f7d 100644
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -92,7 +92,6 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr,
struct section_addr_info *sai;
unsigned int i;
struct cleanup *cleanup;
- struct target_section *sections, *sections_end, *tsec;
if (bfd_get_flavour (templ) != bfd_target_elf_flavour)
error (_("add-symbol-file-from-memory not supported for this target"));
@@ -132,22 +131,7 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr,
from_tty ? SYMFILE_VERBOSE : 0,
sai, OBJF_SHARED, NULL);
- sections = NULL;
- sections_end = NULL;
-
- if (build_section_table (nbfd, &sections, &sections_end) == 0)
- {
- make_cleanup (xfree, sections);
-
- /* Adjust the target section addresses by the load address. */
- for (tsec = sections; tsec != sections_end; ++tsec)
- {
- tsec->addr += loadbase;
- tsec->endaddr += loadbase;
- }
-
- add_target_sections (&nbfd, sections, sections_end);
- }
+ add_target_sections_of_objfile (objf);
/* This might change our ideas about frames already looked at. */
reinit_frame_cache ();