From f6669d6df42686aea832762f701359a3f9bdc762 Mon Sep 17 00:00:00 2001 From: Sterling Augustine Date: Fri, 2 Oct 2020 07:44:24 -0700 Subject: Revert "Refactor rangelist handling to prepare for dwarf5 .debug_rngslist" 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 --- src/common/linux/dump_symbols.cc | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'src/common/linux') 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* 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 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& 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. -- cgit v1.2.1