From d00adf391709cf00d95094847e1bbe3a63046ca2 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Fri, 12 Sep 2008 20:06:25 +0000 Subject: [PATCH] * dwarf2read.c (comp_unit_head): Rename first_die_ptr to first_die_offset. All uses updated. Delete unused members cu_head_ptr, next. Move members base_known, base_address to ... (dwarf2_cu) ... here. All uses updated. --- gdb/ChangeLog | 8 ++++++ gdb/dwarf2read.c | 70 +++++++++++++++++++++--------------------------- 2 files changed, 38 insertions(+), 40 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 96281331f2c..d92a706493c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2008-09-12 Doug Evans + + * dwarf2read.c (comp_unit_head): Rename first_die_ptr to + first_die_offset. All uses updated. + Delete unused members cu_head_ptr, next. + Move members base_known, base_address to ... + (dwarf2_cu) ... here. All uses updated. + 2008-09-12 Pedro Alves * Makefile.in (generated_files): Add $(NAT_GENERATED_FILES). diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 1b68e2a6a4e..a62bd28afcf 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -247,22 +247,9 @@ struct comp_unit_head .debug_info section, for resolving relative reference dies. */ unsigned int offset; - /* Pointer to this compilation unit header in the .debug_info - section. */ - gdb_byte *cu_head_ptr; - - /* Pointer to the first die of this compilation unit. This will be - the first byte following the compilation unit header. */ - gdb_byte *first_die_ptr; - - /* Pointer to the next compilation unit header in the program. */ - struct comp_unit_head *next; - - /* Base address of this compilation unit. */ - CORE_ADDR base_address; - - /* Non-zero if base_address has been set. */ - int base_known; + /* Offset to first die in this cu from the start of the cu. + This will be the first byte following the compilation unit header. */ + unsigned int first_die_offset; }; /* Internal state when decoding a particular compilation unit. */ @@ -271,12 +258,15 @@ struct dwarf2_cu /* The objfile containing this compilation unit. */ struct objfile *objfile; - /* The header of the compilation unit. - - FIXME drow/2003-11-10: Some of the things from the comp_unit_head - should logically be moved to the dwarf2_cu structure. */ + /* The header of the compilation unit. */ struct comp_unit_head header; + /* Base address of this compilation unit. */ + CORE_ADDR base_address; + + /* Non-zero if base_address has been set. */ + int base_known; + struct function_range *first_fn, *last_fn, *cached_fn; /* The language we are debugging. */ @@ -1493,8 +1483,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) /* Complete the cu_header */ cu.header.offset = beg_of_comp_unit - dwarf2_per_objfile->info_buffer; - cu.header.first_die_ptr = info_ptr; - cu.header.cu_head_ptr = beg_of_comp_unit; + cu.header.first_die_offset = info_ptr - beg_of_comp_unit; cu.list_in_scope = &file_symbols; @@ -1660,8 +1649,7 @@ load_comp_unit (struct dwarf2_per_cu_data *this_cu, struct objfile *objfile) /* Complete the cu_header. */ cu->header.offset = beg_of_comp_unit - dwarf2_per_objfile->info_buffer; - cu->header.first_die_ptr = info_ptr; - cu->header.cu_head_ptr = beg_of_comp_unit; + cu->header.first_die_offset = info_ptr - beg_of_comp_unit; /* Read the abbrevs for this compilation unit into a table. */ dwarf2_read_abbrevs (abfd, cu); @@ -2649,22 +2637,22 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu) DW_AT_entry_pc. It's been removed, but GCC still uses this for compilation units with discontinuous ranges. */ - cu->header.base_known = 0; - cu->header.base_address = 0; + cu->base_known = 0; + cu->base_address = 0; attr = dwarf2_attr (cu->dies, DW_AT_entry_pc, cu); if (attr) { - cu->header.base_address = DW_ADDR (attr); - cu->header.base_known = 1; + cu->base_address = DW_ADDR (attr); + cu->base_known = 1; } else { attr = dwarf2_attr (cu->dies, DW_AT_low_pc, cu); if (attr) { - cu->header.base_address = DW_ADDR (attr); - cu->header.base_known = 1; + cu->base_address = DW_ADDR (attr); + cu->base_known = 1; } } @@ -3132,8 +3120,8 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return, CORE_ADDR high = 0; CORE_ADDR baseaddr; - found_base = cu_header->base_known; - base = cu_header->base_address; + found_base = cu->base_known; + base = cu->base_address; if (offset >= dwarf2_per_objfile->ranges_size) { @@ -3400,8 +3388,8 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block, 'baseaddr' argument, which GDB uses to relocate debugging information from a shared library based on the address at which the library was loaded. */ - CORE_ADDR base = cu->header.base_address; - int base_known = cu->header.base_known; + CORE_ADDR base = cu->base_address; + int base_known = cu->base_known; if (offset >= dwarf2_per_objfile->ranges_size) { @@ -5886,11 +5874,11 @@ read_partial_die (struct partial_die_info *part_die, || dwarf2_per_objfile->has_section_at_zero)) part_die->has_pc_info = 1; - if (base_address_type != base_address_none && !cu->header.base_known) + if (base_address_type != base_address_none && !cu->base_known) { gdb_assert (part_die->tag == DW_TAG_compile_unit); - cu->header.base_known = 1; - cu->header.base_address = base_address; + cu->base_known = 1; + cu->base_address = base_address; } return info_ptr; @@ -5955,7 +5943,9 @@ find_partial_die (unsigned long offset, struct dwarf2_cu *cu) dwarf2_read_abbrevs (per_cu->cu->objfile->obfd, per_cu->cu); back_to = make_cleanup (dwarf2_free_abbrev_table, per_cu->cu); } - info_ptr = per_cu->cu->header.first_die_ptr; + info_ptr = (dwarf2_per_objfile->info_buffer + + per_cu->cu->header.offset + + per_cu->cu->header.first_die_offset); abbrev = peek_die_abbrev (info_ptr, &bytes_read, per_cu->cu); info_ptr = read_partial_die (&comp_unit_die, abbrev, bytes_read, per_cu->cu->objfile->obfd, info_ptr, @@ -9916,8 +9906,8 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, don't run off the edge of the section. */ baton->size = dwarf2_per_objfile->loc_size - DW_UNSND (attr); baton->data = dwarf2_per_objfile->loc_buffer + DW_UNSND (attr); - baton->base_address = cu->header.base_address; - if (cu->header.base_known == 0) + baton->base_address = cu->base_address; + if (cu->base_known == 0) complaint (&symfile_complaints, _("Location list used without specifying the CU base address.")); -- 2.30.2