[llvm] 2af4db7 - Migrate DWARFVerifier tests to lit-based yaml instead of gtest with embedded yaml

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 13 19:35:25 PDT 2021


Author: David Blaikie
Date: 2021-08-13T19:09:41-07:00
New Revision: 2af4db7d5cc8e752634a249cf328b27836810245

URL: https://github.com/llvm/llvm-project/commit/2af4db7d5cc8e752634a249cf328b27836810245
DIFF: https://github.com/llvm/llvm-project/commit/2af4db7d5cc8e752634a249cf328b27836810245.diff

LOG: Migrate DWARFVerifier tests to lit-based yaml instead of gtest with embedded yaml

Improves maintainability (edit/modify the tests without recompiling) and
error messages (previously the failure would be a gtest failure
mentioning nothing of the input or desired text) and the option to
improve tests with more checks.

(maybe these tests shouldn't all be in separate files - we could
probably have DWARF yaml that contains multiple errors while still being
fairly maintainable - the various invalid offsets (ref_addr, rnglists,
ranges, etc) could probably be all in one test, but for the simple sake
of the migration I just did the mechanical thing here)

Added: 
    llvm/test/tools/llvm-dwarfdump/X86/verify_cu_dont_share_line_table.yaml
    llvm/test/tools/llvm-dwarfdump/X86/verify_curanges_incomplete.yaml
    llvm/test/tools/llvm-dwarfdump/X86/verify_duplicate_file_warning.yaml
    llvm/test/tools/llvm-dwarfdump/X86/verify_elided_doesnt_fail.yaml
    llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_cu_ref.yaml
    llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_die_range.yaml
    llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_line_file_index.yaml
    llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_line_sequence.yaml
    llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_line_table_prologue_dir_index.yaml
    llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_ranges.yaml
    llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_ref_addr.yaml
    llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_ref_addr_between.yaml
    llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_rnglists.yaml
    llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_stmt_list.yaml
    llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_strp.yaml
    llvm/test/tools/llvm-dwarfdump/X86/verify_lexical_block_ranges.yaml
    llvm/test/tools/llvm-dwarfdump/X86/verify_nested_functions.yaml
    llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_function_ranges.yaml
    llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_lexical_block_ranges.yaml

Modified: 
    llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_cu_dont_share_line_table.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_cu_dont_share_line_table.yaml
new file mode 100644
index 0000000000000..3d0441ad8ca42
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_cu_dont_share_line_table.yaml
@@ -0,0 +1,74 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: not llvm-dwarfdump -debug-line -verify %t.o | FileCheck %s
+
+#      CHECK: Verifying .debug_line... 
+# CHECK-NEXT: error: two compile unit DIEs, 0x0000000b and 0x0000001f, have the same DW_AT_stmt_list section offset:
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+    - /tmp/main.c
+    - /tmp/foo.c
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_no
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+            - Attribute:       DW_AT_stmt_list
+              Form:            DW_FORM_sec_offset
+  debug_info:
+    - Version:         4
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000000001
+            - Value:           0x0000000000000000
+    - Length:          16
+      Version:         4
+      AbbrevTableID:   0
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x000000000000000D
+            - Value:           0x0000000000000000
+  debug_line:
+    - Version:         2
+      MinInstLength:   1
+      DefaultIsStmt:   1
+      LineBase:        251
+      LineRange:       14
+      OpcodeBase:      13
+      StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
+      IncludeDirs:
+        - /tmp
+      Files:
+        - Name:            main.c
+          DirIdx:          1
+          ModTime:         0
+          Length:          0
+      Opcodes:
+        - Opcode:          DW_LNS_extended_op
+          ExtLen:          9
+          SubOpcode:       DW_LNE_set_address
+          Data:            4096
+        - Opcode:          DW_LNS_advance_line
+          SData:           9
+          Data:            4096
+        - Opcode:          DW_LNS_copy
+          Data:            4096
+        - Opcode:          DW_LNS_advance_pc
+          Data:            256
+        - Opcode:          DW_LNS_extended_op
+          ExtLen:          1
+          SubOpcode:       DW_LNE_end_sequence
+          Data:            256

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_curanges_incomplete.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_curanges_incomplete.yaml
new file mode 100644
index 0000000000000..39fadca9f5ba9
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_curanges_incomplete.yaml
@@ -0,0 +1,49 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: not llvm-dwarfdump -verify %t.o | FileCheck %s
+
+#      CHECK: Verifying .debug_info Unit Header Chain...
+# CHECK-NEXT: error: DIE address ranges are not contained in its parent's ranges:
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+    - /tmp/main.c
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_yes
+          Attributes:
+            - Attribute:       DW_AT_low_pc
+              Form:            DW_FORM_addr
+            - Attribute:       DW_AT_high_pc
+              Form:            DW_FORM_addr
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+        - Code:            0x00000002
+          Tag:             DW_TAG_subprogram
+          Children:        DW_CHILDREN_no
+          Attributes:
+            - Attribute:       DW_AT_low_pc
+              Form:            DW_FORM_addr
+            - Attribute:       DW_AT_high_pc
+              Form:            DW_FORM_addr
+  debug_info:
+    - Version:         4
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000001000
+            - Value:           0x0000000000001500
+            - Value:           0x0000000000000001
+        - AbbrCode:        0x00000002
+          Values:
+            - Value:           0x0000000000001000
+            - Value:           0x0000000000002000
+        - AbbrCode:        0x00000000

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_duplicate_file_warning.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_duplicate_file_warning.yaml
new file mode 100644
index 0000000000000..d9ebd57d13fbb
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_duplicate_file_warning.yaml
@@ -0,0 +1,70 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: llvm-dwarfdump -debug-line -verify %t.o | FileCheck %s
+
+#      CHECK: Verifying .debug_line...
+# CHECK-NEXT: warning: .debug_line[0x00000000].prologue.file_names[2] is a duplicate of file_names[1]
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+    - /tmp/main.c
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_no
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+            - Attribute:       DW_AT_stmt_list
+              Form:            DW_FORM_sec_offset
+  debug_info:
+    - Version:         4
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000000001
+            - Value:           0x0000000000000000
+  debug_line:
+    - Version:         2
+      MinInstLength:   1
+      DefaultIsStmt:   1
+      LineBase:        251
+      LineRange:       14
+      OpcodeBase:      13
+      StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
+      IncludeDirs:
+        - /tmp
+      Files:
+        - Name:            main.c
+          DirIdx:          1
+          ModTime:         0
+          Length:          0
+        - Name:            main.c
+          DirIdx:          1
+          ModTime:         0
+          Length:          0
+      Opcodes:
+        - Opcode:          DW_LNS_extended_op
+          ExtLen:          9
+          SubOpcode:       DW_LNE_set_address
+          Data:            4096
+        - Opcode:          DW_LNS_advance_line
+          SData:           9
+          Data:            4096
+        - Opcode:          DW_LNS_copy
+          Data:            4096
+        - Opcode:          DW_LNS_advance_pc
+          Data:            16
+        - Opcode:          DW_LNS_set_file
+          Data:            1
+        - Opcode:          DW_LNS_extended_op
+          ExtLen:          1
+          SubOpcode:       DW_LNE_end_sequence
+          Data:            2

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_elided_doesnt_fail.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_elided_doesnt_fail.yaml
new file mode 100644
index 0000000000000..ff517f76a40e1
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_elided_doesnt_fail.yaml
@@ -0,0 +1,56 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: llvm-dwarfdump -verify %t.o | FileCheck --implicit-check-not=error: %s
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+    - /tmp/main.c
+    - main
+    - elided
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_yes
+          Attributes:
+            - Attribute:       DW_AT_low_pc
+              Form:            DW_FORM_addr
+            - Attribute:       DW_AT_high_pc
+              Form:            DW_FORM_addr
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+        - Code:            0x00000002
+          Tag:             DW_TAG_subprogram
+          Children:        DW_CHILDREN_no
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+            - Attribute:       DW_AT_low_pc
+              Form:            DW_FORM_addr
+            - Attribute:       DW_AT_high_pc
+              Form:            DW_FORM_addr
+  debug_info:
+    - Version:         4
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000001000
+            - Value:           0x0000000000002000
+            - Value:           0x0000000000000001
+        - AbbrCode:        0x00000002
+          Values:
+            - Value:           0x000000000000000D
+            - Value:           0x0000000000001000
+            - Value:           0x0000000000002000
+        - AbbrCode:        0x00000002
+          Values:
+            - Value:           0x0000000000000012
+            - Value:           0x0000000000002000
+            - Value:           0x0000000000002000
+        - AbbrCode:        0x00000000

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_cu_ref.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_cu_ref.yaml
new file mode 100644
index 0000000000000..d3a5ff7c5dcf5
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_cu_ref.yaml
@@ -0,0 +1,44 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: not llvm-dwarfdump -debug-info -verify %t.o | FileCheck %s
+
+#      CHECK: Verifying .debug_info Unit Header Chain...
+# CHECK-NEXT: error: DW_FORM_ref4 CU offset 0x00001234 is invalid (must be less than CU size of 0x0000001a):
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+    - /tmp/main.c
+    - main
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_yes
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+        - Code:            0x00000002
+          Tag:             DW_TAG_subprogram
+          Children:        DW_CHILDREN_no
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+            - Attribute:       DW_AT_type
+              Form:            DW_FORM_ref4
+  debug_info:
+    - Version:         4
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000000001
+        - AbbrCode:        0x00000002
+          Values:
+            - Value:           0x000000000000000D
+            - Value:           0x0000000000001234
+        - AbbrCode:        0x00000000

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_die_range.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_die_range.yaml
new file mode 100644
index 0000000000000..31ff1231eab8d
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_die_range.yaml
@@ -0,0 +1,47 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: not llvm-dwarfdump -verify %t.o | FileCheck %s
+
+#      CHECK: Verifying .debug_info Unit Header Chain...
+# CHECK-NEXT: error: Invalid address range
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+    - /tmp/main.c
+    - main
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_yes
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+        - Code:            0x00000002
+          Tag:             DW_TAG_subprogram
+          Children:        DW_CHILDREN_no
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+            - Attribute:       DW_AT_low_pc
+              Form:            DW_FORM_addr
+            - Attribute:       DW_AT_high_pc
+              Form:            DW_FORM_addr
+  debug_info:
+    - Version:         4
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000000001
+        - AbbrCode:        0x00000002
+          Values:
+            - Value:           0x000000000000000D
+            - Value:           0x0000000000001000
+            - Value:           0x0000000000000900
+        - AbbrCode:        0x00000000

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_line_file_index.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_line_file_index.yaml
new file mode 100644
index 0000000000000..1a0862d01efd5
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_line_file_index.yaml
@@ -0,0 +1,66 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: not llvm-dwarfdump -debug-line -verify %t.o | FileCheck %s
+
+#      CHECK: Verifying .debug_line...
+# CHECK-NEXT: error: .debug_line[0x00000000][1] has invalid file index 5 (valid values are [1,1]):
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+    - /tmp/main.c
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_no
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+            - Attribute:       DW_AT_stmt_list
+              Form:            DW_FORM_sec_offset
+  debug_info:
+    - Version:         4
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000000001
+            - Value:           0x0000000000000000
+  debug_line:
+    - Version:         2
+      MinInstLength:   1
+      DefaultIsStmt:   1
+      LineBase:        251
+      LineRange:       14
+      OpcodeBase:      13
+      StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
+      IncludeDirs:
+        - /tmp
+      Files:
+        - Name:            main.c
+          DirIdx:          1
+          ModTime:         0
+          Length:          0
+      Opcodes:
+        - Opcode:          DW_LNS_extended_op
+          ExtLen:          9
+          SubOpcode:       DW_LNE_set_address
+          Data:            4096
+        - Opcode:          DW_LNS_advance_line
+          SData:           9
+          Data:            4096
+        - Opcode:          DW_LNS_copy
+          Data:            4096
+        - Opcode:          DW_LNS_advance_pc
+          Data:            16
+        - Opcode:          DW_LNS_set_file
+          Data:            5
+        - Opcode:          DW_LNS_extended_op
+          ExtLen:          1
+          SubOpcode:       DW_LNE_end_sequence
+          Data:            5

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_line_sequence.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_line_sequence.yaml
new file mode 100644
index 0000000000000..c587707b9f7c8
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_line_sequence.yaml
@@ -0,0 +1,64 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: not llvm-dwarfdump -debug-line -verify %t.o | FileCheck %s
+
+#      CHECK: Verifying .debug_line...
+# CHECK-NEXT: error: .debug_line[0x00000000] row[1] decreases in address from previous row:
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+    - /tmp/main.c
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_no
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+            - Attribute:       DW_AT_stmt_list
+              Form:            DW_FORM_sec_offset
+  debug_info:
+    - Version:         4
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000000001
+            - Value:           0x0000000000000000
+  debug_line:
+    - Version:         2
+      MinInstLength:   1
+      DefaultIsStmt:   1
+      LineBase:        251
+      LineRange:       14
+      OpcodeBase:      13
+      StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
+      IncludeDirs:
+        - /tmp
+      Files:
+        - Name:            main.c
+          DirIdx:          1
+          ModTime:         0
+          Length:          0
+      Opcodes:
+        - Opcode:          DW_LNS_extended_op
+          ExtLen:          9
+          SubOpcode:       DW_LNE_set_address
+          Data:            4112
+        - Opcode:          DW_LNS_advance_line
+          SData:           9
+          Data:            4112
+        - Opcode:          DW_LNS_copy
+          Data:            4112
+        - Opcode:          DW_LNS_advance_pc
+          Data:            18446744073709551600
+        - Opcode:          DW_LNS_extended_op
+          ExtLen:          1
+          SubOpcode:       DW_LNE_end_sequence
+          Data:            18446744073709551600

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_line_table_prologue_dir_index.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_line_table_prologue_dir_index.yaml
new file mode 100644
index 0000000000000..1b5e28c0bb50e
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_line_table_prologue_dir_index.yaml
@@ -0,0 +1,66 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: not llvm-dwarfdump -debug-line -verify %t.o | FileCheck %s
+
+#      CHECK: Verifying .debug_line...
+# CHECK-NEXT: error: .debug_line[0x00000000].prologue.file_names[1].dir_idx contains an invalid index: 2
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+    - /tmp/main.c
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_no
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+            - Attribute:       DW_AT_stmt_list
+              Form:            DW_FORM_sec_offset
+  debug_info:
+    - Version:         4
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000000001
+            - Value:           0x0000000000000000
+  debug_line:
+    - Version:         2
+      MinInstLength:   1
+      DefaultIsStmt:   1
+      LineBase:        251
+      LineRange:       14
+      OpcodeBase:      13
+      StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
+      IncludeDirs:
+        - /tmp
+      Files:
+        - Name:            main.c
+          DirIdx:          2
+          ModTime:         0
+          Length:          0
+      Opcodes:
+        - Opcode:          DW_LNS_extended_op
+          ExtLen:          9
+          SubOpcode:       DW_LNE_set_address
+          Data:            4096
+        - Opcode:          DW_LNS_advance_line
+          SData:           9
+          Data:            4096
+        - Opcode:          DW_LNS_copy
+          Data:            4096
+        - Opcode:          DW_LNS_advance_pc
+          Data:            16
+        - Opcode:          DW_LNS_set_file
+          Data:            1
+        - Opcode:          DW_LNS_extended_op
+          ExtLen:          1
+          SubOpcode:       DW_LNE_end_sequence
+          Data:            1

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_ranges.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_ranges.yaml
new file mode 100644
index 0000000000000..53317d7fc3c64
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_ranges.yaml
@@ -0,0 +1,33 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: not llvm-dwarfdump -debug-info -verify %t.o | FileCheck %s
+
+#      CHECK: Verifying .debug_info Unit Header Chain...
+# CHECK-NEXT: error: DW_AT_ranges offset is beyond .debug_ranges bounds: 0x00001000
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+    - /tmp/main.c
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_no
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+            - Attribute:       DW_AT_ranges
+              Form:            DW_FORM_sec_offset
+  debug_info:
+    - Version:         4
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000000001
+            - Value:           0x0000000000001000

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_ref_addr.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_ref_addr.yaml
new file mode 100644
index 0000000000000..b998e1a754dcd
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_ref_addr.yaml
@@ -0,0 +1,44 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: not llvm-dwarfdump -debug-info -verify %t.o | FileCheck %s
+
+#      CHECK: Verifying .debug_info Unit Header Chain...
+# CHECK-NEXT: error: DW_FORM_ref_addr offset beyond .debug_info bounds:
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+    - /tmp/main.c
+    - main
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_yes
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+        - Code:            0x00000002
+          Tag:             DW_TAG_subprogram
+          Children:        DW_CHILDREN_no
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+            - Attribute:       DW_AT_type
+              Form:            DW_FORM_ref_addr
+  debug_info:
+    - Version:         4
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000000001
+        - AbbrCode:        0x00000002
+          Values:
+            - Value:           0x000000000000000D
+            - Value:           0x0000000000001234
+        - AbbrCode:        0x00000000

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_ref_addr_between.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_ref_addr_between.yaml
new file mode 100644
index 0000000000000..605af01311af8
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_ref_addr_between.yaml
@@ -0,0 +1,44 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: not llvm-dwarfdump -debug-info -verify %t.o | FileCheck %s
+
+#      CHECK: Verifying .debug_info references...
+# CHECK-NEXT: error: invalid DIE reference 0x00000011. Offset is in between DIEs:
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+    - /tmp/main.c
+    - main
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_yes
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+        - Code:            0x00000002
+          Tag:             DW_TAG_subprogram
+          Children:        DW_CHILDREN_no
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+            - Attribute:       DW_AT_type
+              Form:            DW_FORM_ref_addr
+  debug_info:
+    - Version:         4
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000000001
+        - AbbrCode:        0x00000002
+          Values:
+            - Value:           0x000000000000000D
+            - Value:           0x0000000000000011
+        - AbbrCode:        0x00000000

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_rnglists.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_rnglists.yaml
new file mode 100644
index 0000000000000..6328f1f22ec71
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_rnglists.yaml
@@ -0,0 +1,34 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: not llvm-dwarfdump -debug-info -verify %t.o | FileCheck %s
+
+#      CHECK: Verifying .debug_info Unit Header Chain...
+# CHECK-NEXT: error: DW_AT_ranges offset is beyond .debug_rnglists bounds: 0x00001000
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+    - /tmp/main.c
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_no
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+            - Attribute:       DW_AT_ranges
+              Form:            DW_FORM_sec_offset
+  debug_info:
+    - Version:         5
+      UnitType:        DW_UT_compile
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000000001
+            - Value:           0x0000000000001000

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_stmt_list.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_stmt_list.yaml
new file mode 100644
index 0000000000000..22db1c1ed1a32
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_stmt_list.yaml
@@ -0,0 +1,33 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: not llvm-dwarfdump -debug-info -verify %t.o | FileCheck %s
+
+#      CHECK: Verifying .debug_info Unit Header Chain...
+# CHECK-NEXT: error: DW_AT_stmt_list offset is beyond .debug_line bounds: 0x00001000
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+    - /tmp/main.c
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_no
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+            - Attribute:       DW_AT_stmt_list
+              Form:            DW_FORM_sec_offset
+  debug_info:
+    - Version:         4
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000000001
+            - Value:           0x0000000000001000

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_strp.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_strp.yaml
new file mode 100644
index 0000000000000..128c8ba4c4934
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_invalid_strp.yaml
@@ -0,0 +1,29 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: not llvm-dwarfdump -debug-info -verify %t.o | FileCheck %s
+
+#      CHECK: Verifying .debug_info Unit Header Chain... 
+# CHECK-NEXT: error: DW_FORM_strp offset beyond .debug_str bounds:
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_no
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+  debug_info:
+    - Version:         4
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000001234

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_lexical_block_ranges.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_lexical_block_ranges.yaml
new file mode 100644
index 0000000000000..b2e3667b106b7
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_lexical_block_ranges.yaml
@@ -0,0 +1,60 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: not llvm-dwarfdump -verify %t.o | FileCheck %s
+
+#      CHECK: Verifying .debug_info Unit Header Chain...
+# CHECK-NEXT: error: DIE address ranges are not contained in its parent's ranges:
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+    - /tmp/main.c
+    - main
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_yes
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+        - Code:            0x00000002
+          Tag:             DW_TAG_subprogram
+          Children:        DW_CHILDREN_yes
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+            - Attribute:       DW_AT_low_pc
+              Form:            DW_FORM_addr
+            - Attribute:       DW_AT_high_pc
+              Form:            DW_FORM_addr
+        - Code:            0x00000003
+          Tag:             DW_TAG_lexical_block
+          Children:        DW_CHILDREN_no
+          Attributes:
+            - Attribute:       DW_AT_low_pc
+              Form:            DW_FORM_addr
+            - Attribute:       DW_AT_high_pc
+              Form:            DW_FORM_addr
+  debug_info:
+    - Version:         4
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000000001
+        - AbbrCode:        0x00000002
+          Values:
+            - Value:           0x000000000000000D
+            - Value:           0x0000000000001000
+            - Value:           0x0000000000002000
+        - AbbrCode:        0x00000003
+          Values:
+            - Value:           0x0000000000001000
+            - Value:           0x0000000000002001
+        - AbbrCode:        0x00000000
+        - AbbrCode:        0x00000000

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_nested_functions.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_nested_functions.yaml
new file mode 100644
index 0000000000000..275639b2e3a87
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_nested_functions.yaml
@@ -0,0 +1,59 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: llvm-dwarfdump -verify %t.o | FileCheck --implicit-check-not=error: %s
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+    - /tmp/main.c
+    - main
+    - nested
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_yes
+          Attributes:
+            - Attribute:       DW_AT_low_pc
+              Form:            DW_FORM_addr
+            - Attribute:       DW_AT_high_pc
+              Form:            DW_FORM_addr
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+        - Code:            0x00000002
+          Tag:             DW_TAG_subprogram
+          Children:        DW_CHILDREN_yes
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+            - Attribute:       DW_AT_low_pc
+              Form:            DW_FORM_addr
+            - Attribute:       DW_AT_high_pc
+              Form:            DW_FORM_addr
+  debug_info:
+    - Version:         4
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000001000
+            - Value:           0x0000000000002000
+            - Value:           0x0000000000000001
+        - AbbrCode:        0x00000002
+          Values:
+            - Value:           0x000000000000000D
+            - Value:           0x0000000000001000
+            - Value:           0x0000000000001500
+        - AbbrCode:        0x00000002
+          Values:
+            - Value:           0x0000000000000012
+            - Value:           0x0000000000001500
+            - Value:           0x0000000000002000
+        - AbbrCode:        0x00000000
+        - AbbrCode:        0x00000000
+        - AbbrCode:        0x00000000
+  

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_function_ranges.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_function_ranges.yaml
new file mode 100644
index 0000000000000..430e77e4fa8a1
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_function_ranges.yaml
@@ -0,0 +1,54 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: not llvm-dwarfdump -verify %t.o | FileCheck %s
+
+#      CHECK: Verifying .debug_info Unit Header Chain...
+# CHECK-NEXT: error: DIEs have overlapping address ranges
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+    - /tmp/main.c
+    - main
+    - foo
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_yes
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+        - Code:            0x00000002
+          Tag:             DW_TAG_subprogram
+          Children:        DW_CHILDREN_no
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+            - Attribute:       DW_AT_low_pc
+              Form:            DW_FORM_addr
+            - Attribute:       DW_AT_high_pc
+              Form:            DW_FORM_addr
+  debug_info:
+    - Version:         4
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000000001
+        - AbbrCode:        0x00000002
+          Values:
+            - Value:           0x000000000000000D
+            - Value:           0x0000000000001000
+            - Value:           0x0000000000002000
+        - AbbrCode:        0x00000002
+          Values:
+            - Value:           0x0000000000000012
+            - Value:           0x0000000000001FFF
+            - Value:           0x0000000000002000
+        - AbbrCode:        0x00000000
+

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_lexical_block_ranges.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_lexical_block_ranges.yaml
new file mode 100644
index 0000000000000..0644f65d4eef3
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_lexical_block_ranges.yaml
@@ -0,0 +1,71 @@
+# RUN: yaml2obj %s -o %t.o
+# RUN: not llvm-dwarfdump -verify %t.o | FileCheck %s
+
+#      CHECK: Verifying .debug_info Unit Header Chain...
+# CHECK-NEXT: error: DIEs have overlapping address ranges
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_str:
+    - ''
+    - /tmp/main.c
+    - main
+  debug_abbrev:
+    - Table:
+        - Code:            0x00000001
+          Tag:             DW_TAG_compile_unit
+          Children:        DW_CHILDREN_yes
+          Attributes:
+            - Attribute:       DW_AT_low_pc
+              Form:            DW_FORM_addr
+            - Attribute:       DW_AT_high_pc
+              Form:            DW_FORM_addr
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+        - Code:            0x00000002
+          Tag:             DW_TAG_subprogram
+          Children:        DW_CHILDREN_yes
+          Attributes:
+            - Attribute:       DW_AT_name
+              Form:            DW_FORM_strp
+            - Attribute:       DW_AT_low_pc
+              Form:            DW_FORM_addr
+            - Attribute:       DW_AT_high_pc
+              Form:            DW_FORM_addr
+        - Code:            0x00000003
+          Tag:             DW_TAG_lexical_block
+          Children:        DW_CHILDREN_no
+          Attributes:
+            - Attribute:       DW_AT_low_pc
+              Form:            DW_FORM_addr
+            - Attribute:       DW_AT_high_pc
+              Form:            DW_FORM_addr
+  debug_info:
+    - Version:         4
+      AddrSize:        8
+      Entries:
+        - AbbrCode:        0x00000001
+          Values:
+            - Value:           0x0000000000001000
+            - Value:           0x0000000000002000
+            - Value:           0x0000000000000001
+        - AbbrCode:        0x00000002
+          Values:
+            - Value:           0x000000000000000D
+            - Value:           0x0000000000001000
+            - Value:           0x0000000000002000
+        - AbbrCode:        0x00000003
+          Values:
+            - Value:           0x0000000000001100
+            - Value:           0x0000000000001300
+        - AbbrCode:        0x00000003
+          Values:
+            - Value:           0x00000000000012FF
+            - Value:           0x0000000000001300
+        - AbbrCode:        0x00000000
+        - AbbrCode:        0x00000000
+

diff  --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
index 9a48066ea2eb3..9073a3fc8eba9 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -36,6 +36,7 @@
 using namespace llvm;
 using namespace dwarf;
 using namespace utils;
+using ::testing::HasSubstr;
 
 namespace {
 
@@ -1851,649 +1852,6 @@ TEST(DWARFDebugInfo, TestImplicitConstAbbrevs) {
   EXPECT_EQ(DIEs.find(Val2)->second, AbbrevPtrVal2);
 }
 
-void VerifyWarning(DWARFContext &DwarfContext, StringRef Error) {
-  SmallString<1024> Str;
-  raw_svector_ostream Strm(Str);
-  EXPECT_TRUE(DwarfContext.verify(Strm));
-  EXPECT_TRUE(Str.str().contains(Error));
-}
-
-void VerifyError(DWARFContext &DwarfContext, StringRef Error) {
-  SmallString<1024> Str;
-  raw_svector_ostream Strm(Str);
-  EXPECT_FALSE(DwarfContext.verify(Strm));
-  EXPECT_TRUE(Str.str().contains(Error));
-}
-
-void VerifySuccess(DWARFContext &DwarfContext) {
-  SmallString<1024> Str;
-  raw_svector_ostream Strm(Str);
-  EXPECT_TRUE(DwarfContext.verify(Strm));
-}
-
-TEST(DWARFDebugInfo, TestDwarfVerifyInvalidCURef) {
-  // Create a single compile unit with a single function that has a DW_AT_type
-  // that is CU relative. The CU offset is not valid because it is larger than
-  // the compile unit itself.
-
-  const char *yamldata = R"(
-    debug_str:
-      - ''
-      - /tmp/main.c
-      - main
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_yes
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-          - Code:            0x00000002
-            Tag:             DW_TAG_subprogram
-            Children:        DW_CHILDREN_no
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-              - Attribute:       DW_AT_type
-                Form:            DW_FORM_ref4
-    debug_info:
-      - Version:         4
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000000001
-          - AbbrCode:        0x00000002
-            Values:
-              - Value:           0x000000000000000D
-              - Value:           0x0000000000001234
-          - AbbrCode:        0x00000000
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(StringRef(yamldata));
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifyError(*DwarfContext, "error: DW_FORM_ref4 CU offset 0x00001234 is "
-                             "invalid (must be less than CU size of "
-                             "0x0000001a):");
-}
-
-TEST(DWARFDebugInfo, TestDwarfVerifyInvalidRefAddr) {
-  // Create a single compile unit with a single function that has an invalid
-  // DW_AT_type with an invalid .debug_info offset in its DW_FORM_ref_addr.
-  const char *yamldata = R"(
-    debug_str:
-      - ''
-      - /tmp/main.c
-      - main
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_yes
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-          - Code:            0x00000002
-            Tag:             DW_TAG_subprogram
-            Children:        DW_CHILDREN_no
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-              - Attribute:       DW_AT_type
-                Form:            DW_FORM_ref_addr
-    debug_info:
-      - Version:         4
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000000001
-          - AbbrCode:        0x00000002
-            Values:
-              - Value:           0x000000000000000D
-              - Value:           0x0000000000001234
-          - AbbrCode:        0x00000000
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(StringRef(yamldata));
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifyError(*DwarfContext,
-              "error: DW_FORM_ref_addr offset beyond .debug_info bounds:");
-}
-
-TEST(DWARFDebugInfo, TestDwarfVerifyInvalidRanges) {
-  // Create a single compile unit with a DW_AT_ranges whose section offset
-  // isn't valid.
-  const char *yamldata = R"(
-    debug_str:
-      - ''
-      - /tmp/main.c
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_no
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-              - Attribute:       DW_AT_ranges
-                Form:            DW_FORM_sec_offset
-    debug_info:
-      - Version:         4
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000000001
-              - Value:           0x0000000000001000
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(StringRef(yamldata));
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifyError(
-      *DwarfContext,
-      "error: DW_AT_ranges offset is beyond .debug_ranges bounds: 0x00001000");
-}
-
-TEST(DWARFDebugInfo, TestDwarfVerifyInvalidRnglists) {
-  // Create a single compile unit with a DW_AT_ranges whose section offset
-  // isn't valid.
-  const char *yamldata = R"(
-    debug_str:
-      - ''
-      - /tmp/main.c
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_no
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-              - Attribute:       DW_AT_ranges
-                Form:            DW_FORM_sec_offset
-    debug_info:
-      - Version:         5
-        UnitType:        DW_UT_compile
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000000001
-              - Value:           0x0000000000001000
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(StringRef(yamldata));
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifyError(*DwarfContext, "error: DW_AT_ranges offset is beyond "
-                             ".debug_rnglists bounds: 0x00001000");
-}
-
-TEST(DWARFDebugInfo, TestDwarfVerifyInvalidStmtList) {
-  // Create a single compile unit with a DW_AT_stmt_list whose section offset
-  // isn't valid.
-  const char *yamldata = R"(
-    debug_str:
-      - ''
-      - /tmp/main.c
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_no
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-              - Attribute:       DW_AT_stmt_list
-                Form:            DW_FORM_sec_offset
-    debug_info:
-      - Version:         4
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000000001
-              - Value:           0x0000000000001000
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(StringRef(yamldata));
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifyError(
-      *DwarfContext,
-      "error: DW_AT_stmt_list offset is beyond .debug_line bounds: 0x00001000");
-}
-
-TEST(DWARFDebugInfo, TestDwarfVerifyInvalidStrp) {
-  // Create a single compile unit with a single function that has an invalid
-  // DW_FORM_strp for the DW_AT_name.
-  const char *yamldata = R"(
-    debug_str:
-      - ''
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_no
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-    debug_info:
-      - Version:         4
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000001234
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(StringRef(yamldata));
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifyError(*DwarfContext,
-              "error: DW_FORM_strp offset beyond .debug_str bounds:");
-}
-
-TEST(DWARFDebugInfo, TestDwarfVerifyInvalidRefAddrBetween) {
-  // Create a single compile unit with a single function that has a DW_AT_type
-  // with a valid .debug_info offset, but the offset is between two DIEs.
-  const char *yamldata = R"(
-    debug_str:
-      - ''
-      - /tmp/main.c
-      - main
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_yes
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-          - Code:            0x00000002
-            Tag:             DW_TAG_subprogram
-            Children:        DW_CHILDREN_no
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-              - Attribute:       DW_AT_type
-                Form:            DW_FORM_ref_addr
-    debug_info:
-      - Version:         4
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000000001
-          - AbbrCode:        0x00000002
-            Values:
-              - Value:           0x000000000000000D
-              - Value:           0x0000000000000011
-          - AbbrCode:        0x00000000
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(StringRef(yamldata));
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifyError(
-      *DwarfContext,
-      "error: invalid DIE reference 0x00000011. Offset is in between DIEs:");
-}
-
-TEST(DWARFDebugInfo, TestDwarfVerifyInvalidLineSequence) {
-  // Create a single compile unit whose line table has a sequence in it where
-  // the address decreases.
-  StringRef yamldata = R"(
-    debug_str:
-      - ''
-      - /tmp/main.c
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_no
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-              - Attribute:       DW_AT_stmt_list
-                Form:            DW_FORM_sec_offset
-    debug_info:
-      - Version:         4
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000000001
-              - Value:           0x0000000000000000
-    debug_line:
-      - Version:         2
-        MinInstLength:   1
-        DefaultIsStmt:   1
-        LineBase:        251
-        LineRange:       14
-        OpcodeBase:      13
-        StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
-        IncludeDirs:
-          - /tmp
-        Files:
-          - Name:            main.c
-            DirIdx:          1
-            ModTime:         0
-            Length:          0
-        Opcodes:
-          - Opcode:          DW_LNS_extended_op
-            ExtLen:          9
-            SubOpcode:       DW_LNE_set_address
-            Data:            4112
-          - Opcode:          DW_LNS_advance_line
-            SData:           9
-            Data:            4112
-          - Opcode:          DW_LNS_copy
-            Data:            4112
-          - Opcode:          DW_LNS_advance_pc
-            Data:            18446744073709551600
-          - Opcode:          DW_LNS_extended_op
-            ExtLen:          1
-            SubOpcode:       DW_LNE_end_sequence
-            Data:            18446744073709551600
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifyError(*DwarfContext, "error: .debug_line[0x00000000] row[1] decreases "
-                             "in address from previous row:");
-}
-
-TEST(DWARFDebugInfo, TestDwarfVerifyInvalidLineFileIndex) {
-  // Create a single compile unit whose line table has a line table row with
-  // an invalid file index.
-  StringRef yamldata = R"(
-    debug_str:
-      - ''
-      - /tmp/main.c
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_no
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-              - Attribute:       DW_AT_stmt_list
-                Form:            DW_FORM_sec_offset
-    debug_info:
-      - Version:         4
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000000001
-              - Value:           0x0000000000000000
-    debug_line:
-      - Version:         2
-        MinInstLength:   1
-        DefaultIsStmt:   1
-        LineBase:        251
-        LineRange:       14
-        OpcodeBase:      13
-        StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
-        IncludeDirs:
-          - /tmp
-        Files:
-          - Name:            main.c
-            DirIdx:          1
-            ModTime:         0
-            Length:          0
-        Opcodes:
-          - Opcode:          DW_LNS_extended_op
-            ExtLen:          9
-            SubOpcode:       DW_LNE_set_address
-            Data:            4096
-          - Opcode:          DW_LNS_advance_line
-            SData:           9
-            Data:            4096
-          - Opcode:          DW_LNS_copy
-            Data:            4096
-          - Opcode:          DW_LNS_advance_pc
-            Data:            16
-          - Opcode:          DW_LNS_set_file
-            Data:            5
-          - Opcode:          DW_LNS_extended_op
-            ExtLen:          1
-            SubOpcode:       DW_LNE_end_sequence
-            Data:            5
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifyError(*DwarfContext, "error: .debug_line[0x00000000][1] has invalid "
-                             "file index 5 (valid values are [1,1]):");
-}
-
-TEST(DWARFDebugInfo, TestDwarfVerifyInvalidLineTablePorlogueDirIndex) {
-  // Create a single compile unit whose line table has a prologue with an
-  // invalid dir index.
-  StringRef yamldata = R"(
-    debug_str:
-      - ''
-      - /tmp/main.c
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_no
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-              - Attribute:       DW_AT_stmt_list
-                Form:            DW_FORM_sec_offset
-    debug_info:
-      - Version:         4
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000000001
-              - Value:           0x0000000000000000
-    debug_line:
-      - Version:         2
-        MinInstLength:   1
-        DefaultIsStmt:   1
-        LineBase:        251
-        LineRange:       14
-        OpcodeBase:      13
-        StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
-        IncludeDirs:
-          - /tmp
-        Files:
-          - Name:            main.c
-            DirIdx:          2
-            ModTime:         0
-            Length:          0
-        Opcodes:
-          - Opcode:          DW_LNS_extended_op
-            ExtLen:          9
-            SubOpcode:       DW_LNE_set_address
-            Data:            4096
-          - Opcode:          DW_LNS_advance_line
-            SData:           9
-            Data:            4096
-          - Opcode:          DW_LNS_copy
-            Data:            4096
-          - Opcode:          DW_LNS_advance_pc
-            Data:            16
-          - Opcode:          DW_LNS_set_file
-            Data:            1
-          - Opcode:          DW_LNS_extended_op
-            ExtLen:          1
-            SubOpcode:       DW_LNE_end_sequence
-            Data:            1
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifyError(*DwarfContext,
-              "error: .debug_line[0x00000000].prologue."
-              "file_names[1].dir_idx contains an invalid index: 2");
-}
-
-TEST(DWARFDebugInfo, TestDwarfVerifyDuplicateFileWarning) {
-  // Create a single compile unit whose line table has a prologue with an
-  // invalid dir index.
-  StringRef yamldata = R"(
-    debug_str:
-      - ''
-      - /tmp/main.c
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_no
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-              - Attribute:       DW_AT_stmt_list
-                Form:            DW_FORM_sec_offset
-    debug_info:
-      - Version:         4
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000000001
-              - Value:           0x0000000000000000
-    debug_line:
-      - Version:         2
-        MinInstLength:   1
-        DefaultIsStmt:   1
-        LineBase:        251
-        LineRange:       14
-        OpcodeBase:      13
-        StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
-        IncludeDirs:
-          - /tmp
-        Files:
-          - Name:            main.c
-            DirIdx:          1
-            ModTime:         0
-            Length:          0
-          - Name:            main.c
-            DirIdx:          1
-            ModTime:         0
-            Length:          0
-        Opcodes:
-          - Opcode:          DW_LNS_extended_op
-            ExtLen:          9
-            SubOpcode:       DW_LNE_set_address
-            Data:            4096
-          - Opcode:          DW_LNS_advance_line
-            SData:           9
-            Data:            4096
-          - Opcode:          DW_LNS_copy
-            Data:            4096
-          - Opcode:          DW_LNS_advance_pc
-            Data:            16
-          - Opcode:          DW_LNS_set_file
-            Data:            1
-          - Opcode:          DW_LNS_extended_op
-            ExtLen:          1
-            SubOpcode:       DW_LNE_end_sequence
-            Data:            2
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifyWarning(*DwarfContext,
-                "warning: .debug_line[0x00000000].prologue.file_names[2] is "
-                "a duplicate of file_names[1]");
-}
-
-TEST(DWARFDebugInfo, TestDwarfVerifyCUDontShareLineTable) {
-  // Create a two compile units where both compile units share the same
-  // DW_AT_stmt_list value and verify we report the error correctly.
-  StringRef yamldata = R"(
-    debug_str:
-      - ''
-      - /tmp/main.c
-      - /tmp/foo.c
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_no
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-              - Attribute:       DW_AT_stmt_list
-                Form:            DW_FORM_sec_offset
-    debug_info:
-      - Version:         4
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000000001
-              - Value:           0x0000000000000000
-      - Length:          16
-        Version:         4
-        AbbrevTableID:   0
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x000000000000000D
-              - Value:           0x0000000000000000
-    debug_line:
-      - Version:         2
-        MinInstLength:   1
-        DefaultIsStmt:   1
-        LineBase:        251
-        LineRange:       14
-        OpcodeBase:      13
-        StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
-        IncludeDirs:
-          - /tmp
-        Files:
-          - Name:            main.c
-            DirIdx:          1
-            ModTime:         0
-            Length:          0
-        Opcodes:
-          - Opcode:          DW_LNS_extended_op
-            ExtLen:          9
-            SubOpcode:       DW_LNE_set_address
-            Data:            4096
-          - Opcode:          DW_LNS_advance_line
-            SData:           9
-            Data:            4096
-          - Opcode:          DW_LNS_copy
-            Data:            4096
-          - Opcode:          DW_LNS_advance_pc
-            Data:            256
-          - Opcode:          DW_LNS_extended_op
-            ExtLen:          1
-            SubOpcode:       DW_LNE_end_sequence
-            Data:            256
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifyError(*DwarfContext,
-              "error: two compile unit DIEs, 0x0000000b and "
-              "0x0000001f, have the same DW_AT_stmt_list section "
-              "offset:");
-}
-
 TEST(DWARFDebugInfo, TestErrorReporting) {
   Triple Triple("x86_64-pc-linux");
   if (!isConfigurationSupported(Triple))
@@ -2528,413 +1886,6 @@ TEST(DWARFDebugInfo, TestErrorReporting) {
   EXPECT_TRUE(Errors == 2);
 }
 
-TEST(DWARFDebugInfo, TestDwarfVerifyCURangesIncomplete) {
-  // Create a single compile unit with a single function. The compile
-  // unit has a DW_AT_ranges attribute that doesn't fully contain the
-  // address range of the function. The verification should fail due to
-  // the CU ranges not containing all of the address ranges of all of the
-  // functions.
-  StringRef yamldata = R"(
-    debug_str:
-      - ''
-      - /tmp/main.c
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_yes
-            Attributes:
-              - Attribute:       DW_AT_low_pc
-                Form:            DW_FORM_addr
-              - Attribute:       DW_AT_high_pc
-                Form:            DW_FORM_addr
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-          - Code:            0x00000002
-            Tag:             DW_TAG_subprogram
-            Children:        DW_CHILDREN_no
-            Attributes:
-              - Attribute:       DW_AT_low_pc
-                Form:            DW_FORM_addr
-              - Attribute:       DW_AT_high_pc
-                Form:            DW_FORM_addr
-    debug_info:
-      - Version:         4
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000001000
-              - Value:           0x0000000000001500
-              - Value:           0x0000000000000001
-          - AbbrCode:        0x00000002
-            Values:
-              - Value:           0x0000000000001000
-              - Value:           0x0000000000002000
-          - AbbrCode:        0x00000000
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifyError(*DwarfContext, "error: DIE address ranges are not "
-                             "contained in its parent's ranges:");
-}
-
-TEST(DWARFDebugInfo, TestDwarfVerifyLexicalBlockRanges) {
-  // Create a single compile unit with a single function that has a lexical
-  // block whose address range is not contained in the function address range.
-  StringRef yamldata = R"(
-    debug_str:
-      - ''
-      - /tmp/main.c
-      - main
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_yes
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-          - Code:            0x00000002
-            Tag:             DW_TAG_subprogram
-            Children:        DW_CHILDREN_yes
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-              - Attribute:       DW_AT_low_pc
-                Form:            DW_FORM_addr
-              - Attribute:       DW_AT_high_pc
-                Form:            DW_FORM_addr
-          - Code:            0x00000003
-            Tag:             DW_TAG_lexical_block
-            Children:        DW_CHILDREN_no
-            Attributes:
-              - Attribute:       DW_AT_low_pc
-                Form:            DW_FORM_addr
-              - Attribute:       DW_AT_high_pc
-                Form:            DW_FORM_addr
-    debug_info:
-      - Version:         4
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000000001
-          - AbbrCode:        0x00000002
-            Values:
-              - Value:           0x000000000000000D
-              - Value:           0x0000000000001000
-              - Value:           0x0000000000002000
-          - AbbrCode:        0x00000003
-            Values:
-              - Value:           0x0000000000001000
-              - Value:           0x0000000000002001
-          - AbbrCode:        0x00000000
-          - AbbrCode:        0x00000000
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifyError(*DwarfContext, "error: DIE address ranges are not "
-                             "contained in its parent's ranges:");
-}
-
-TEST(DWARFDebugInfo, TestDwarfVerifyOverlappingFunctionRanges) {
-  // Create a single compile unit with a two functions that have overlapping
-  // address ranges.
-  StringRef yamldata = R"(
-    debug_str:
-      - ''
-      - /tmp/main.c
-      - main
-      - foo
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_yes
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-          - Code:            0x00000002
-            Tag:             DW_TAG_subprogram
-            Children:        DW_CHILDREN_no
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-              - Attribute:       DW_AT_low_pc
-                Form:            DW_FORM_addr
-              - Attribute:       DW_AT_high_pc
-                Form:            DW_FORM_addr
-    debug_info:
-      - Version:         4
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000000001
-          - AbbrCode:        0x00000002
-            Values:
-              - Value:           0x000000000000000D
-              - Value:           0x0000000000001000
-              - Value:           0x0000000000002000
-          - AbbrCode:        0x00000002
-            Values:
-              - Value:           0x0000000000000012
-              - Value:           0x0000000000001FFF
-              - Value:           0x0000000000002000
-          - AbbrCode:        0x00000000
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifyError(*DwarfContext, "error: DIEs have overlapping address ranges:");
-}
-
-TEST(DWARFDebugInfo, TestDwarfVerifyOverlappingLexicalBlockRanges) {
-  // Create a single compile unit with a one function that has two lexical
-  // blocks with overlapping address ranges.
-  StringRef yamldata = R"(
-    debug_str:
-      - ''
-      - /tmp/main.c
-      - main
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_yes
-            Attributes:
-              - Attribute:       DW_AT_low_pc
-                Form:            DW_FORM_addr
-              - Attribute:       DW_AT_high_pc
-                Form:            DW_FORM_addr
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-          - Code:            0x00000002
-            Tag:             DW_TAG_subprogram
-            Children:        DW_CHILDREN_yes
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-              - Attribute:       DW_AT_low_pc
-                Form:            DW_FORM_addr
-              - Attribute:       DW_AT_high_pc
-                Form:            DW_FORM_addr
-          - Code:            0x00000003
-            Tag:             DW_TAG_lexical_block
-            Children:        DW_CHILDREN_no
-            Attributes:
-              - Attribute:       DW_AT_low_pc
-                Form:            DW_FORM_addr
-              - Attribute:       DW_AT_high_pc
-                Form:            DW_FORM_addr
-    debug_info:
-      - Version:         4
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000001000
-              - Value:           0x0000000000002000
-              - Value:           0x0000000000000001
-          - AbbrCode:        0x00000002
-            Values:
-              - Value:           0x000000000000000D
-              - Value:           0x0000000000001000
-              - Value:           0x0000000000002000
-          - AbbrCode:        0x00000003
-            Values:
-              - Value:           0x0000000000001100
-              - Value:           0x0000000000001300
-          - AbbrCode:        0x00000003
-            Values:
-              - Value:           0x00000000000012FF
-              - Value:           0x0000000000001300
-          - AbbrCode:        0x00000000
-          - AbbrCode:        0x00000000
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifyError(*DwarfContext, "error: DIEs have overlapping address ranges:");
-}
-
-TEST(DWARFDebugInfo, TestDwarfVerifyInvalidDIERange) {
-  // Create a single compile unit with a single function that has an invalid
-  // address range where the high PC is smaller than the low PC.
-  StringRef yamldata = R"(
-    debug_str:
-      - ''
-      - /tmp/main.c
-      - main
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_yes
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-          - Code:            0x00000002
-            Tag:             DW_TAG_subprogram
-            Children:        DW_CHILDREN_no
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-              - Attribute:       DW_AT_low_pc
-                Form:            DW_FORM_addr
-              - Attribute:       DW_AT_high_pc
-                Form:            DW_FORM_addr
-    debug_info:
-      - Version:         4
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000000001
-          - AbbrCode:        0x00000002
-            Values:
-              - Value:           0x000000000000000D
-              - Value:           0x0000000000001000
-              - Value:           0x0000000000000900
-          - AbbrCode:        0x00000000
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifyError(*DwarfContext, "error: Invalid address range");
-}
-
-TEST(DWARFDebugInfo, TestDwarfVerifyElidedDoesntFail) {
-  // Create a single compile unit with two functions: one that has a valid range
-  // and one whose low and high PC are the same. When the low and high PC are
-  // the same, this indicates the function was dead code stripped. We want to
-  // ensure that verification succeeds.
-  StringRef yamldata = R"(
-    debug_str:
-      - ''
-      - /tmp/main.c
-      - main
-      - elided
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_yes
-            Attributes:
-              - Attribute:       DW_AT_low_pc
-                Form:            DW_FORM_addr
-              - Attribute:       DW_AT_high_pc
-                Form:            DW_FORM_addr
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-          - Code:            0x00000002
-            Tag:             DW_TAG_subprogram
-            Children:        DW_CHILDREN_no
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-              - Attribute:       DW_AT_low_pc
-                Form:            DW_FORM_addr
-              - Attribute:       DW_AT_high_pc
-                Form:            DW_FORM_addr
-    debug_info:
-      - Version:         4
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000001000
-              - Value:           0x0000000000002000
-              - Value:           0x0000000000000001
-          - AbbrCode:        0x00000002
-            Values:
-              - Value:           0x000000000000000D
-              - Value:           0x0000000000001000
-              - Value:           0x0000000000002000
-          - AbbrCode:        0x00000002
-            Values:
-              - Value:           0x0000000000000012
-              - Value:           0x0000000000002000
-              - Value:           0x0000000000002000
-          - AbbrCode:        0x00000000
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifySuccess(*DwarfContext);
-}
-
-TEST(DWARFDebugInfo, TestDwarfVerifyNestedFunctions) {
-  // Create a single compile unit with a nested function which is not contained
-  // in its parent. Although LLVM doesn't generate this, it is valid accoridng
-  // to the DWARF standard.
-  StringRef yamldata = R"(
-    debug_str:
-      - ''
-      - /tmp/main.c
-      - main
-      - nested
-    debug_abbrev:
-      - Table:
-          - Code:            0x00000001
-            Tag:             DW_TAG_compile_unit
-            Children:        DW_CHILDREN_yes
-            Attributes:
-              - Attribute:       DW_AT_low_pc
-                Form:            DW_FORM_addr
-              - Attribute:       DW_AT_high_pc
-                Form:            DW_FORM_addr
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-          - Code:            0x00000002
-            Tag:             DW_TAG_subprogram
-            Children:        DW_CHILDREN_yes
-            Attributes:
-              - Attribute:       DW_AT_name
-                Form:            DW_FORM_strp
-              - Attribute:       DW_AT_low_pc
-                Form:            DW_FORM_addr
-              - Attribute:       DW_AT_high_pc
-                Form:            DW_FORM_addr
-    debug_info:
-      - Version:         4
-        AddrSize:        8
-        Entries:
-          - AbbrCode:        0x00000001
-            Values:
-              - Value:           0x0000000000001000
-              - Value:           0x0000000000002000
-              - Value:           0x0000000000000001
-          - AbbrCode:        0x00000002
-            Values:
-              - Value:           0x000000000000000D
-              - Value:           0x0000000000001000
-              - Value:           0x0000000000001500
-          - AbbrCode:        0x00000002
-            Values:
-              - Value:           0x0000000000000012
-              - Value:           0x0000000000001500
-              - Value:           0x0000000000002000
-          - AbbrCode:        0x00000000
-          - AbbrCode:        0x00000000
-          - AbbrCode:        0x00000000
-  )";
-  auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
-  ASSERT_TRUE((bool)ErrOrSections);
-  std::unique_ptr<DWARFContext> DwarfContext =
-      DWARFContext::create(*ErrOrSections, 8);
-  VerifySuccess(*DwarfContext);
-}
-
 TEST(DWARFDebugInfo, TestDWARFDieRangeInfoContains) {
   DWARFVerifier::DieRangeInfo Empty;
   ASSERT_TRUE(Empty.contains(Empty));


        


More information about the llvm-commits mailing list