diff options
author | Tom Tromey <tromey@redhat.com> | 2014-06-16 03:17:19 -0600 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2014-06-26 08:11:04 -0600 |
commit | 34a68019ccc3879801a291a00bad5bc10558bf5d (patch) | |
tree | ae644389dac8d798afccf23dc7cd440daf6c46ac /gdb/symfile.c | |
parent | 334ac421efca80df2f95960d917ea9cb5823fb18 (diff) | |
download | gdb-34a68019ccc3879801a291a00bad5bc10558bf5d.zip gdb-34a68019ccc3879801a291a00bad5bc10558bf5d.tar.gz gdb-34a68019ccc3879801a291a00bad5bc10558bf5d.tar.bz2 |
fix memory errors with demangled name hash
This fixes a regression that Jan pointed out.
The bug is that some names were allocated by dwarf2read on the objfile
obstack, but then passed to SYMBOL_SET_NAMES with copy_name=0. This
violates the invariant that the names must have a lifetime tied to the
lifetime of the BFD.
The fix is to allocate names on the per-BFD obstack.
I looked at all callers, direct or indirect, of SYMBOL_SET_NAMES that
pass copy_name=0. Note that only the ELF and DWARF readers do this;
other symbol readers were never updated (and perhaps cannot be,
depending on the details of the formats). This is why the patch is
relatively small.
Built and regtested on x86-64 Fedora 20.
2014-06-26 Tom Tromey <tromey@redhat.com>
PR symtab/16902:
* dwarf2read.c (fixup_go_packaging, dwarf2_compute_name)
(dwarf2_physname, read_partial_die)
(guess_partial_die_structure_name, fixup_partial_die)
(guess_full_die_structure_name, anonymous_struct_prefix)
(dwarf2_name): Use per-BFD obstack.
Diffstat (limited to 'gdb/symfile.c')
0 files changed, 0 insertions, 0 deletions