This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[4/4] RFC: refactor partial symbol tables
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 15 Jan 2010 17:32:27 -0700
- Subject: [4/4] RFC: refactor partial symbol tables
- Reply-to: tromey at redhat dot com
This patch removes some dead code from the DWARF reader.
After my various experiments, I have concluded that we will never use
the aranges or pubnames sections.
pubnames (and likewise pubtypes) is simply not useful -- not just to
gdb, I think, but to any debugger. IMO, gcc should not even generate
it.
aranges is useful, but I think we don't want to bother. Reading aranges
was the basis of my earlier patch for lazy psymtab reading. However,
this only fixes part of the problem: it makes by-address lookups work
lazily (nice) but at the expense of very long user-visible delays the
first time a by-name lookup is done. After some experience with this, I
think it is a bad tradeoff; if there must be a big delay, it is nicer
for users to have it all up front.
Tom
2010-01-14 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.
>From 3b2fcc7ff7847264d8055e4f1f28dcb1d99c4841 Mon Sep 17 00:00:00 2001
From: Tom Tromey <tromey@redhat.com>
Date: Thu, 14 Jan 2010 14:59:45 -0700
Subject: [PATCH 4/4] Remove dead code from DWARF reader
---
gdb/ChangeLog | 14 +++++++
gdb/dwarf2read.c | 101 +-----------------------------------------------------
2 files changed, 15 insertions(+), 100 deletions(-)
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index d6adf80..4cdb87a 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -81,38 +81,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. */
@@ -164,8 +132,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;
@@ -207,8 +173,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"
@@ -774,10 +738,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 *);
@@ -1226,16 +1186,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;
@@ -1479,57 +1429,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. */
--
1.6.2.5