mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-01-01 20:24:40 +01:00
Revert "Refactor rangelist handling to prepare for dwarf5 .debug_rngslist"
This reverts commit 2b936b06c1.
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>
This commit is contained in:
parent
2b936b06c1
commit
f6669d6df4
6 changed files with 48 additions and 59 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue