[NFC] Change the string offsets table tests to generate the object on the fly

which enables us to remove the test scripts and object files from the repository.

https://reviews.llvm.org/D40914

llvm-svn: 320227
This commit is contained in:
Wolfgang Pieb 2017-12-09 00:39:53 +00:00
parent 79a8c282e3
commit 8b1a175be6
20 changed files with 262 additions and 211 deletions

View File

@ -1,10 +0,0 @@
# Test object to verify that llvm-dwarfdump handles a degenerate string offsets
# section.
#
# To generate the test object:
# llvm-mc -triple x86_64-unknown-linux dwarfdump-str-offsets-invalid-5.s -filetype=obj \
# -o dwarfdump-str-offsets-invalid-5.x86_64.o
# Every unit contributes to the string_offsets table.
.section .debug_str_offsets,"",@progbits
# A degenerate section, not enough for a single entry.
.byte 2

View File

@ -1,12 +1,11 @@
# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
# RUN: llvm-dwarfdump -v %t.o | FileCheck %s
# Test object to verify that dwarfdump handles dwp files with DWARF v5 string
# offset tables. We have 2 CUs and 2 TUs, where it is assumed that
# CU1 and TU1 came from one object file, CU2 and TU2 from a second object
# file.
#
# To generate the test object:
# llvm-mc -triple x86_64-unknown-linux dwarfdump-str-offsets-dwp.s -filetype=obj \
# -o dwarfdump-str_offsets-dwp.x86_64.o
.section .debug_str.dwo,"MS",@progbits,1
str_producer:
.asciz "Handmade DWARF producer"
@ -275,3 +274,59 @@ TU2_5_end:
.long TU2_5_end-TU2_5_start
.long abbrev_end-.debug_abbrev.dwo
.long .debug_str_offsets_end_TU2-.debug_str_offsets_start_TU2
# Verify that the correct strings from each unit are displayed and that the
# index for the .debug_str_offsets section has the right values.
# CHECK: Compile Unit
# CHECK-NOT: NULL
# CHECK: DW_TAG_compile_unit
# CHECK-NEXT: DW_AT_producer [DW_FORM_strx] ( indexed (00000000) string = "Handmade DWARF producer")
# CHECK-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "Compile_Unit_1")
# CHECK-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
# CHECK-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000002) string = "/home/test/CU1")
# CHECK-NOT: NULL
# CHECK: Compile Unit
# CHECK-NOT: NULL
# CHECK: DW_TAG_compile_unit
# CHECK-NEXT: DW_AT_producer [DW_FORM_strx] ( indexed (00000000) string = "Handmade DWARF producer")
# CHECK-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "Compile_Unit_2")
# CHECK-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
# CHECK-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000002) string = "/home/test/CU2")
#
# CHECK: Type Unit
# CHECK-NOT: NULL
# CHECK: DW_TAG_type_unit
# CHECK-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000000) string = "Type_Unit_1")
# CHECK-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x0000001c)
# CHECK-NOT: NULL
# CHECK: DW_TAG_structure_type
# CHECK-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "MyStruct_1")
#
# CHECK: Type Unit
# CHECK-NOT: NULL
# CHECK: DW_TAG_type_unit
# CHECK-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000000) string = "Type_Unit_2")
# CHECK-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x0000001c)
# CHECK-NOT: NULL
# CHECK: DW_TAG_structure_type
# CHECK-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "MyStruct_2")
# Verify the correct offets of the compile and type units contributions in the
# index tables.
# CHECK: .debug_cu_index contents:
# CHECK-NOT: contents:
# CHECK: 1 0xddeeaaddbbaabbee [{{0x[0-9a-f]*, 0x[0-9a-f]*}}) [{{0x[0-9a-f]*, 0x[0-9a-f]*}})
# CHECK-SAME: [0x00000000
# CHECK-NEXT: 2 0xff00ffeeffaaff00 [{{0x[0-9a-f]*, 0x[0-9a-f]*}}) [{{0x[0-9a-f]*, 0x[0-9a-f]*}})
# CHECK-SAME: [0x00000024
# CHECK: .debug_tu_index contents:
# CHECK-NOT: contents:
# CHECK: 1 0xeeaaddbbaabbeedd [{{0x[0-9a-f]*, 0x[0-9a-f]*}}) [{{0x[0-9a-f]*, 0x[0-9a-f]*}})
# CHECK-SAME: [0x00000000
# CHECK-NEXT: 2 0x00ffeeffaaff00ff [{{0x[0-9a-f]*, 0x[0-9a-f]*}}) [{{0x[0-9a-f]*, 0x[0-9a-f]*}})
# CHECK: [0x00000024

View File

@ -1,10 +1,9 @@
# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
# RUN: llvm-dwarfdump -v %t.o | FileCheck --check-prefix=INVALIDCONTRIB %s
#
# Test object to verify that llvm-dwarfdump handles an invalid string offsets
# table.
#
# To generate the test object:
# llvm-mc -triple x86_64-unknown-linux dwarfdump-str-offsets-invalid-1.s -filetype=obj \
# -o dwarfdump-str-offsets-invalid-1.x86_64.o
#
# A rudimentary abbrev section.
.section .debug_abbrev,"",@progbits
.byte 0x01 # Abbrev code
@ -32,3 +31,7 @@ CU1_5_end:
.section .debug_str_offsets,"",@progbits
# A degenerate section, not enough for a single contribution size.
.byte 2
# INVALIDCONTRIB: .debug_str_offsets contents:
# INVALIDCONTRIB-NOT: contents:
# INVALIDCONTRIB: error: invalid contribution to string offsets table in section .debug_str_offsets.

View File

@ -1,10 +1,9 @@
# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
# RUN: llvm-dwarfdump -v %t.o | FileCheck --check-prefix=INVALIDCONTRIB %s
#
# Test object to verify that llvm-dwarfdump handles an invalid string offsets
# table.
#
# To generate the test object:
# llvm-mc -triple x86_64-unknown-linux dwarfdump-str-offsets-invalid-2.s -filetype=obj \
# -o dwarfdump-str-offsets-invalid-2.x86_64.o
# A rudimentary abbrev section.
.section .debug_abbrev,"",@progbits
.byte 0x01 # Abbrev code
@ -34,3 +33,7 @@ CU1_5_end:
.long 0xffffffff
.long 0
.short 4
# INVALIDCONTRIB: .debug_str_offsets contents:
# INVALIDCONTRIB-NOT: contents:
# INVALIDCONTRIB: error: invalid contribution to string offsets table in section .debug_str_offsets.

View File

@ -1,9 +1,8 @@
# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
# RUN: llvm-dwarfdump -v %t.o | FileCheck --check-prefix=INVALIDCONTRIB %s
#
# Test object to verify that llvm-dwarfdump handles an invalid string offsets
# table.
#
# To generate the test object:
# llvm-mc -triple x86_64-unknown-linux dwarfdump-str-offsets-invalid-3.s -filetype=obj \
# -o dwarfdump-str-offsets-invalid-3.x86_64.o
.section .debug_str,"MS",@progbits,1
str_producer:
@ -86,3 +85,7 @@ CU1_5_end:
.long str_TU
.long str_TU_type
.debug_str_offsets_segment2_end:
# INVALIDCONTRIB: .debug_str_offsets contents:
# INVALIDCONTRIB-NOT: contents:
# INVALIDCONTRIB: error: invalid contribution to string offsets table in section .debug_str_offsets.

View File

@ -1,9 +1,8 @@
# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
# RUN: llvm-dwarfdump -v %t.o | FileCheck --check-prefix=INVALIDLENGTH %s
#
# Test object to verify that llvm-dwarfdump handles an invalid string offsets
# table.
#
# To generate the test object:
# llvm-mc -triple x86_64-unknown-linux dwarfdump-str-offsets-invalid-4.s -filetype=obj \
# -o dwarfdump-str-offsets-invalid-4.x86_64.o
.section .debug_str,"MS",@progbits,1
str_producer:
@ -48,3 +47,7 @@ CU1_5_end:
.long str_CU1
.byte 0
.debug_str_offsets_segment0_end:
# INVALIDLENGTH: .debug_str_offsets contents:
# INVALIDLENGTH-NOT: contents:
# INVALIDLENGTH: error: contribution to string offsets table in section .debug_str_offsets has invalid length.

View File

@ -0,0 +1,14 @@
# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
# RUN: llvm-dwarfdump -v %t.o | FileCheck --check-prefix=INVALIDSECTIONLENGTH %s
#
# Test object to verify that llvm-dwarfdump handles a degenerate string offsets
# section.
#
# Every unit contributes to the string_offsets table.
.section .debug_str_offsets,"",@progbits
# A degenerate section, not enough for a single entry.
.byte 2
# INVALIDSECTIONLENGTH: .debug_str_offsets contents:
# INVALIDSECTIONLENGTH-NOT: contents:
# INVALIDSECTIONLENGTH: error: size of .debug_str_offsets is not a multiple of 4.

View File

@ -1,11 +1,10 @@
# RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o %t.o
# RUN: llvm-dwarfdump -v %t.o | FileCheck --check-prefix=COMMON %s
#
# Test object to verify dwarfdump handles v5 string offset tables in Mach-O.
# This is similar to dwarfdump-str-offsets.s with 2 CUs and 1 TU, but no
# split sections.
#
# To generate the test object:
# llvm-mc -triple i386-apple-darwin9 dwarfdump-str-offsets-macho.s -filetype=obj \
# -o dwarfdump-str-offsets-macho.o
.section __DWARF,__debug_str,regular,debug
Linfo_string:
.asciz "Handmade DWARF producer"
@ -199,3 +198,67 @@ TU_5_end:
.subsections_via_symbols
# We are using a hand-constructed object file and are interest in the correct
# diplay of the DW_str_offsetsbase attribute and the correct display of strings.
#
# Abbreviation for DW_AT_str_offsets_base
# COMMON: .debug_abbrev contents:
# COMMON-NOT: contents:
# COMMON: DW_TAG_compile_unit
# COMMON-NOT: DW_TAG
# COMMON: DW_AT_str_offsets_base DW_FORM_sec_offset
#
# Verify that strings are displayed correctly as indexed strings
# COMMON: .debug_info contents:
# COMMON-NOT: contents:
# COMMON: DW_TAG_compile_unit
# COMMON-NEXT: DW_AT_producer [DW_FORM_strx] ( indexed (00000000) string = "Handmade DWARF producer")
# COMMON-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "Compile_Unit_1")
# COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
# COMMON-NEXT: DW_AT_comp_dir [DW_FORM_strx] ( indexed (00000002) string = "/home/test/CU1")
# COMMON-NOT: NULL
# COMMON: DW_TAG_subprogram
# COMMON-NEXT: DW_AT_name [DW_FORM_strx1] ( indexed (00000003) string = "MyFunc")
# COMMON-NOT: NULL
# COMMON: DW_TAG_variable
# COMMON-NEXT: DW_AT_name [DW_FORM_strx2] ( indexed (00000004) string = "MyVar1")
# COMMON-NOT: NULL
# COMMON: DW_TAG_variable
# COMMON-NEXT: DW_AT_name [DW_FORM_strx3] ( indexed (00000005) string = "MyVar2")
# COMMON-NOT: NULL
# COMMON: DW_TAG_variable
# COMMON-NEXT: DW_AT_name [DW_FORM_strx4] ( indexed (00000006) string = "MyVar3")
#
# Second compile unit (b.cpp)
# COMMON: DW_TAG_compile_unit
# COMMON-NEXT: DW_AT_producer [DW_FORM_strx] ( indexed (00000000) string = "Handmade DWARF producer")
# COMMON-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "Compile_Unit_2")
# COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x0000002c)
# COMMON-NEXT: DW_AT_comp_dir [DW_FORM_strx] ( indexed (00000002) string = "/home/test/CU2")
#
# The type unit
# COMMON: .debug_types contents:
# COMMON: DW_TAG_type_unit
# COMMON-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000000) string = "Type_Unit")
# COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000040)
# COMMON: DW_TAG_structure_type
# COMMON-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "MyStruct")
#
# The .debug_str_offsets section
# COMMON: .debug_str_offsets contents:
# COMMON-NEXT: 0x00000000: Contribution size = 28, Version = 5
# COMMON-NEXT: 0x00000008: 00000000 "Handmade DWARF producer"
# COMMON-NEXT: 0x0000000c: 00000018 "Compile_Unit_1"
# COMMON-NEXT: 0x00000010: 00000027 "/home/test/CU1"
# COMMON-NEXT: 0x00000014: 00000067 "MyFunc"
# COMMON-NEXT: 0x00000018: 0000006e "MyVar1"
# COMMON-NEXT: 0x0000001c: 00000075 "MyVar2"
# COMMON-NEXT: 0x00000020: 0000007c "MyVar3"
# COMMON-NEXT: 0x00000024: Contribution size = 12, Version = 5
# COMMON-NEXT: 0x0000002c: 00000000 "Handmade DWARF producer"
# COMMON-NEXT: 0x00000030: 00000036 "Compile_Unit_2"
# COMMON-NEXT: 0x00000034: 00000045 "/home/test/CU2"
# COMMON-NEXT: 0x00000038: Contribution size = 8, Version = 5
# COMMON-NEXT: 0x00000040: 00000054 "Type_Unit"
# COMMON-NEXT: 0x00000044: 0000005e "MyStruct"

View File

@ -1,9 +1,9 @@
# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
# RUN: llvm-dwarfdump -v %t.o | FileCheck --check-prefix=COMMON --check-prefix=SPLIT %s
# Test object to verify dwarfdump handles v5 string offset tables.
# We have 2 v5 CUs, a v5 TU, and a split v5 CU and TU.
#
# To generate the test object:
# llvm-mc -triple x86_64-unknown-linux dwarfdump-str-offsets.s -filetype=obj \
# -o dwarfdump-str-offsets.x86_64.o
.section .debug_str,"MS",@progbits,1
str_producer:
@ -303,3 +303,94 @@ TU_split_5_type:
.byte 0 # NULL
.byte 0 # NULL
TU_split_5_end:
# We are using a hand-constructed object file and are interest in the correct
# diplay of the DW_str_offsetsbase attribute, the correct display of strings
# and the dump of the .debug_str_offsets[.dwo] table.
# Abbreviation for DW_AT_str_offsets_base
# COMMON: .debug_abbrev contents:
# COMMON-NOT: contents:
# COMMON: DW_TAG_compile_unit
# COMMON-NOT: DW_TAG
# COMMON: DW_AT_str_offsets_base DW_FORM_sec_offset
#
# Verify that strings are displayed correctly as indexed strings
# COMMON: .debug_info contents:
# COMMON-NOT: contents:
# COMMON: DW_TAG_compile_unit
# COMMON-NEXT: DW_AT_producer [DW_FORM_strx] ( indexed (00000000) string = "Handmade DWARF producer")
# COMMON-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "Compile_Unit_1")
# COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
# COMMON-NEXT: DW_AT_comp_dir [DW_FORM_strx] ( indexed (00000002) string = "/home/test/CU1")
# COMMON-NOT: NULL
# COMMON: DW_TAG_subprogram
# COMMON-NEXT: DW_AT_name [DW_FORM_strx1] ( indexed (00000003) string = "MyFunc")
# COMMON-NOT: NULL
# COMMON: DW_TAG_variable
# COMMON-NEXT: DW_AT_name [DW_FORM_strx2] ( indexed (00000004) string = "MyVar1")
# COMMON-NOT: NULL
# COMMON: DW_TAG_variable
# COMMON-NEXT: DW_AT_name [DW_FORM_strx3] ( indexed (00000005) string = "MyVar2")
# COMMON-NOT: NULL
# COMMON: DW_TAG_variable
# COMMON-NEXT: DW_AT_name [DW_FORM_strx4] ( indexed (00000006) string = "MyVar3")
#
# Second compile unit (b.cpp)
# COMMON: DW_TAG_compile_unit
# COMMON-NEXT: DW_AT_producer [DW_FORM_strx] ( indexed (00000000) string = "Handmade DWARF producer")
# COMMON-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "Compile_Unit_2")
# COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x0000002c)
# COMMON-NEXT: DW_AT_comp_dir [DW_FORM_strx] ( indexed (00000002) string = "/home/test/CU2")
#
# The split CU
# SPLIT: .debug_info.dwo contents:
# SPLIT-NOT: contents:
# SPLIT: DW_TAG_compile_unit
# SPLIT-NEXT: DW_AT_producer [DW_FORM_strx] ( indexed (00000000) string = "Handmade split DWARF producer")
# SPLIT-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "V5_split_compile_unit")
# SPLIT-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
# SPLIT-NEXT: DW_AT_comp_dir [DW_FORM_strx] ( indexed (00000002) string = "/home/test/splitCU")
#
# The type unit
# COMMON: .debug_types contents:
# COMMON: DW_TAG_type_unit
# COMMON-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000000) string = "Type_Unit")
# COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000040)
# COMMON: DW_TAG_structure_type
# COMMON-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "MyStruct")
#
# The split type unit
# SPLIT: .debug_types.dwo contents:
# SPLIT: DW_TAG_type_unit
# SPLIT-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000000) string = "V5_split_type_unit")
# SPLIT-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x0000001c)
# SPLIT: DW_TAG_structure_type
# SPLIT-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "V5_split_Mystruct")
#
# The .debug_str_offsets section
# COMMON: .debug_str_offsets contents:
# COMMON-NEXT: 0x00000000: Contribution size = 28, Version = 5
# COMMON-NEXT: 0x00000008: 00000000 "Handmade DWARF producer"
# COMMON-NEXT: 0x0000000c: 00000018 "Compile_Unit_1"
# COMMON-NEXT: 0x00000010: 00000027 "/home/test/CU1"
# COMMON-NEXT: 0x00000014: 00000067 "MyFunc"
# COMMON-NEXT: 0x00000018: 0000006e "MyVar1"
# COMMON-NEXT: 0x0000001c: 00000075 "MyVar2"
# COMMON-NEXT: 0x00000020: 0000007c "MyVar3"
# COMMON-NEXT: 0x00000024: Contribution size = 12, Version = 5
# COMMON-NEXT: 0x0000002c: 00000000 "Handmade DWARF producer"
# COMMON-NEXT: 0x00000030: 00000036 "Compile_Unit_2"
# COMMON-NEXT: 0x00000034: 00000045 "/home/test/CU2"
# COMMON-NEXT: 0x00000038: Contribution size = 8, Version = 5
# COMMON-NEXT: 0x00000040: 00000054 "Type_Unit"
# COMMON-NEXT: 0x00000044: 0000005e "MyStruct"
#
# SPLIT: .debug_str_offsets.dwo contents:
# SPLIT-NEXT: 0x00000000: Contribution size = 12, Version = 5
# SPLIT-NEXT: 0x00000008: 00000000 "Handmade split DWARF producer"
# SPLIT-NEXT: 0x0000000c: 0000001e "V5_split_compile_unit"
# SPLIT-NEXT: 0x00000010: 00000034 "/home/test/splitCU"
# SPLIT-NEXT: 0x00000014: Contribution size = 8, Version = 5
# SPLIT-NEXT: 0x0000001c: 00000047 "V5_split_type_unit"
# SPLIT-NEXT: 0x00000020: 0000005a "V5_split_Mystruct"

View File

@ -1,56 +0,0 @@
RUN: llvm-dwarfdump -v %p/Inputs/dwarfdump-str-offsets-dwp.x86_64.o | FileCheck %s
; Verify that the correct strings from each unit are displayed and that the
; index for the .debug_str_offsets section has the right values.
; CHECK: Compile Unit
; CHECK-NOT: NULL
; CHECK: DW_TAG_compile_unit
; CHECK-NEXT: DW_AT_producer [DW_FORM_strx] ( indexed (00000000) string = "Handmade DWARF producer")
; CHECK-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "Compile_Unit_1")
; CHECK-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
; CHECK-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000002) string = "/home/test/CU1")
; CHECK-NOT: NULL
; CHECK: Compile Unit
; CHECK-NOT: NULL
; CHECK: DW_TAG_compile_unit
; CHECK-NEXT: DW_AT_producer [DW_FORM_strx] ( indexed (00000000) string = "Handmade DWARF producer")
; CHECK-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "Compile_Unit_2")
; CHECK-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
; CHECK-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000002) string = "/home/test/CU2")
;
; CHECK: Type Unit
; CHECK-NOT: NULL
; CHECK: DW_TAG_type_unit
; CHECK-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000000) string = "Type_Unit_1")
; CHECK-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x0000001c)
; CHECK-NOT: NULL
; CHECK: DW_TAG_structure_type
; CHECK-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "MyStruct_1")
;
; CHECK: Type Unit
; CHECK-NOT: NULL
; CHECK: DW_TAG_type_unit
; CHECK-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000000) string = "Type_Unit_2")
; CHECK-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x0000001c)
; CHECK-NOT: NULL
; CHECK: DW_TAG_structure_type
; CHECK-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "MyStruct_2")
; Verify the correct offets of the compile and type units contributions in the
; index tables.
; CHECK: .debug_cu_index contents:
; CHECK-NOT: contents:
; CHECK: 1 0xddeeaaddbbaabbee [{{0x[0-9a-f]*, 0x[0-9a-f]*}}) [{{0x[0-9a-f]*, 0x[0-9a-f]*}})
; CHECK-SAME: [0x00000000
; CHECK-NEXT: 2 0xff00ffeeffaaff00 [{{0x[0-9a-f]*, 0x[0-9a-f]*}}) [{{0x[0-9a-f]*, 0x[0-9a-f]*}})
; CHECK-SAME: [0x00000024
; CHECK: .debug_tu_index contents:
; CHECK-NOT: contents:
; CHECK: 1 0xeeaaddbbaabbeedd [{{0x[0-9a-f]*, 0x[0-9a-f]*}}) [{{0x[0-9a-f]*, 0x[0-9a-f]*}})
; CHECK-SAME: [0x00000000
; CHECK-NEXT: 2 0x00ffeeffaaff00ff [{{0x[0-9a-f]*, 0x[0-9a-f]*}}) [{{0x[0-9a-f]*, 0x[0-9a-f]*}})
; CHECK: [0x00000024

View File

@ -1,24 +0,0 @@
; Verify that llvm-dwarfdump handles invalid string offset tables.
RUN: llvm-dwarfdump -v %p/Inputs/dwarfdump-str-offsets-invalid-1.x86_64.o | \
RUN: FileCheck --check-prefix=INVALIDCONTRIB %s
RUN: llvm-dwarfdump -v %p/Inputs/dwarfdump-str-offsets-invalid-2.x86_64.o | \
RUN: FileCheck --check-prefix=INVALIDCONTRIB %s
RUN: llvm-dwarfdump -v %p/Inputs/dwarfdump-str-offsets-invalid-3.x86_64.o | \
RUN: FileCheck --check-prefix=INVALIDCONTRIB %s
RUN: llvm-dwarfdump -v %p/Inputs/dwarfdump-str-offsets-invalid-4.x86_64.o | \
RUN: FileCheck --check-prefix=INVALIDLENGTH %s
RUN: llvm-dwarfdump -v %p/Inputs/dwarfdump-str-offsets-invalid-5.x86_64.o | \
RUN: FileCheck --check-prefix=INVALIDSECTIONLENGTH %s
INVALIDCONTRIB: .debug_str_offsets contents:
INVALIDCONTRIB-NOT: contents:
INVALIDCONTRIB: error: invalid contribution to string offsets table in section .debug_str_offsets.
INVALIDLENGTH: .debug_str_offsets contents:
INVALIDLENGTH-NOT: contents:
INVALIDLENGTH: error: contribution to string offsets table in section .debug_str_offsets has invalid length.
INVALIDSECTIONLENGTH: .debug_str_offsets contents:
INVALIDSECTIONLENGTH-NOT: contents:
INVALIDSECTIONLENGTH: error: size of .debug_str_offsets is not a multiple of 4.

View File

@ -1,94 +0,0 @@
RUN: llvm-dwarfdump -v %p/Inputs/dwarfdump-str-offsets.x86_64.o | FileCheck --check-prefix=COMMON \
RUN: --check-prefix=SPLIT %s
RUN: llvm-dwarfdump -v %p/Inputs/dwarfdump-str-offsets-macho.o | FileCheck --check-prefix=COMMON %s
; We are using a hand-constructed object file and are interest in the correct
; diplay of the DW_str_offsetsbase attribute, the correct display of strings
; and the dump of the .debug_str_offsets[.dwo] table.
;
; Abbreviation for DW_AT_str_offsets_base
COMMON: .debug_abbrev contents:
COMMON-NOT: contents:
COMMON: DW_TAG_compile_unit
COMMON-NOT: DW_TAG
COMMON: DW_AT_str_offsets_base DW_FORM_sec_offset
; Verify that strings are displayed correctly as indexed strings
COMMON: .debug_info contents:
COMMON-NOT: contents:
COMMON: DW_TAG_compile_unit
COMMON-NEXT: DW_AT_producer [DW_FORM_strx] ( indexed (00000000) string = "Handmade DWARF producer")
COMMON-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "Compile_Unit_1")
COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
COMMON-NEXT: DW_AT_comp_dir [DW_FORM_strx] ( indexed (00000002) string = "/home/test/CU1")
COMMON-NOT: NULL
COMMON: DW_TAG_subprogram
COMMON-NEXT: DW_AT_name [DW_FORM_strx1] ( indexed (00000003) string = "MyFunc")
COMMON-NOT: NULL
COMMON: DW_TAG_variable
COMMON-NEXT: DW_AT_name [DW_FORM_strx2] ( indexed (00000004) string = "MyVar1")
COMMON-NOT: NULL
COMMON: DW_TAG_variable
COMMON-NEXT: DW_AT_name [DW_FORM_strx3] ( indexed (00000005) string = "MyVar2")
COMMON-NOT: NULL
COMMON: DW_TAG_variable
COMMON-NEXT: DW_AT_name [DW_FORM_strx4] ( indexed (00000006) string = "MyVar3")
; Second compile unit (b.cpp)
COMMON: DW_TAG_compile_unit
COMMON-NEXT: DW_AT_producer [DW_FORM_strx] ( indexed (00000000) string = "Handmade DWARF producer")
COMMON-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "Compile_Unit_2")
COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x0000002c)
COMMON-NEXT: DW_AT_comp_dir [DW_FORM_strx] ( indexed (00000002) string = "/home/test/CU2")
; The split CU
SPLIT: .debug_info.dwo contents:
SPLIT-NOT: contents:
SPLIT: DW_TAG_compile_unit
SPLIT-NEXT: DW_AT_producer [DW_FORM_strx] ( indexed (00000000) string = "Handmade split DWARF producer")
SPLIT-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "V5_split_compile_unit")
SPLIT-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
SPLIT-NEXT: DW_AT_comp_dir [DW_FORM_strx] ( indexed (00000002) string = "/home/test/splitCU")
; The type unit
COMMON: .debug_types contents:
COMMON: DW_TAG_type_unit
COMMON-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000000) string = "Type_Unit")
COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000040)
COMMON: DW_TAG_structure_type
COMMON-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "MyStruct")
; The split type unit
SPLIT: .debug_types.dwo contents:
SPLIT: DW_TAG_type_unit
SPLIT-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000000) string = "V5_split_type_unit")
SPLIT-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x0000001c)
SPLIT: DW_TAG_structure_type
SPLIT-NEXT: DW_AT_name [DW_FORM_strx] ( indexed (00000001) string = "V5_split_Mystruct")
; The .debug_str_offsets section
COMMON: .debug_str_offsets contents:
COMMON-NEXT: 0x00000000: Contribution size = 28, Version = 5
COMMON-NEXT: 0x00000008: 00000000 "Handmade DWARF producer"
COMMON-NEXT: 0x0000000c: 00000018 "Compile_Unit_1"
COMMON-NEXT: 0x00000010: 00000027 "/home/test/CU1"
COMMON-NEXT: 0x00000014: 00000067 "MyFunc"
COMMON-NEXT: 0x00000018: 0000006e "MyVar1"
COMMON-NEXT: 0x0000001c: 00000075 "MyVar2"
COMMON-NEXT: 0x00000020: 0000007c "MyVar3"
COMMON-NEXT: 0x00000024: Contribution size = 12, Version = 5
COMMON-NEXT: 0x0000002c: 00000000 "Handmade DWARF producer"
COMMON-NEXT: 0x00000030: 00000036 "Compile_Unit_2"
COMMON-NEXT: 0x00000034: 00000045 "/home/test/CU2"
COMMON-NEXT: 0x00000038: Contribution size = 8, Version = 5
COMMON-NEXT: 0x00000040: 00000054 "Type_Unit"
COMMON-NEXT: 0x00000044: 0000005e "MyStruct"
SPLIT: .debug_str_offsets.dwo contents:
SPLIT-NEXT: 0x00000000: Contribution size = 12, Version = 5
SPLIT-NEXT: 0x00000008: 00000000 "Handmade split DWARF producer"
SPLIT-NEXT: 0x0000000c: 0000001e "V5_split_compile_unit"
SPLIT-NEXT: 0x00000010: 00000034 "/home/test/splitCU"
SPLIT-NEXT: 0x00000014: Contribution size = 8, Version = 5
SPLIT-NEXT: 0x0000001c: 00000047 "V5_split_type_unit"
SPLIT-NEXT: 0x00000020: 0000005a "V5_split_Mystruct"