38 const gdb_byte *info_ptr,
43 unsigned int bytes_read;
50 info_ptr += bytes_read;
52 if (version < 2 || version > 5)
53 error (_(
"Dwarf Error: wrong version in compilation unit header "
54 "(is %d, should be 2, 3, 4 or 5) [in module %s]"),
62 cu_header->unit_type = DW_UT_compile;
65 cu_header->unit_type = DW_UT_type;
68 internal_error (_(
"read_comp_unit_head: invalid section_kind"));
72 cu_header->unit_type =
static_cast<enum dwarf_unit_type
>
75 switch (cu_header->unit_type)
80 case DW_UT_split_compile:
82 error (_(
"Dwarf Error: wrong unit_type in compilation unit header "
83 "(is %s, should be %s) [in module %s]"),
88 case DW_UT_split_type:
92 error (_(
"Dwarf Error: wrong unit_type in compilation unit header "
93 "(is %#04x, should be one of: %s, %s, %s, %s or %s) "
94 "[in module %s]"), cu_header->unit_type,
106 = (sect_offset) cu_header->
read_offset (abfd, info_ptr, &bytes_read);
107 info_ptr += bytes_read;
113 signed_addr = bfd_get_sign_extend_vma (abfd);
115 internal_error (_(
"read_comp_unit_head: dwarf from non elf file"));
119 || cu_header->unit_type == DW_UT_skeleton
120 || cu_header->unit_type == DW_UT_split_compile;
122 if (header_has_signature)
131 type_offset = cu_header->
read_offset (abfd, info_ptr, &bytes_read);
132 info_ptr += bytes_read;
135 error (_(
"Dwarf Error: Too big type_offset in compilation unit "
136 "header (is %s) [in module %s]"), plongest (type_offset),
157 error (_(
"Dwarf Error: bad offset (%s) in compilation unit header "
158 "(offset %s + 6) [in module %s]"),
167 error (_(
"Dwarf Error: bad length (0x%x) in compilation unit header "
168 "(offset %s + 0) [in module %s]"),
180 const gdb_byte *info_ptr,
183 const gdb_byte *beg_of_comp_unit = info_ptr;
185 header->
sect_off = (sect_offset) (beg_of_comp_unit - section->
buffer);
198 unsigned int *bytes_read)
const
207 retval = bfd_get_signed_16 (abfd, buf);
210 retval = bfd_get_signed_32 (abfd, buf);
213 retval = bfd_get_signed_64 (abfd, buf);
216 internal_error (_(
"read_address: bad switch, signed [in module %s]"),
217 bfd_get_filename (abfd));
225 retval = bfd_get_16 (abfd, buf);
228 retval = bfd_get_32 (abfd, buf);
231 retval = bfd_get_64 (abfd, buf);
234 internal_error (_(
"read_address: bad switch, "
235 "unsigned [in module %s]"),
236 bfd_get_filename (abfd));
241 return (unrelocated_addr) retval;
const gdb_byte * read_and_check_comp_unit_head(dwarf2_per_objfile *per_objfile, struct comp_unit_head *header, struct dwarf2_section_info *section, struct dwarf2_section_info *abbrev_section, const gdb_byte *info_ptr, rcuh_kind section_kind)
const gdb_byte * read_comp_unit_head(struct comp_unit_head *cu_header, const gdb_byte *info_ptr, struct dwarf2_section_info *section, rcuh_kind section_kind)
static void error_check_comp_unit_head(dwarf2_per_objfile *per_objfile, struct comp_unit_head *header, struct dwarf2_section_info *section, struct dwarf2_section_info *abbrev_section)
LONGEST read_initial_length(bfd *abfd, const gdb_byte *buf, unsigned int *bytes_read, bool handle_nonstd)
static unsigned int read_1_byte(bfd *abfd, const gdb_byte *buf)
static unsigned int read_2_bytes(bfd *abfd, const gdb_byte *buf)
static ULONGEST read_8_bytes(bfd *abfd, const gdb_byte *buf)
const char * dwarf_unit_type_name(int unit_type)
unsigned int get_length_with_initial() const
void set_length(unsigned int length)
unsigned char signed_addr_p
unsigned int get_length_without_initial() const
cu_offset type_cu_offset_in_tu
cu_offset first_die_cu_offset
sect_offset abbrev_sect_off
unsigned int initial_length_size
LONGEST read_offset(bfd *abfd, const gdb_byte *buf, unsigned int *bytes_read) const
unrelocated_addr read_address(bfd *abfd, const gdb_byte *buf, unsigned int *bytes_read) const
const char * get_file_name() const
bfd_size_type get_size(struct objfile *objfile)
struct bfd * get_bfd_owner() const
static char * sect_offset_str(sect_offset offset)