+ addr2line(unsigned int shndx, off_t offset,
+ std::vector<std::string>* other_lines)
+ { return this->do_addr2line(shndx, offset, other_lines); }
+
+ // A helper function for a single addr2line lookup. It also keeps a
+ // cache of the last CACHE_SIZE Dwarf_line_info objects it created;
+ // set to 0 not to cache at all. The larger CACHE_SIZE is, the more
+ // chance this routine won't have to re-create a Dwarf_line_info
+ // object for its addr2line computation; such creations are slow.
+ // NOTE: Not thread-safe, so only call from one thread at a time.
+ static std::string
+ one_addr2line(Object* object, unsigned int shndx, off_t offset,
+ size_t cache_size, std::vector<std::string>* other_lines);
+
+ // This reclaims all the memory that one_addr2line may have cached.
+ // Use this when you know you will not be calling one_addr2line again.
+ static void
+ clear_addr2line_cache();
+
+ private:
+ virtual std::string
+ do_addr2line(unsigned int shndx, off_t offset,
+ std::vector<std::string>* other_lines) = 0;
+};
+
+template<int size, bool big_endian>
+class Sized_dwarf_line_info : public Dwarf_line_info
+{
+ public:
+ // Initializes a .debug_line reader for a given object file.
+ // If SHNDX is specified and non-negative, only read the debug
+ // information that pertains to the specified section.
+ Sized_dwarf_line_info(Object* object, unsigned int read_shndx = -1U);