diff options
author | Sterling Augustine <saugustine@google.com> | 2020-10-02 07:44:24 -0700 |
---|---|---|
committer | Sterling Augustine <saugustine@google.com> | 2020-10-02 17:55:10 +0000 |
commit | f6669d6df42686aea832762f701359a3f9bdc762 (patch) | |
tree | 83c626021a72d4838ce3d570963cad0864f30f77 /src/common/linux | |
parent | Refactor rangelist handling to prepare for dwarf5 .debug_rngslist (diff) | |
download | breakpad-master.tar.xz |
This reverts commit 2b936b06c12657b684f6c7276d6ae5a24cb48ab5.
After getting deep into the dwarf5 range reader, I realized that this
should be done a somewhat different way. So reverting in favor or
a better design, coming in a few minutes.
Change-Id: Ie0b2846e70b3df1e637831e96ea69fe093f4e712
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2446011
Reviewed-by: Mark Mentovai <mark@chromium.org>
Diffstat (limited to 'src/common/linux')
-rw-r--r-- | src/common/linux/dump_symbols.cc | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc index ac2559cd..8ecf0bc4 100644 --- a/src/common/linux/dump_symbols.cc +++ b/src/common/linux/dump_symbols.cc @@ -232,14 +232,23 @@ bool LoadStabs(const typename ElfClass::Ehdr* elf_header, // owned by a function) with the results. class DumperRangesHandler : public DwarfCUToModule::RangesHandler { public: - DumperRangesHandler() { } + DumperRangesHandler(const uint8_t* buffer, uint64_t size, + dwarf2reader::ByteReader* reader) + : buffer_(buffer), size_(size), reader_(reader) { } bool ReadRanges(uint64_t offset, Module::Address base_address, vector<Module::Range>* ranges) { DwarfRangeListHandler handler(base_address, ranges); + dwarf2reader::RangeListReader rangelist_reader(buffer_, size_, reader_, + &handler); - return reader_->ReadRangeList(offset, &handler); + return rangelist_reader.ReadRangeList(offset); } + + private: + const uint8_t* buffer_; + uint64_t size_; + dwarf2reader::ByteReader* reader_; }; // A line-to-module loader that accepts line number info parsed by @@ -305,18 +314,17 @@ bool LoadDwarf(const string& dwarf_filename, } // Optional .debug_ranges reader + scoped_ptr<DumperRangesHandler> ranges_handler; dwarf2reader::SectionMap::const_iterator ranges_entry = file_context.section_map().find(".debug_ranges"); if (ranges_entry != file_context.section_map().end()) { const std::pair<const uint8_t*, uint64_t>& ranges_section = ranges_entry->second; - file_context.SetDebugRangeInfo(ranges_section.first, - ranges_section.second, - &byte_reader); + ranges_handler.reset( + new DumperRangesHandler(ranges_section.first, ranges_section.second, + &byte_reader)); } - DumperRangesHandler ranges_handler; - // Parse all the compilation units in the .debug_info section. DumperLineToModule line_to_module(&byte_reader); dwarf2reader::SectionMap::const_iterator debug_info_entry = @@ -333,7 +341,7 @@ bool LoadDwarf(const string& dwarf_filename, // data that was found. DwarfCUToModule::WarningReporter reporter(dwarf_filename, offset); DwarfCUToModule root_handler(&file_context, &line_to_module, - &ranges_handler, &reporter); + ranges_handler.get(), &reporter); // Make a Dwarf2Handler that drives the DIEHandler. dwarf2reader::DIEDispatcher die_dispatcher(&root_handler); // Make a DWARF parser for the compilation unit at OFFSET. |