Share .debug_line and .debug_line_str among dwp file and main binary file.

The debug info in the dwp file needs to refer to the .debug_line and
.debug_line_str sections in the main binary.

This fixes dump_syms not generating LINE records for dwp in split dwarf.

Bug: chromium:1448979
Change-Id: I71923f12cea72caae081c1406e2cbca55e95859e
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4576346
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Zequan Wu 2023-05-31 16:26:04 -04:00 committed by Joshua Peraza
parent 18aa6faf2e
commit a9bb984785
6 changed files with 72 additions and 17 deletions

View file

@ -82,7 +82,8 @@ CompilationUnit::CompilationUnit(const string& path,
is_split_dwarf_(false), is_type_unit_(false), dwo_id_(0), dwo_name_(),
skeleton_dwo_id_(0), addr_base_(0),
str_offsets_base_(0), have_checked_for_dwp_(false),
should_process_split_dwarf_(false) {}
should_process_split_dwarf_(false), low_pc_(0),
has_source_line_info_(false), source_line_offset_(0) {}
// Initialize a compilation unit from a .dwo or .dwp file.
// In this case, we need the .debug_addr section from the
@ -91,8 +92,7 @@ CompilationUnit::CompilationUnit(const string& path,
// the executable file, and call it as if we were still
// processing the original compilation unit.
void CompilationUnit::SetSplitDwarf(
uint64_t addr_base,
void CompilationUnit::SetSplitDwarf(uint64_t addr_base,
uint64_t dwo_id) {
is_split_dwarf_ = true;
addr_base_ = addr_base;
@ -435,6 +435,12 @@ uint64_t CompilationUnit::Start() {
string_buffer_length_ = iter->second.second;
}
iter = GetSectionByName(sections_, ".debug_line");
if (iter != sections_.end()) {
line_buffer_ = iter->second.first;
line_buffer_length_ = iter->second.second;
}
// Set the line string section if we have one.
iter = GetSectionByName(sections_, ".debug_line_str");
if (iter != sections_.end()) {