Dwarf5 fixes [3 of 5]: Fix bugs reading .debug_line_str.

Third of 5 small patches to fix various breakpad issues found
while testing dump_syms on DWARF v5 in ChromeOS.

The offset into the line table was being incorrectly added to the
.debug_string and debug_line_str sections in the code for reading
the line table.  It was also skipping trying to read the line table
if the .debug_line_str section was present.  This CL fixes these
issues.

Change-Id: If14543731016bcee201b8c33dca53e9520007222
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2634548
Reviewed-by: Sterling Augustine <saugustine@google.com>
This commit is contained in:
Caroline Tice 2021-01-16 16:47:33 -08:00 committed by Sterling Augustine
parent ac9712d9b4
commit 646f0f4920

View file

@ -1024,16 +1024,15 @@ void DwarfCUToModule::ReadSourceLines(uint64_t offset) {
uint64_t string_section_length = 0;
map_entry = dwarf2reader::GetSectionByName(section_map, ".debug_str");
if (map_entry != section_map.end()) {
string_section_start = map_entry->second.first + offset;
string_section_length = map_entry->second.second - offset;
string_section_start = map_entry->second.first;
string_section_length = map_entry->second.second;
}
const uint8_t* line_string_section_start = nullptr;
uint64_t line_string_section_length = 0;
map_entry = dwarf2reader::GetSectionByName(section_map, ".debug_line_str");
if (map_entry != section_map.end()) {
line_string_section_start = map_entry->second.first + offset;
line_string_section_length = map_entry->second.second - offset;
return;
line_string_section_start = map_entry->second.first;
line_string_section_length = map_entry->second.second;
}
line_reader_->ReadProgram(
line_section_start, line_section_length,