From f794d083dcb9adc445254a88d19170f02bee517c Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Sat, 16 Jan 2021 17:17:34 -0800 Subject: [PATCH] Dwarf5 fixes [5 of 5]: Recognize dwp version 5. Fifth of 5 small patches to fix various breakpad issues found while testing dump_syms of DWARF v5 in ChromeOS. DWARF v5 introduces a new dwp version, version 5. The current dwp reader only recognizes versions 1 & 2 as valid dwp versions. This CL fixes that. Change-Id: I5ac43b318b59e406ca1f6749232709aaef59a67b Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2634550 Reviewed-by: Sterling Augustine --- src/common/dwarf/dwarf2reader.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/dwarf/dwarf2reader.cc b/src/common/dwarf/dwarf2reader.cc index 9db1ba92..0f966612 100644 --- a/src/common/dwarf/dwarf2reader.cc +++ b/src/common/dwarf/dwarf2reader.cc @@ -1076,7 +1076,7 @@ void DwpReader::Initialize() { if (shndx_pool_ >= cu_index_ + cu_index_size_) { version_ = 0; } - } else if (version_ == 2) { + } else if (version_ == 2 || version_ == 5) { ncolumns_ = byte_reader_.ReadFourBytes( reinterpret_cast(cu_index_) + sizeof(uint32_t)); nunits_ = byte_reader_.ReadFourBytes( @@ -1154,7 +1154,7 @@ void DwpReader::ReadDebugSectionsForCU(uint64_t dwo_id, ".debug_str", std::make_pair(reinterpret_cast (string_buffer_), string_buffer_size_))); - } else if (version_ == 2) { + } else if (version_ == 2 || version_ == 5) { uint32_t index = LookupCUv2(dwo_id); if (index == 0) { return;