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

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 17 12:06:22 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
----------------
dwblaikie wrote:

Hmm - rather than having to concatenate at every place nested errors are nested - could we have the code that prints it out do the concatenation? (so the API itself has high fidelity - still keeps the separate/nested Errors, but if a caller wants to render that to a user, concatenation is probably the right strategy?)

I don't feel strongly about this - if someone approves this patch/reckons this is the right way to go as-is, I'm OK with it.

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


More information about the llvm-commits mailing list