aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2013-09-27 21:34:04 +0000
committerDoug Evans <dje@google.com>2013-09-27 21:34:04 +0000
commit19ac8c2e288eaa13f08bb1b3d4ca09df8bc3f077 (patch)
tree5a7a3e3a812e35450ad254f9c1280ec7e8b20bce
parenta32a892359d4d920cca48e327fef430d1108bd40 (diff)
downloadgdb-19ac8c2e288eaa13f08bb1b3d4ca09df8bc3f077.zip
gdb-19ac8c2e288eaa13f08bb1b3d4ca09df8bc3f077.tar.gz
gdb-19ac8c2e288eaa13f08bb1b3d4ca09df8bc3f077.tar.bz2
* dwarf2read.c (dwarf2_section_info): Add comment.
(dwp_file): Split loaded_cutus into loaded_cus, loaded_tus. All uses updated. (dwarf2_section_empty_p): Rename arg from "info" to "section". (dwarf2_read_section): Delete unused local "header". Add section name to error message. (create_dwo_in_dwp): Tweak comment. (MAX_NR_DWO_SECTIONS): Combine count of .debug_macro + .debug_macinfo.
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/dwarf2read.c33
2 files changed, 29 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f72b38c..7114670 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
2013-09-27 Doug Evans <dje@google.com>
+ * dwarf2read.c (dwarf2_section_info): Add comment.
+ (dwp_file): Split loaded_cutus into loaded_cus, loaded_tus.
+ All uses updated.
+ (dwarf2_section_empty_p): Rename arg from "info" to "section".
+ (dwarf2_read_section): Delete unused local "header". Add section
+ name to error message.
+ (create_dwo_in_dwp): Tweak comment.
+ (MAX_NR_DWO_SECTIONS): Combine count of .debug_macro + .debug_macinfo.
+
* dwarf2read.c (die_reader_specs): Tweak comment.
(get_section_bfd_owner, get_section_bfd_section): New functions.
(get_section_name, get_section_file_name): New functions.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 9b9c315..56d4740 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -103,6 +103,7 @@ static int dwarf2_loclist_block_index;
struct dwarf2_section_info
{
asection *asection;
+ /* Pointer to section data, only valid if readin. */
const gdb_byte *buffer;
bfd_size_type size;
/* True if we have tried to read this section. */
@@ -741,7 +742,7 @@ struct dwo_unit
/* The section this CU/TU lives in, in the DWO file. */
struct dwarf2_section_info *section;
- /* Same as dwarf2_per_cu_data:{offset,length} but for the DWO section. */
+ /* Same as dwarf2_per_cu_data:{offset,length} but in the DWO section. */
sect_offset offset;
unsigned int length;
@@ -843,8 +844,9 @@ struct dwp_file
/* Table of TUs in the file. */
const struct dwp_hash_table *tus;
- /* Table of loaded CUs/TUs. Each entry is a struct dwo_unit *. */
- htab_t loaded_cutus;
+ /* Tables of loaded CUs/TUs. Each entry is a struct dwo_unit *. */
+ htab_t loaded_cus;
+ htab_t loaded_tus;
/* Table to map ELF section numbers to their sections. */
unsigned int num_sections;
@@ -2026,9 +2028,9 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *vnames)
or not present. */
static int
-dwarf2_section_empty_p (struct dwarf2_section_info *info)
+dwarf2_section_empty_p (const struct dwarf2_section_info *section)
{
- return info->asection == NULL || info->size == 0;
+ return section->asection == NULL || section->size == 0;
}
/* Read the contents of the section INFO.
@@ -2043,7 +2045,6 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
asection *sectp;
bfd *abfd;
gdb_byte *buf, *retbuf;
- unsigned char header[4];
if (info->readin)
return;
@@ -2082,8 +2083,11 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0
|| bfd_bread (buf, info->size, abfd) != info->size)
- error (_("Dwarf Error: Can't read DWARF data from '%s'"),
- bfd_get_filename (abfd));
+ {
+ error (_("Dwarf Error: Can't read DWARF data"
+ " in section %s [in module %s]"),
+ bfd_section_name (abfd, sectp), bfd_get_filename (abfd));
+ }
}
/* A helper function that returns the size of a section in a safe way.
@@ -9228,7 +9232,7 @@ create_dwo_in_dwp (struct dwp_file *dwp_file,
dwp_file->name);
}
- /* Fetch the sections of this DWO.
+ /* Fetch the sections of this DWO unit.
Put a limit on the number of sections we look for so that bad data
doesn't cause us to loop forever. */
@@ -9238,8 +9242,7 @@ create_dwo_in_dwp (struct dwp_file *dwp_file,
+ 1 /* .debug_line */ \
+ 1 /* .debug_loc */ \
+ 1 /* .debug_str_offsets */ \
- + 1 /* .debug_macro */ \
- + 1 /* .debug_macinfo */ \
+ + 1 /* .debug_macro or .debug_macinfo */ \
+ 1 /* trailing zero */)
memset (&sections, 0, sizeof (sections));
@@ -9375,7 +9378,10 @@ lookup_dwo_unit_in_dwp (struct dwp_file *dwp_file, const char *comp_dir,
memset (&find_dwo_cu, 0, sizeof (find_dwo_cu));
find_dwo_cu.signature = signature;
- slot = htab_find_slot (dwp_file->loaded_cutus, &find_dwo_cu, INSERT);
+ slot = htab_find_slot (is_debug_types
+ ? dwp_file->loaded_tus
+ : dwp_file->loaded_cus,
+ &find_dwo_cu, INSERT);
if (*slot != NULL)
return *slot;
@@ -9761,7 +9767,8 @@ open_and_init_dwp_file (void)
dwp_file->tus = create_dwp_hash_table (dwp_file, 1);
- dwp_file->loaded_cutus = allocate_dwp_loaded_cutus_table (objfile);
+ dwp_file->loaded_cus = allocate_dwp_loaded_cutus_table (objfile);
+ dwp_file->loaded_tus = allocate_dwp_loaded_cutus_table (objfile);
if (dwarf2_read_debug)
{