Allocate abbrev_table with new
authorTom Tromey <tom@tromey.com>
Sat, 6 Jan 2018 00:26:17 +0000 (17:26 -0700)
committerTom Tromey <tom@tromey.com>
Wed, 17 Jan 2018 18:28:44 +0000 (11:28 -0700)
commit685af9cd2283b07a222157723e239f09d6ea2682
tree8a2576753bd50bb2ecdd4a31f19687d1c75869d0
parent5e2db402c8e665b0c6ac81047a10cbf4e26329f2
Allocate abbrev_table with new

This changes dwarf2read.c to allocate abbrev tables using "new", and
then updates the users.

This version of the patch incorporates the changes that Simon
implemented.  These changes simplify the ownership rules for abbrev
tables.

2018-01-17  Tom Tromey  <tom@tromey.com>
    Simon Marchi  <simon.marchi@ericsson.com>

* dwarf2read.c (struct dwarf2_cu) <abbrev_table>: Remove.
(struct die_reader_specs) <abbrev_table>: New member.
(struct abbrev_table): Add constructor.
<alloc_abbrev, add_abbrev, lookup_abbrev>: Declare.
<abbrev_obstack>: Now an auto_obstack.
(abbrev_table_up): New typedef.
(init_cu_die_reader): Add abbrev_table parameter.
(read_cutu_die_from_dwo): Remove abbrev_table_provided parameter.
Add result_dwo_abbrev_table.
(init_tu_and_read_dwo_dies, init_cutu_and_read_dies)
(init_cutu_and_read_dies_no_follow, build_type_psymtabs_1):
Update.
(peek_die_abbrev): Take die_reader_specs, not dwarf_cu as
parameter.
(skip_children): Update.
(abbrev_table::alloc_abbrev): Rename from
abbrev_table_alloc_abbrev.
(abbrev_table::add_abbrev): Rename from abbrev_table_add_abbrev.
(abbrev_table::lookup_abbrev): Rename from
abbrev_table_lookup_abbrev.
(abbrev_table_read_table): Return abbrev_table_up.
(abbrev_table_free, abbrev_table_free_cleanup)
(dwarf2_read_abbrevs, dwarf2_free_abbrev_table): Remove.
(load_partial_dies): Update.
gdb/ChangeLog
gdb/dwarf2read.c