[llvm] 1ea99a2 - [DebugInfo] Allow reading an address table with a mismatched address.

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 8 05:01:03 PST 2020


Author: Igor Kudrin
Date: 2020-02-08T20:00:03+07:00
New Revision: 1ea99a2ebcb6dd5ce3d8c6bd3e35774daa8ed203

URL: https://github.com/llvm/llvm-project/commit/1ea99a2ebcb6dd5ce3d8c6bd3e35774daa8ed203
DIFF: https://github.com/llvm/llvm-project/commit/1ea99a2ebcb6dd5ce3d8c6bd3e35774daa8ed203.diff

LOG: [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

Added: 
    

Modified: 
    llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
    llvm/test/tools/llvm-dwarfdump/X86/debug_addr_address_size_mismatch.s

Removed: 
    


################################################################################
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 
diff erent 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 
diff erent 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 
diff erent from CU address size 4
-# ERR-NOT: {{.}}
+# WARN: .debug_addr table at offset 0x0 has address size 8 which is 
diff erent 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


        


More information about the llvm-commits mailing list