aboutsummaryrefslogtreecommitdiff
path: root/gdb/source.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2021-05-17 12:55:18 -0600
committerTom Tromey <tromey@adacore.com>2021-05-17 13:01:42 -0600
commit473ab96443eaf08f1a56c116c82410de2022c29b (patch)
tree99609fd2b1cd5f3103f2a4303537d87aecd1cf1a /gdb/source.c
parent16e0020bfc845d87f2f3584414c4efa2454f8d05 (diff)
downloadbinutils-473ab96443eaf08f1a56c116c82410de2022c29b.zip
binutils-473ab96443eaf08f1a56c116c82410de2022c29b.tar.gz
binutils-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/source.c')
0 files changed, 0 insertions, 0 deletions