aboutsummaryrefslogtreecommitdiff
path: root/gold/dwarf_reader.h
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2012-10-23 21:41:37 +0000
committerCary Coutant <ccoutant@google.com>2012-10-23 21:41:37 +0000
commited5d6712b825edd0c4de10d7e7907d3332e6fe7e (patch)
tree3fb3691c937ea92d48736fc59c35f3002c2d4389 /gold/dwarf_reader.h
parent8787852de14e445e04bfb644c2c0d9178f807ec2 (diff)
downloadgdb-ed5d6712b825edd0c4de10d7e7907d3332e6fe7e.zip
gdb-ed5d6712b825edd0c4de10d7e7907d3332e6fe7e.tar.gz
gdb-ed5d6712b825edd0c4de10d7e7907d3332e6fe7e.tar.bz2
gold/
* dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call Dwarf_info_reader::read_from_pointer. (Dwarf_pubnames_table::read_header): Likewise. (Dwarf_pubnames_table::next_name): Likewise. (Dwarf_die::read_attributes): Likewise. (Dwarf_die::skip_attributes): Likewise. (Dwarf_info_reader::read_from_pointer): New function template. * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_. (Dwarf_pubnames_table): Likewise. (Dwarf_info_reader::read_from_pointer): New function template. * gdb-index.cc (Gdb_index_info_reader): Adjust call to Dwarf_pubnames_table ctor.
Diffstat (limited to 'gold/dwarf_reader.h')
-rw-r--r--gold/dwarf_reader.h30
1 files changed, 22 insertions, 8 deletions
diff --git a/gold/dwarf_reader.h b/gold/dwarf_reader.h
index aea63ab..2a8e56e 100644
--- a/gold/dwarf_reader.h
+++ b/gold/dwarf_reader.h
@@ -335,10 +335,10 @@ class Dwarf_range_list
class Dwarf_ranges_table
{
public:
- Dwarf_ranges_table()
- : ranges_shndx_(0), ranges_buffer_(NULL), ranges_buffer_end_(NULL),
- owns_ranges_buffer_(false), ranges_reloc_mapper_(NULL),
- output_section_offset_(0)
+ Dwarf_ranges_table(Dwarf_info_reader* dwinfo)
+ : dwinfo_(dwinfo), ranges_shndx_(0), ranges_buffer_(NULL),
+ ranges_buffer_end_(NULL), owns_ranges_buffer_(false),
+ ranges_reloc_mapper_(NULL), output_section_offset_(0)
{ }
~Dwarf_ranges_table()
@@ -366,6 +366,8 @@ class Dwarf_ranges_table
off_t ranges_offset);
private:
+ // The Dwarf_info_reader, for reading data.
+ Dwarf_info_reader* dwinfo_;
// The section index of the ranges table.
unsigned int ranges_shndx_;
// The buffer containing the .debug_ranges section.
@@ -388,8 +390,8 @@ class Dwarf_ranges_table
class Dwarf_pubnames_table
{
public:
- Dwarf_pubnames_table(bool is_pubtypes)
- : buffer_(NULL), buffer_end_(NULL), owns_buffer_(false),
+ Dwarf_pubnames_table(Dwarf_info_reader* dwinfo, bool is_pubtypes)
+ : dwinfo_(dwinfo), buffer_(NULL), buffer_end_(NULL), owns_buffer_(false),
offset_size_(0), pinfo_(NULL), is_pubtypes_(is_pubtypes),
output_section_offset_(0)
{ }
@@ -413,6 +415,8 @@ class Dwarf_pubnames_table
next_name();
private:
+ // The Dwarf_info_reader, for reading data.
+ Dwarf_info_reader* dwinfo_;
// The buffer containing the .debug_ranges section.
const unsigned char* buffer_;
const unsigned char* buffer_end_;
@@ -665,8 +669,8 @@ class Dwarf_info_reader
reloc_type_(reloc_type), abbrev_shndx_(0), string_shndx_(0),
buffer_(NULL), buffer_end_(NULL), cu_offset_(0), cu_length_(0),
offset_size_(0), address_size_(0), cu_version_(0), type_signature_(0),
- type_offset_(0), abbrev_table_(), reloc_mapper_(NULL),
- string_buffer_(NULL), string_buffer_end_(NULL),
+ type_offset_(0), abbrev_table_(), ranges_table_(this),
+ reloc_mapper_(NULL), string_buffer_(NULL), string_buffer_end_(NULL),
owns_string_buffer_(false), string_output_section_offset_(0)
{ }
@@ -700,6 +704,16 @@ class Dwarf_info_reader
return NULL;
}
+ // Read a possibly unaligned integer of SIZE.
+ template <int valsize>
+ inline typename elfcpp::Valtype_base<valsize>::Valtype
+ read_from_pointer(const unsigned char* source);
+
+ // Read a possibly unaligned integer of SIZE. Update SOURCE after read.
+ template <int valsize>
+ inline typename elfcpp::Valtype_base<valsize>::Valtype
+ read_from_pointer(const unsigned char** source);
+
// Look for a relocation at offset ATTR_OFF in the dwarf info,
// and return the section index and offset of the target.
unsigned int