This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [4/4] RFC: refactor partial symbol tables
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 09 Mar 2010 15:27:25 -0700
- Subject: Re: [4/4] RFC: refactor partial symbol tables
- References: <m3r5pqanz8.fsf@fleche.redhat.com>
- Reply-to: Tom Tromey <tromey at redhat dot com>
>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
Tom> This patch removes some dead code from the DWARF reader.
Tom> After my various experiments, I have concluded that we will never use
Tom> the aranges or pubnames sections.
Tom> pubnames (and likewise pubtypes) is simply not useful -- not just to
Tom> gdb, I think, but to any debugger. IMO, gcc should not even generate
Tom> it.
Tom> aranges is useful, but I think we don't want to bother. Reading aranges
Tom> was the basis of my earlier patch for lazy psymtab reading. However,
Tom> this only fixes part of the problem: it makes by-address lookups work
Tom> lazily (nice) but at the expense of very long user-visible delays the
Tom> first time a by-name lookup is done. After some experience with this, I
Tom> think it is a bad tradeoff; if there must be a big delay, it is nicer
Tom> for users to have it all up front.
Here's the updated patch.
I am not as sure about these sections as I was when I wrote the above.
Maybe pub* are salvageable -- but definitely not using psymtabs, and in
any case the deletions in the patch are really trivia. So, IMO, the
patch stands.
Tom
2010-03-09 Tom Tromey <tromey@redhat.com>
* dwarf2read.c (struct pubnames_header): Remove.
(_PUBNAMES_HEADER): Remove.
(_ACTUAL_PUBNAMES_HEADER_SIZE): Remove.
(struct aranges_header): Remove.
(_ARANGES_HEADER, _ACTUAL_ARANGES_HEADER_SIZE): Remove.
(struct dwarf2_per_objfile) <pubnames, aranges>: Remove.
(PUBNAMES_SECTION): Remove.
(ARANGES_SECTION): Remove.
(dwarf2_locate_sections): Don't handle pubnames or aranges.
(dwarf2_build_psymtabs): Remove dead code.
(dwarf2_build_psymtabs_easy): Remove.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index df607ab..50adddf 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -83,38 +83,6 @@ _COMP_UNIT_HEADER;
#define _ACTUAL_COMP_UNIT_HEADER_SIZE 11
#endif
-/* .debug_pubnames header
- Because of alignment constraints, this structure has padding and cannot
- be mapped directly onto the beginning of the .debug_info section. */
-typedef struct pubnames_header
- {
- unsigned int length; /* length of the .debug_pubnames
- contribution */
- unsigned char version; /* version number -- 2 for DWARF
- version 2 */
- unsigned int info_offset; /* offset into .debug_info section */
- unsigned int info_size; /* byte size of .debug_info section
- portion */
- }
-_PUBNAMES_HEADER;
-#define _ACTUAL_PUBNAMES_HEADER_SIZE 13
-
-/* .debug_pubnames header
- Because of alignment constraints, this structure has padding and cannot
- be mapped directly onto the beginning of the .debug_info section. */
-typedef struct aranges_header
- {
- unsigned int length; /* byte len of the .debug_aranges
- contribution */
- unsigned short version; /* version number -- 2 for DWARF
- version 2 */
- unsigned int info_offset; /* offset into .debug_info section */
- unsigned char addr_size; /* byte size of an address */
- unsigned char seg_size; /* byte size of segment descriptor */
- }
-_ARANGES_HEADER;
-#define _ACTUAL_ARANGES_HEADER_SIZE 12
-
/* .debug_line statement program prologue
Because of alignment constraints, this structure has padding and cannot
be mapped directly onto the beginning of the .debug_info section. */
@@ -166,8 +134,6 @@ struct dwarf2_per_objfile
struct dwarf2_section_info info;
struct dwarf2_section_info abbrev;
struct dwarf2_section_info line;
- struct dwarf2_section_info pubnames;
- struct dwarf2_section_info aranges;
struct dwarf2_section_info loc;
struct dwarf2_section_info macinfo;
struct dwarf2_section_info str;
@@ -209,8 +175,6 @@ static struct dwarf2_per_objfile *dwarf2_per_objfile;
#define INFO_SECTION "debug_info"
#define ABBREV_SECTION "debug_abbrev"
#define LINE_SECTION "debug_line"
-#define PUBNAMES_SECTION "debug_pubnames"
-#define ARANGES_SECTION "debug_aranges"
#define LOC_SECTION "debug_loc"
#define MACINFO_SECTION "debug_macinfo"
#define STR_SECTION "debug_str"
@@ -775,10 +739,6 @@ dwarf2_invalid_attrib_class_complaint (const char *arg1, const char *arg2)
static void dwarf2_locate_sections (bfd *, asection *, void *);
-#if 0
-static void dwarf2_build_psymtabs_easy (struct objfile *);
-#endif
-
static void dwarf2_create_include_psymtab (char *, struct partial_symtab *,
struct objfile *);
@@ -1220,16 +1180,6 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr)
dwarf2_per_objfile->line.asection = sectp;
dwarf2_per_objfile->line.size = bfd_get_section_size (sectp);
}
- else if (section_is_p (sectp->name, PUBNAMES_SECTION))
- {
- dwarf2_per_objfile->pubnames.asection = sectp;
- dwarf2_per_objfile->pubnames.size = bfd_get_section_size (sectp);
- }
- else if (section_is_p (sectp->name, ARANGES_SECTION))
- {
- dwarf2_per_objfile->aranges.asection = sectp;
- dwarf2_per_objfile->aranges.size = bfd_get_section_size (sectp);
- }
else if (section_is_p (sectp->name, LOC_SECTION))
{
dwarf2_per_objfile->loc.asection = sectp;
@@ -1473,57 +1423,8 @@ dwarf2_build_psymtabs (struct objfile *objfile)
init_psymbol_list (objfile, 1024);
}
-#if 0
- if (dwarf_aranges_offset && dwarf_pubnames_offset)
- {
- /* Things are significantly easier if we have .debug_aranges and
- .debug_pubnames sections */
-
- dwarf2_build_psymtabs_easy (objfile);
- }
- else
-#endif
- /* only test this case for now */
- {
- /* In this case we have to work a bit harder */
- dwarf2_build_psymtabs_hard (objfile);
- }
-}
-
-#if 0
-/* Build the partial symbol table from the information in the
- .debug_pubnames and .debug_aranges sections. */
-
-static void
-dwarf2_build_psymtabs_easy (struct objfile *objfile)
-{
- bfd *abfd = objfile->obfd;
- char *aranges_buffer, *pubnames_buffer;
- char *aranges_ptr, *pubnames_ptr;
- unsigned int entry_length, version, info_offset, info_size;
-
- pubnames_buffer = dwarf2_read_section (objfile,
- dwarf_pubnames_section);
- pubnames_ptr = pubnames_buffer;
- while ((pubnames_ptr - pubnames_buffer) < dwarf2_per_objfile->pubnames.size)
- {
- unsigned int bytes_read;
-
- entry_length = read_initial_length (abfd, pubnames_ptr, &bytes_read);
- pubnames_ptr += bytes_read;
- version = read_1_byte (abfd, pubnames_ptr);
- pubnames_ptr += 1;
- info_offset = read_4_bytes (abfd, pubnames_ptr);
- pubnames_ptr += 4;
- info_size = read_4_bytes (abfd, pubnames_ptr);
- pubnames_ptr += 4;
- }
-
- aranges_buffer = dwarf2_read_section (objfile,
- dwarf_aranges_section);
-
+ dwarf2_build_psymtabs_hard (objfile);
}
-#endif
/* Return TRUE if OFFSET is within CU_HEADER. */