[DebugInfo] Allow reading an address table with a mismatched address.

This case does not look as an unrecoverable error.

Differential Revision: https://reviews.llvm.org/D74194
This commit is contained in:
Igor Kudrin 2020-02-06 17:08:20 +07:00
parent a978f6dd05
commit 17419b129b
2 changed files with 13 additions and 9 deletions

View File

@ -108,11 +108,11 @@ Error DWARFDebugAddrTable::extract(DWARFDataExtractor Data,
" has unsupported address size %" PRIu8,
HeaderOffset, HeaderData.AddrSize);
if (HeaderData.AddrSize != AddrSize && AddrSize != 0)
return createStringError(errc::invalid_argument,
".debug_addr table at offset 0x%" PRIx64
" has address size %" PRIu8
" which is different from CU address size %" PRIu8,
HeaderOffset, HeaderData.AddrSize, AddrSize);
WarnCallback(createStringError(
errc::invalid_argument,
".debug_addr table at offset 0x%" PRIx64 " has address size %" PRIu8
" which is different from CU address size %" PRIu8,
HeaderOffset, HeaderData.AddrSize, AddrSize));
// TODO: add support for non-zero segment selector size.
if (HeaderData.SegSize != 0)

View File

@ -1,11 +1,15 @@
# RUN: llvm-mc %s -filetype obj -triple i386-pc-linux -o - | \
# RUN: llvm-dwarfdump -debug-addr - 2> %t.err | FileCheck %s
# RUN: FileCheck %s -input-file %t.err -check-prefix=ERR
# RUN: llvm-dwarfdump -debug-addr - 2> %t.warn | FileCheck %s
# RUN: FileCheck %s -input-file %t.warn -check-prefix=WARN
# ERR: .debug_addr table at offset 0x0 has address size 8 which is different from CU address size 4
# ERR-NOT: {{.}}
# WARN: .debug_addr table at offset 0x0 has address size 8 which is different from CU address size 4
# WARN-NOT: {{.}}
# CHECK: .debug_addr contents
# CHECK-NEXT: length = 0x0000000c, version = 0x0005, addr_size = 0x08, seg_size = 0x00
# CHECK-NEXT: Addrs: [
# CHECK-NEXT: 0x0000000100000000
# CHECK-NEXT: ]
# CHECK-NEXT: length = 0x0000000c, version = 0x0005, addr_size = 0x04, seg_size = 0x00
# CHECK-NEXT: Addrs: [
# CHECK-NEXT: 0x00000000