mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-03-25 06:28:42 +00:00
Move the dwarf2reader objects into google_breakpad namespace to make it consistent with cfi_assembler.cc
Bug: b/189249305 Change-Id: I3433ff5c41d2f66ab292fbecb969f2cd08d24b29 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2920506 Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
committed by
Joshua Peraza
parent
f7428bc397
commit
0622f68827
@@ -228,34 +228,34 @@ bool LoadStabs(const typename ElfClass::Ehdr* elf_header,
|
||||
#endif // NO_STABS_SUPPORT
|
||||
|
||||
// A range handler that accepts rangelist data parsed by
|
||||
// dwarf2reader::RangeListReader and populates a range vector (typically
|
||||
// google_breakpad::RangeListReader and populates a range vector (typically
|
||||
// owned by a function) with the results.
|
||||
class DumperRangesHandler : public DwarfCUToModule::RangesHandler {
|
||||
public:
|
||||
DumperRangesHandler(dwarf2reader::ByteReader* reader) :
|
||||
DumperRangesHandler(google_breakpad::ByteReader* reader) :
|
||||
reader_(reader) { }
|
||||
|
||||
bool ReadRanges(
|
||||
enum dwarf2reader::DwarfForm form, uint64_t data,
|
||||
dwarf2reader::RangeListReader::CURangesInfo* cu_info,
|
||||
enum google_breakpad::DwarfForm form, uint64_t data,
|
||||
google_breakpad::RangeListReader::CURangesInfo* cu_info,
|
||||
vector<Module::Range>* ranges) {
|
||||
DwarfRangeListHandler handler(ranges);
|
||||
dwarf2reader::RangeListReader range_list_reader(reader_, cu_info,
|
||||
google_breakpad::RangeListReader range_list_reader(reader_, cu_info,
|
||||
&handler);
|
||||
return range_list_reader.ReadRanges(form, data);
|
||||
}
|
||||
|
||||
private:
|
||||
dwarf2reader::ByteReader* reader_;
|
||||
google_breakpad::ByteReader* reader_;
|
||||
};
|
||||
|
||||
// A line-to-module loader that accepts line number info parsed by
|
||||
// dwarf2reader::LineInfo and populates a Module and a line vector
|
||||
// google_breakpad::LineInfo and populates a Module and a line vector
|
||||
// with the results.
|
||||
class DumperLineToModule: public DwarfCUToModule::LineToModuleHandler {
|
||||
public:
|
||||
// Create a line-to-module converter using BYTE_READER.
|
||||
explicit DumperLineToModule(dwarf2reader::ByteReader* byte_reader)
|
||||
explicit DumperLineToModule(google_breakpad::ByteReader* byte_reader)
|
||||
: byte_reader_(byte_reader) { }
|
||||
void StartCompilationUnit(const string& compilation_dir) {
|
||||
compilation_dir_ = compilation_dir;
|
||||
@@ -267,7 +267,7 @@ class DumperLineToModule: public DwarfCUToModule::LineToModuleHandler {
|
||||
uint64_t line_string_section_length,
|
||||
Module* module, std::vector<Module::Line>* lines) {
|
||||
DwarfLineToModule handler(module, compilation_dir_, lines);
|
||||
dwarf2reader::LineInfo parser(program, length, byte_reader_,
|
||||
google_breakpad::LineInfo parser(program, length, byte_reader_,
|
||||
string_section, string_section_length,
|
||||
line_string_section,
|
||||
line_string_section_length,
|
||||
@@ -276,7 +276,7 @@ class DumperLineToModule: public DwarfCUToModule::LineToModuleHandler {
|
||||
}
|
||||
private:
|
||||
string compilation_dir_;
|
||||
dwarf2reader::ByteReader* byte_reader_;
|
||||
google_breakpad::ByteReader* byte_reader_;
|
||||
};
|
||||
|
||||
template<typename ElfClass>
|
||||
@@ -287,9 +287,9 @@ bool LoadDwarf(const string& dwarf_filename,
|
||||
Module* module) {
|
||||
typedef typename ElfClass::Shdr Shdr;
|
||||
|
||||
const dwarf2reader::Endianness endianness = big_endian ?
|
||||
dwarf2reader::ENDIANNESS_BIG : dwarf2reader::ENDIANNESS_LITTLE;
|
||||
dwarf2reader::ByteReader byte_reader(endianness);
|
||||
const google_breakpad::Endianness endianness = big_endian ?
|
||||
google_breakpad::ENDIANNESS_BIG : google_breakpad::ENDIANNESS_LITTLE;
|
||||
google_breakpad::ByteReader byte_reader(endianness);
|
||||
|
||||
// Construct a context for this file.
|
||||
DwarfCUToModule::FileContext file_context(dwarf_filename,
|
||||
@@ -316,7 +316,7 @@ bool LoadDwarf(const string& dwarf_filename,
|
||||
|
||||
// Parse all the compilation units in the .debug_info section.
|
||||
DumperLineToModule line_to_module(&byte_reader);
|
||||
dwarf2reader::SectionMap::const_iterator debug_info_entry =
|
||||
google_breakpad::SectionMap::const_iterator debug_info_entry =
|
||||
file_context.section_map().find(".debug_info");
|
||||
assert(debug_info_entry != file_context.section_map().end());
|
||||
const std::pair<const uint8_t*, uint64_t>& debug_info_section =
|
||||
@@ -332,9 +332,9 @@ bool LoadDwarf(const string& dwarf_filename,
|
||||
DwarfCUToModule root_handler(&file_context, &line_to_module,
|
||||
&ranges_handler, &reporter);
|
||||
// Make a Dwarf2Handler that drives the DIEHandler.
|
||||
dwarf2reader::DIEDispatcher die_dispatcher(&root_handler);
|
||||
google_breakpad::DIEDispatcher die_dispatcher(&root_handler);
|
||||
// Make a DWARF parser for the compilation unit at OFFSET.
|
||||
dwarf2reader::CompilationUnit reader(dwarf_filename,
|
||||
google_breakpad::CompilationUnit reader(dwarf_filename,
|
||||
file_context.section_map(),
|
||||
offset,
|
||||
&byte_reader,
|
||||
@@ -394,8 +394,8 @@ bool LoadDwarfCFI(const string& dwarf_filename,
|
||||
return false;
|
||||
}
|
||||
|
||||
const dwarf2reader::Endianness endianness = big_endian ?
|
||||
dwarf2reader::ENDIANNESS_BIG : dwarf2reader::ENDIANNESS_LITTLE;
|
||||
const google_breakpad::Endianness endianness = big_endian ?
|
||||
google_breakpad::ENDIANNESS_BIG : google_breakpad::ENDIANNESS_LITTLE;
|
||||
|
||||
// Find the call frame information and its size.
|
||||
const uint8_t* cfi =
|
||||
@@ -405,7 +405,7 @@ bool LoadDwarfCFI(const string& dwarf_filename,
|
||||
// Plug together the parser, handler, and their entourages.
|
||||
DwarfCFIToModule::Reporter module_reporter(dwarf_filename, section_name);
|
||||
DwarfCFIToModule handler(module, register_names, &module_reporter);
|
||||
dwarf2reader::ByteReader byte_reader(endianness);
|
||||
google_breakpad::ByteReader byte_reader(endianness);
|
||||
|
||||
byte_reader.SetAddressSize(ElfClass::kAddrSize);
|
||||
|
||||
@@ -417,9 +417,9 @@ bool LoadDwarfCFI(const string& dwarf_filename,
|
||||
if (text_section)
|
||||
byte_reader.SetTextBase(text_section->sh_addr);
|
||||
|
||||
dwarf2reader::CallFrameInfo::Reporter dwarf_reporter(dwarf_filename,
|
||||
google_breakpad::CallFrameInfo::Reporter dwarf_reporter(dwarf_filename,
|
||||
section_name);
|
||||
dwarf2reader::CallFrameInfo parser(cfi, cfi_size,
|
||||
google_breakpad::CallFrameInfo parser(cfi, cfi_size,
|
||||
&byte_reader, &handler, &dwarf_reporter,
|
||||
eh_frame);
|
||||
parser.Start();
|
||||
@@ -530,9 +530,9 @@ string ReadDebugLink(const uint8_t* debuglink,
|
||||
FDWrapper debuglink_fd_wrapper(debuglink_fd);
|
||||
|
||||
// The CRC is the last 4 bytes in |debuglink|.
|
||||
const dwarf2reader::Endianness endianness = big_endian ?
|
||||
dwarf2reader::ENDIANNESS_BIG : dwarf2reader::ENDIANNESS_LITTLE;
|
||||
dwarf2reader::ByteReader byte_reader(endianness);
|
||||
const google_breakpad::Endianness endianness = big_endian ?
|
||||
google_breakpad::ENDIANNESS_BIG : google_breakpad::ENDIANNESS_LITTLE;
|
||||
google_breakpad::ByteReader byte_reader(endianness);
|
||||
uint32_t expected_crc =
|
||||
byte_reader.ReadFourBytes(&debuglink[debuglink_size - 4]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user