[llvm] [DebugInfo] Separate error generation from reporting in DWARFHeaderUnit::extract (PR #68242)

Alex Langford via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 17 09:55:45 PDT 2023


================
@@ -0,0 +1,75 @@
+# This test checks that llvm-dwarfdump correctly reports errors when parsing
+# DWARF Unit Headers in DWP files
+
+# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o \
+# RUN:         -split-dwarf-file=%t.dwo -dwarf-version=5
+# RUN: llvm-dwp %t.dwo -o %t.dwp
+# RUN: llvm-dwarfdump -debug-info -debug-cu-index -debug-tu-index \
+# RUN:                -manaully-generate-unit-index %t.dwp 2>&1 | FileCheck %s
+
+## Note: In order to check whether the type unit index is generated
+## there is no need to add the missing DIEs for the structure type of the type unit.
+
+# CHECK-NOT: .debug_info.dwo contents:
+
+# CHECK-DAG: .debug_cu_index contents:
+# CHECK: Failed to parse CU header in DWP file
+# CHECK-NEXT: DWARF unit at offset 0x00000000 has unsupported version 6, supported are 2-5
+
+# CHECK-DAG: .debug_tu_index contents:
+# CHECK: Failed to parse CU header in DWP file
+# CHECK-NEXT: DWARF unit at offset 0x00000000 has unsupported version 6, supported are 2-5
----------------
bulbazord wrote:

As James pointed out above, my code was not actually creating one error from the two but concatenating them together. I'll update the code and the test to be closer to what we expect from it.

https://github.com/llvm/llvm-project/pull/68242


More information about the llvm-commits mailing list