aboutsummaryrefslogtreecommitdiff
path: root/gold/dwarf_reader.h
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-11-14 01:03:01 +0000
committerIan Lance Taylor <iant@google.com>2007-11-14 01:03:01 +0000
commita55ce7febfaa52670ce3d9c236d3033de80ac091 (patch)
tree5955950569cfe09f083ba0e217a1a8085a844103 /gold/dwarf_reader.h
parentb3c8c50a8f21a913e6c5dc91ff843cd4e924b01a (diff)
downloadgdb-a55ce7febfaa52670ce3d9c236d3033de80ac091.zip
gdb-a55ce7febfaa52670ce3d9c236d3033de80ac091.tar.gz
gdb-a55ce7febfaa52670ce3d9c236d3033de80ac091.tar.bz2
From Craig Silverstein: Rework debug info code a bit, add option for
ODR violations, add test case.
Diffstat (limited to 'gold/dwarf_reader.h')
-rw-r--r--gold/dwarf_reader.h38
1 files changed, 34 insertions, 4 deletions
diff --git a/gold/dwarf_reader.h b/gold/dwarf_reader.h
index d35cbf1..cefc027 100644
--- a/gold/dwarf_reader.h
+++ b/gold/dwarf_reader.h
@@ -41,21 +41,51 @@ struct LineStateMachine;
// This class is used to read the line information from the debugging
// section of an object file.
-template<int size, bool big_endian>
class Dwarf_line_info
{
public:
- // Initializes a .debug_line reader for a given object file.
- Dwarf_line_info(Object* object);
+ Dwarf_line_info()
+ { }
+
+ virtual
+ ~Dwarf_line_info()
+ { }
// Given a section number and an offset, returns the associated
// file and line-number, as a string: "file:lineno". If unable
// to do the mapping, returns the empty string. You must call
// read_line_mappings() before calling this function.
std::string
- addr2line(unsigned int shndx, off_t offset);
+ addr2line(unsigned int shndx, off_t offset)
+ { return do_addr2line(shndx, offset); }
+
+ // A helper function for a single addr2line lookup. It uses
+ // parameters() to figure out the size and endianness. This is less
+ // efficient than using the templatized size and endianness, so only
+ // call this from an un-templatized context.
+ static std::string
+ one_addr2line(Object* object, unsigned int shndx, off_t offset);
+
+ private:
+ virtual std::string
+ do_addr2line(unsigned int shndx, off_t offset) = 0;
+};
+
+template<int size, bool big_endian>
+class Sized_dwarf_line_info
+{
+ public:
+ // Initializes a .debug_line reader for a given object file.
+ Sized_dwarf_line_info(Object* object);
+
+ std::string
+ addr2line(unsigned int shndx, off_t offset)
+ { return do_addr2line(shndx, offset); }
private:
+ std::string
+ do_addr2line(unsigned int shndx, off_t offset);
+
// Start processing line info, and populates the offset_map_.
void
read_line_mappings();