.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. */
/* 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. */
/* 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;
/* 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);
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;
}
}
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)
{
'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)
{
|| 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;
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,
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."));