forked from Imagelibrary/binutils-gdb
Convert read_address to a method on comp_unit_head
This changes read_address to be a method on comp_unit_head. 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/read.c (read_address): Move to comp-unit.c. (dwarf2_rnglists_process, dwarf2_ranges_process) (read_attribute_value, dwarf_decode_lines_1) (var_decode_location, decode_locdesc): Update. * dwarf2/comp-unit.c (comp_unit_head::read_address): Move from read.c. Remove "cu" parameter. * dwarf2/comp-unit.h (struct comp_unit_head) <read_address>: New method. Change-Id: Ibd6c7235f2e4d5fd88c272cfd2c3d3328618cc56
This commit is contained in:
@@ -221,3 +221,53 @@ read_and_check_comp_unit_head (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
||||
|
||||
return info_ptr;
|
||||
}
|
||||
|
||||
CORE_ADDR
|
||||
comp_unit_head::read_address (bfd *abfd, const gdb_byte *buf,
|
||||
unsigned int *bytes_read) const
|
||||
{
|
||||
CORE_ADDR retval = 0;
|
||||
|
||||
if (signed_addr_p)
|
||||
{
|
||||
switch (addr_size)
|
||||
{
|
||||
case 2:
|
||||
retval = bfd_get_signed_16 (abfd, buf);
|
||||
break;
|
||||
case 4:
|
||||
retval = bfd_get_signed_32 (abfd, buf);
|
||||
break;
|
||||
case 8:
|
||||
retval = bfd_get_signed_64 (abfd, buf);
|
||||
break;
|
||||
default:
|
||||
internal_error (__FILE__, __LINE__,
|
||||
_("read_address: bad switch, signed [in module %s]"),
|
||||
bfd_get_filename (abfd));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (addr_size)
|
||||
{
|
||||
case 2:
|
||||
retval = bfd_get_16 (abfd, buf);
|
||||
break;
|
||||
case 4:
|
||||
retval = bfd_get_32 (abfd, buf);
|
||||
break;
|
||||
case 8:
|
||||
retval = bfd_get_64 (abfd, buf);
|
||||
break;
|
||||
default:
|
||||
internal_error (__FILE__, __LINE__,
|
||||
_("read_address: bad switch, "
|
||||
"unsigned [in module %s]"),
|
||||
bfd_get_filename (abfd));
|
||||
}
|
||||
}
|
||||
|
||||
*bytes_read = addr_size;
|
||||
return retval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user