diff options
author | Tom Tromey <tromey@adacore.com> | 2021-05-17 12:55:18 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2021-05-17 13:01:42 -0600 |
commit | 473ab96443eaf08f1a56c116c82410de2022c29b (patch) | |
tree | 99609fd2b1cd5f3103f2a4303537d87aecd1cf1a /gdb/ChangeLog | |
parent | 16e0020bfc845d87f2f3584414c4efa2454f8d05 (diff) | |
download | gdb-473ab96443eaf08f1a56c116c82410de2022c29b.zip gdb-473ab96443eaf08f1a56c116c82410de2022c29b.tar.gz gdb-473ab96443eaf08f1a56c116c82410de2022c29b.tar.bz2 |
Change how dwarf2_per_cu_data is deleted
Address sanitizer pointed out that the patch to use 'delete' for
dwarf2_per_cu_data introduced a bug -- now it is possible to delete a
signatured_type using a pointer to its base class.
This patch fixes the problem by introducing a deleter and a unique_ptr
specialization. A virtual destructor would be more ordinary here, but
it seemed wasteful to add a vtable just for this purpose. If virtual
methods are ever needed here, we can revisit this.
2021-05-17 Tom Tromey <tromey@adacore.com>
* dwarf2/read.h (struct dwarf2_per_cu_data_deleter: New.
(dwarf2_per_cu_data_up): New typedef.
(struct dwarf2_per_bfd) <allocate_per_cu>: Change return type.
<all_comp_units>: Use dwarf2_per_cu_data_up.
* dwarf2/read.c (dwarf2_per_cu_data::operator()): New function.
(dwarf2_per_bfd::allocate_per_cu): Return dwarf2_per_cu_data_up.
(create_cu_from_index_list): Likewise.
(create_signatured_type_table_from_index)
(create_cus_from_debug_names_list, add_type_unit)
(read_comp_units_from_section): Update.
(dwarf2_find_containing_comp_unit): Change type of all_comp_units.
(run_test): Update.
Diffstat (limited to 'gdb/ChangeLog')
-rw-r--r-- | gdb/ChangeLog | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b4fd2bb..b274364 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +2021-05-17 Tom Tromey <tromey@adacore.com> + + * dwarf2/read.h (struct dwarf2_per_cu_data_deleter: New. + (dwarf2_per_cu_data_up): New typedef. + (struct dwarf2_per_bfd) <allocate_per_cu>: Change return type. + <all_comp_units>: Use dwarf2_per_cu_data_up. + * dwarf2/read.c (dwarf2_per_cu_data::operator()): New function. + (dwarf2_per_bfd::allocate_per_cu): Return dwarf2_per_cu_data_up. + (create_cu_from_index_list): Likewise. + (create_signatured_type_table_from_index) + (create_cus_from_debug_names_list, add_type_unit) + (read_comp_units_from_section): Update. + (dwarf2_find_containing_comp_unit): Change type of all_comp_units. + (run_test): Update. + 2021-05-17 Tom Tromey <tom@tromey.com> * dwarf2/read.c (tu_abbrev_offset::operator<): New method. |