From 1ea99a2ebcb6dd5ce3d8c6bd3e35774daa8ed203 Mon Sep 17 00:00:00 2001 From: Igor Kudrin Date: Thu, 6 Feb 2020 17:08:20 +0700 Subject: [PATCH] [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 --- llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp | 10 +++++----- .../X86/debug_addr_address_size_mismatch.s | 12 ++++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp index f71543799e28..02b8b8ee4bfe 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp @@ -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) diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_address_size_mismatch.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_address_size_mismatch.s index 49e694a9f1cc..fca66237ee00 100644 --- a/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_address_size_mismatch.s +++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_addr_address_size_mismatch.s @@ -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