From 121efb593c239befbca90ed492492b44a695184e Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 3 Mar 2025 16:35:35 -0500 Subject: [PATCH] gdb/dwarf: remove create_cu_from_index_list I noticed that create_cu_from_index_list is only used in read-gdb-index.c, so I started by moving it there. But given that this function is use at only one spot and doesn't do much, I opted to inline its code in the caller instead. Change-Id: Iebe0dc20d345fa70a2f11aa9ff1a04fe26a31407 Approved-By: Tom Tromey --- gdb/dwarf2/read-gdb-index.c | 6 +++--- gdb/dwarf2/read.c | 14 -------------- gdb/dwarf2/read.h | 7 ------- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c index 66d7209c1dd..282ac5b4ef4 100644 --- a/gdb/dwarf2/read-gdb-index.c +++ b/gdb/dwarf2/read-gdb-index.c @@ -1324,9 +1324,9 @@ create_cus_from_gdb_index_list (dwarf2_per_bfd *per_bfd, ULONGEST length = extract_unsigned_integer (cu_list + 8, 8, BFD_ENDIAN_LITTLE); cu_list += 2 * 8; - dwarf2_per_cu_up per_cu - = create_cu_from_index_list (per_bfd, section, is_dwz, sect_off, - length); + dwarf2_per_cu_up per_cu = per_bfd->allocate_per_cu (section, sect_off, length); + per_cu->is_dwz = is_dwz; + per_bfd->all_units.push_back (std::move (per_cu)); } } diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index b2394588cb8..0bef46a10e4 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -1841,20 +1841,6 @@ dwarf2_per_bfd::allocate_signatured_type (dwarf2_section_info *section, return result; } -/* See read.h. */ - -dwarf2_per_cu_up -create_cu_from_index_list (dwarf2_per_bfd *per_bfd, - struct dwarf2_section_info *section, - int is_dwz, - sect_offset sect_off, ULONGEST length) -{ - dwarf2_per_cu_up the_cu - = per_bfd->allocate_per_cu (section, sect_off, length); - the_cu->is_dwz = is_dwz; - return the_cu; -} - /* die_reader_func for dw2_get_file_names. */ static void diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index 43d0e5d2ebf..7a98eb4f66e 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -998,13 +998,6 @@ extern void dw_expand_symtabs_matching_file_matcher extern const char *read_indirect_string_at_offset (dwarf2_per_objfile *per_objfile, LONGEST str_offset); -/* Return a new dwarf2_per_cu allocated on the per-bfd obstack, and constructed - with the specified field values. */ - -extern dwarf2_per_cu_up create_cu_from_index_list - (dwarf2_per_bfd *per_bfd, struct dwarf2_section_info *section, - int is_dwz, sect_offset sect_off, ULONGEST length); - /* Initialize the views on all_units. */ extern void finalize_all_units (dwarf2_per_bfd *per_bfd); -- 2.39.5