diff options
author | Doug Evans <dje@google.com> | 2011-10-12 16:28:41 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2011-10-12 16:28:41 +0000 |
commit | adabb602f9140476a47dec04581214e644b52bc6 (patch) | |
tree | 4cc565d33121b3acb398baa2f05afc9a6f0d7f7f /gdb | |
parent | 5048e5167716138f9f3ff727dfb2b8b572445c5e (diff) | |
download | gdb-adabb602f9140476a47dec04581214e644b52bc6.zip gdb-adabb602f9140476a47dec04581214e644b52bc6.tar.gz gdb-adabb602f9140476a47dec04581214e644b52bc6.tar.bz2 |
* dwarf2read.c (partial_read_comp_unit_head): Set header->offset,
header->first_die_offset here. All callers updated.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 24 |
2 files changed, 13 insertions, 16 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f08b5a4..56d7f7c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2011-10-12 Doug Evans <dje@google.com> + + * dwarf2read.c (partial_read_comp_unit_head): Set header->offset, + header->first_die_offset here. All callers updated. + 2011-10-12 Jan Kratochvil <jan.kratochvil@redhat.com> Fix compatibility with texinfo versions older than 4.12. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 2592bcf..0b16ef8 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -2273,7 +2273,7 @@ dw2_get_file_names (struct objfile *objfile, struct cleanup *cleanups; struct die_info *comp_unit_die; struct dwarf2_section_info* sec; - gdb_byte *beg_of_comp_unit, *info_ptr, *buffer; + gdb_byte *info_ptr, *buffer; int has_children, i; struct dwarf2_cu cu; unsigned int bytes_read, buffer_size; @@ -2300,16 +2300,11 @@ dw2_get_file_names (struct objfile *objfile, buffer_size = sec->size; buffer = sec->buffer; info_ptr = buffer + this_cu->offset; - beg_of_comp_unit = info_ptr; info_ptr = partial_read_comp_unit_head (&cu.header, info_ptr, buffer, buffer_size, abfd); - /* Complete the cu_header. */ - cu.header.offset = beg_of_comp_unit - buffer; - cu.header.first_die_offset = info_ptr - beg_of_comp_unit; - this_cu->cu = &cu; cu.per_cu = this_cu; @@ -2959,6 +2954,8 @@ read_comp_unit_head (struct comp_unit_head *cu_header, return info_ptr; } +/* Read in a CU header and perform some basic error checking. */ + static gdb_byte * partial_read_comp_unit_head (struct comp_unit_head *header, gdb_byte *info_ptr, gdb_byte *buffer, unsigned int buffer_size, @@ -2966,8 +2963,12 @@ partial_read_comp_unit_head (struct comp_unit_head *header, gdb_byte *info_ptr, { gdb_byte *beg_of_comp_unit = info_ptr; + header->offset = beg_of_comp_unit - buffer; + info_ptr = read_comp_unit_head (header, info_ptr, abfd); + header->first_die_offset = info_ptr - beg_of_comp_unit; + if (header->version != 2 && header->version != 3 && header->version != 4) error (_("Dwarf Error: wrong version in compilation unit header " "(is %d, should be 2, 3, or 4) [in module %s]"), header->version, @@ -3353,10 +3354,6 @@ process_psymtab_comp_unit (struct objfile *objfile, buffer, buffer_size, abfd); - /* Complete the cu_header. */ - cu.header.offset = beg_of_comp_unit - buffer; - cu.header.first_die_offset = info_ptr - beg_of_comp_unit; - cu.list_in_scope = &file_symbols; /* If this compilation unit was already read in, free the @@ -3617,7 +3614,7 @@ load_partial_comp_unit (struct dwarf2_per_cu_data *this_cu, struct objfile *objfile) { bfd *abfd = objfile->obfd; - gdb_byte *info_ptr, *beg_of_comp_unit; + gdb_byte *info_ptr; struct die_info *comp_unit_die; struct dwarf2_cu *cu; struct cleanup *free_abbrevs_cleanup, *free_cu_cleanup = NULL; @@ -3629,7 +3626,6 @@ load_partial_comp_unit (struct dwarf2_per_cu_data *this_cu, gdb_assert (dwarf2_per_objfile->info.readin); info_ptr = dwarf2_per_objfile->info.buffer + this_cu->offset; - beg_of_comp_unit = info_ptr; if (this_cu->cu == NULL) { @@ -3646,10 +3642,6 @@ load_partial_comp_unit (struct dwarf2_per_cu_data *this_cu, dwarf2_per_objfile->info.size, abfd); - /* Complete the cu_header. */ - cu->header.offset = this_cu->offset; - cu->header.first_die_offset = info_ptr - beg_of_comp_unit; - /* Link this compilation unit into the compilation unit tree. */ this_cu->cu = cu; cu->per_cu = this_cu; |