From 646f0f49200ed2e43a277c3bd63d5b377e57df34 Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Sat, 16 Jan 2021 16:47:33 -0800 Subject: [PATCH] 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 --- src/common/dwarf_cu_to_module.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/common/dwarf_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc index d6f86550..95e79357 100644 --- a/src/common/dwarf_cu_to_module.cc +++ b/src/common/dwarf_cu_to_module.cc @@ -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,