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 <saugustine@google.com>
This commit is contained in:
Caroline Tice 2021-01-16 17:17:34 -08:00 committed by Sterling Augustine
parent 3c528da94c
commit f794d083dc

View file

@ -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<const uint8_t*>(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<const uint8_t*> (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;