From 1288a3b8e63b7704f7b70ec64fdc3e31d7f09b91 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Fri, 23 May 2014 21:11:46 +0000 Subject: [PATCH] DebugInfo: Generalize some tests to handle variations in attribute ordering. In an effort to fix inlined debug info in situations where the out of line definition of a function preceeds any inlined usage, the order in which some attributes are added to subprogram DIEs may change. (in essence, definition-necessary attributes like DW_AT_low_pc/high_pc will be added immediately, but the names, types, and other features will be delayed to module end where they may either be added to the subprogram DIE or instead reference an abstract definition for those values) These tests can be generalized to be resilient to this change. 5 or so tests actually have to be incompatibly changed to cope with this reordering and will go along with the change that affects the order. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209554 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/DebugInfo/AArch64/variable-loc.ll | 19 ++++------ test/DebugInfo/SystemZ/variable-loc.ll | 23 +++++------- test/DebugInfo/X86/DW_AT_linkage_name.ll | 6 ++-- test/DebugInfo/X86/arguments.ll | 3 +- .../X86/dbg-value-inlined-parameter.ll | 2 +- test/DebugInfo/X86/debug-loc-offset.ll | 4 ++- test/DebugInfo/X86/gnu-public-names.ll | 36 ++++++++++++------- test/DebugInfo/X86/inline-seldag-test.ll | 3 +- test/DebugInfo/X86/pr11300.ll | 3 +- test/DebugInfo/namespace.ll | 18 ++++++---- test/Linker/type-unique-odr-a.ll | 12 ++++--- test/MC/ARM/coff-debugging-secrel.ll | 2 -- 12 files changed, 73 insertions(+), 58 deletions(-) diff --git a/test/DebugInfo/AArch64/variable-loc.ll b/test/DebugInfo/AArch64/variable-loc.ll index f28ee76ebfa..9f432d9f2c0 100644 --- a/test/DebugInfo/AArch64/variable-loc.ll +++ b/test/DebugInfo/AArch64/variable-loc.ll @@ -1,4 +1,6 @@ ; RUN: llc -mtriple=aarch64-none-linux-gnu -disable-fp-elim < %s | FileCheck %s +; RUN: llc -mtriple=aarch64-none-linux-gnu -disable-fp-elim -filetype=obj < %s \ +; RUN: | llvm-dwarfdump -debug-dump=info - | FileCheck --check-prefix=DEBUG %s ; This is a regression test making sure the location of variables is correct in ; debugging information, even if they're addressed via the frame pointer. @@ -23,19 +25,10 @@ ; CHECK: add x29, sp, #416 ; CHECK: add {{x[0-9]+}}, sp, #4 -; CHECK: .Linfo_string7: -; CHECK-NEXT: main_arr - -; Now check the debugging information reflects this: -; CHECK: DW_TAG_variable -; CHECK-NEXT: .word .Linfo_string7 - - ; Rather hard-coded, but 145 => DW_OP_fbreg and the .ascii is LEB128 encoded -412. -; CHECK: DW_AT_location -; CHECK-NEXT: .byte 145 -; CHECK-NEXT: .ascii "\344|" - - +; DEBUG: DW_TAG_variable +; DEBUG-NEXT: DW_AT_name {{.*}} "main_arr" +; Rather hard-coded, but 0x91 => DW_OP_fbreg and 0xe47c is LEB128 encoded -412. +; DEBUG: DW_AT_location {{.*}}(<0x3> 91 e4 7c ) target datalayout = "e-p:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-i128:128:128-f32:32:32-f64:64:64-f128:128:128-n32:64-S128" target triple = "aarch64-none-linux-gnu" diff --git a/test/DebugInfo/SystemZ/variable-loc.ll b/test/DebugInfo/SystemZ/variable-loc.ll index 2d92fd9edcc..e0e4156d395 100644 --- a/test/DebugInfo/SystemZ/variable-loc.ll +++ b/test/DebugInfo/SystemZ/variable-loc.ll @@ -1,4 +1,6 @@ ; RUN: llc -mtriple=s390x-linux-gnu -disable-fp-elim < %s | FileCheck %s +; RUN: llc -mtriple=s390x-linux-gnu -disable-fp-elim -filetype=obj < %s \ +; RUN: | llvm-dwarfdump -debug-dump=info - | FileCheck --check-prefix=DEBUG %s ; ; This is a regression test making sure the location of variables is correct in ; debugging information, even if they're addressed via the frame pointer. @@ -10,20 +12,13 @@ ; CHECK: aghi %r15, -568 ; CHECK: la %r2, 164(%r11) ; CHECK: brasl %r14, populate_array@PLT -; -; CHECK: .Linfo_string7: -; CHECK-NEXT: main_arr -; -; Now check that the debugging information reflects this: -; CHECK: DW_TAG_variable -; CHECK-NEXT: .long .Linfo_string7 -; -; Rather hard-coded, but 145 => DW_OP_fbreg and the .ascii is the sleb128 -; encoding of 164: -; CHECK: DW_AT_location -; CHECK-NEXT: .byte 145 -; CHECK-NEXT: .ascii "\244\001" -; + +; DEBUG: DW_TAG_variable +; DEBUG-NOT: DW_TAG +; DEBUG: DW_AT_name {{.*}} "main_arr" +; Rather hard-coded, but 0x91 => DW_OP_fbreg and 0xa401 is SLEB128 encoded 164. +; DEBUG-NOT: DW_TAG +; DEBUG: DW_AT_location {{.*}}(<0x3> 91 a4 01 ) @.str = private unnamed_addr constant [13 x i8] c"Total is %d\0A\00", align 2 diff --git a/test/DebugInfo/X86/DW_AT_linkage_name.ll b/test/DebugInfo/X86/DW_AT_linkage_name.ll index 76d3abbe358..dce234aa900 100644 --- a/test/DebugInfo/X86/DW_AT_linkage_name.ll +++ b/test/DebugInfo/X86/DW_AT_linkage_name.ll @@ -22,8 +22,10 @@ ; CHECK: DW_AT_name {{.*}} "~A" ; CHECK-NOT: DW_AT_MIPS_linkage_name ; CHECK: DW_TAG_subprogram -; CHECK-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1AD2Ev" -; CHECK-NEXT: DW_AT_specification {{.*}}[[A_DTOR]] +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN1AD2Ev" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_specification {{.*}}[[A_DTOR]] target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" diff --git a/test/DebugInfo/X86/arguments.ll b/test/DebugInfo/X86/arguments.ll index 67352845571..3597b2ca1dc 100644 --- a/test/DebugInfo/X86/arguments.ll +++ b/test/DebugInfo/X86/arguments.ll @@ -15,7 +15,8 @@ ; CHECK: debug_info contents ; CHECK: DW_TAG_subprogram -; CHECK-NEXT: DW_AT_MIPS_linkage_name{{.*}}"_Z4func3fooS_" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_MIPS_linkage_name{{.*}}"_Z4func3fooS_" ; CHECK-NOT: NULL ; CHECK: DW_TAG_formal_parameter ; CHECK-NEXT: DW_AT_name{{.*}}"f" diff --git a/test/DebugInfo/X86/dbg-value-inlined-parameter.ll b/test/DebugInfo/X86/dbg-value-inlined-parameter.ll index 3db67ffdc7a..45281c92953 100644 --- a/test/DebugInfo/X86/dbg-value-inlined-parameter.ll +++ b/test/DebugInfo/X86/dbg-value-inlined-parameter.ll @@ -16,7 +16,7 @@ ;FIXME: Linux shouldn't drop this parameter either... ;LINUX-NOT: DW_TAG_formal_parameter ;DARWIN: DW_TAG_formal_parameter -;DARWIN-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000055] = "sp") +;DARWIN-NEXT: DW_AT_name {{.*}} "sp" %struct.S1 = type { float*, i32 } diff --git a/test/DebugInfo/X86/debug-loc-offset.ll b/test/DebugInfo/X86/debug-loc-offset.ll index b10309c85f8..3f4d39da762 100644 --- a/test/DebugInfo/X86/debug-loc-offset.ll +++ b/test/DebugInfo/X86/debug-loc-offset.ll @@ -37,7 +37,9 @@ ; CHECK: DW_AT_high_pc ; CHECK: DW_TAG_subprogram -; CHECK-NEXT: DW_AT_MIPS_linkage_name [DW_FORM_strp]{{.*}}"_Z1a1A" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_MIPS_linkage_name [DW_FORM_strp]{{.*}}"_Z1a1A" +; CHECK-NOT: {{DW_TAG|NULL}} ; CHECK: DW_TAG_formal_parameter ; CHECK-NEXT: DW_AT_name [DW_FORM_strp]{{.*}}"var" ; CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000000) diff --git a/test/DebugInfo/X86/gnu-public-names.ll b/test/DebugInfo/X86/gnu-public-names.ll index f4001e3af92..4e35dbe2b50 100644 --- a/test/DebugInfo/X86/gnu-public-names.ll +++ b/test/DebugInfo/X86/gnu-public-names.ll @@ -86,8 +86,10 @@ ; CHECK-NEXT: DW_AT_name {{.*}} "D" ; CHECK: [[GLOB_NS_FUNC:[0-9a-f]+]]: DW_TAG_subprogram -; CHECK-NEXT: DW_AT_MIPS_linkage_name -; CHECK-NEXT: DW_AT_name {{.*}} "global_namespace_function" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_MIPS_linkage_name +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_name {{.*}} "global_namespace_function" ; CHECK: [[GLOB_NS_VAR:[0-9a-f]+]]: DW_TAG_variable ; CHECK-NEXT: DW_AT_specification {{.*}}[[GLOB_NS_VAR_DECL]] @@ -96,14 +98,18 @@ ; CHECK-NEXT: DW_AT_specification {{.*}}[[D_VAR_DECL]] ; CHECK: [[MEM_FUNC:[0-9a-f]+]]: DW_TAG_subprogram -; CHECK-NEXT: DW_AT_specification {{.*}}[[MEM_FUNC_DECL]] +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_specification {{.*}}[[MEM_FUNC_DECL]] ; CHECK: [[STATIC_MEM_FUNC:[0-9a-f]+]]: DW_TAG_subprogram -; CHECK-NEXT: DW_AT_specification {{.*}}[[STATIC_MEM_FUNC_DECL]] +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_specification {{.*}}[[STATIC_MEM_FUNC_DECL]] ; CHECK: [[GLOBAL_FUNC:[0-9a-f]+]]: DW_TAG_subprogram -; CHECK-NEXT: DW_AT_MIPS_linkage_name -; CHECK-NEXT: DW_AT_name {{.*}} "global_function" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_MIPS_linkage_name +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_name {{.*}} "global_function" ; CHECK-LABEL: .debug_gnu_pubnames contents: ; CHECK-NEXT: length = 0x000000e7 version = 0x0002 unit_offset = 0x00000000 unit_size = [[UNIT_SIZE]] @@ -166,8 +172,10 @@ ; DWARF3-NEXT: DW_AT_name {{.*}} "D" ; DWARF3: [[GLOB_NS_FUNC:[0-9a-f]+]]: DW_TAG_subprogram -; DWARF3-NEXT: DW_AT_MIPS_linkage_name -; DWARF3-NEXT: DW_AT_name {{.*}} "global_namespace_function" +; DWARF3-NOT: DW_TAG +; DWARF3: DW_AT_MIPS_linkage_name +; DWARF3-NOT: DW_TAG +; DWARF3: DW_AT_name {{.*}} "global_namespace_function" ; DWARF3: [[GLOB_NS_VAR:[0-9a-f]+]]: DW_TAG_variable ; DWARF3-NEXT: DW_AT_specification {{.*}}[[GLOB_NS_VAR_DECL]] @@ -176,14 +184,18 @@ ; DWARF3-NEXT: DW_AT_specification {{.*}}[[D_VAR_DECL]] ; DWARF3: [[MEM_FUNC:[0-9a-f]+]]: DW_TAG_subprogram -; DWARF3-NEXT: DW_AT_specification {{.*}}[[MEM_FUNC_DECL]] +; DWARF3-NOT: DW_TAG +; DWARF3: DW_AT_specification {{.*}}[[MEM_FUNC_DECL]] ; DWARF3: [[STATIC_MEM_FUNC:[0-9a-f]+]]: DW_TAG_subprogram -; DWARF3-NEXT: DW_AT_specification {{.*}}[[STATIC_MEM_FUNC_DECL]] +; DWARF3-NOT: DW_TAG +; DWARF3: DW_AT_specification {{.*}}[[STATIC_MEM_FUNC_DECL]] ; DWARF3: [[GLOBAL_FUNC:[0-9a-f]+]]: DW_TAG_subprogram -; DWARF3-NEXT: DW_AT_MIPS_linkage_name -; DWARF3-NEXT: DW_AT_name {{.*}} "global_function" +; DWARF3-NOT: DW_TAG +; DWARF3: DW_AT_MIPS_linkage_name +; DWARF3-NOT: DW_TAG +; DWARF3: DW_AT_name {{.*}} "global_function" ; DWARF3-LABEL: .debug_gnu_pubnames contents: ; DWARF3-NEXT: length = 0x000000e7 version = 0x0002 unit_offset = 0x00000000 unit_size = [[UNIT_SIZE]] diff --git a/test/DebugInfo/X86/inline-seldag-test.ll b/test/DebugInfo/X86/inline-seldag-test.ll index 83c61c4fc62..f139140ee75 100644 --- a/test/DebugInfo/X86/inline-seldag-test.ll +++ b/test/DebugInfo/X86/inline-seldag-test.ll @@ -14,7 +14,8 @@ ; CHECK: DW_TAG_inlined_subroutine ; CHECK-NEXT: DW_AT_abstract_origin {{.*}} {[[F:0x.*]]} ; CHECK: [[F]]: DW_TAG_subprogram -; CHECK-NEXT: DW_AT_name {{.*}} "f" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_name {{.*}} "f" ; Make sure the condition test is attributed to the inline function, not the diff --git a/test/DebugInfo/X86/pr11300.ll b/test/DebugInfo/X86/pr11300.ll index b3c911252d8..11c409c1604 100644 --- a/test/DebugInfo/X86/pr11300.ll +++ b/test/DebugInfo/X86/pr11300.ll @@ -9,7 +9,8 @@ ; CHECK: [[BAR_DECL:0x[0-9a-f]*]]: DW_TAG_subprogram ; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN3foo3barEv" ; CHECK: DW_TAG_subprogram -; CHECK-NEXT: DW_AT_specification {{.*}} {[[BAR_DECL]]} +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_specification {{.*}} {[[BAR_DECL]]} %struct.foo = type { i8 } diff --git a/test/DebugInfo/namespace.ll b/test/DebugInfo/namespace.ll index 6af3dc3ddd9..ca5cf808d18 100644 --- a/test/DebugInfo/namespace.ll +++ b/test/DebugInfo/namespace.ll @@ -17,11 +17,15 @@ ; CHECK-NEXT: DW_AT_name{{.*}}= "i" ; CHECK-NOT: NULL ; CHECK: DW_TAG_subprogram -; CHECK-NEXT: DW_AT_MIPS_linkage_name -; CHECK-NEXT: DW_AT_name{{.*}}= "f1" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_MIPS_linkage_name +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_name{{.*}}= "f1" ; CHECK: [[FUNC1:0x[0-9a-f]*]]:{{ *}}DW_TAG_subprogram -; CHECK-NEXT: DW_AT_MIPS_linkage_name -; CHECK-NEXT: DW_AT_name{{.*}}= "f1" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_MIPS_linkage_name +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_name{{.*}}= "f1" ; CHECK: NULL ; CHECK-NOT: NULL ; CHECK: [[FOO:0x[0-9a-f]*]]:{{ *}}DW_TAG_structure_type @@ -45,8 +49,10 @@ ; CHECK-NOT: NULL ; CHECK: DW_TAG_subprogram -; CHECK-NEXT: DW_AT_MIPS_linkage_name -; CHECK-NEXT: DW_AT_name{{.*}}= "func" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_MIPS_linkage_name +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_name{{.*}}= "func" ; CHECK-NOT: NULL ; CHECK: DW_TAG_imported_module ; CHECK-NEXT: DW_AT_decl_file{{.*}}(0x0[[F2]]) diff --git a/test/Linker/type-unique-odr-a.ll b/test/Linker/type-unique-odr-a.ll index a1b8d28e645..54befb75ba4 100644 --- a/test/Linker/type-unique-odr-a.ll +++ b/test/Linker/type-unique-odr-a.ll @@ -23,9 +23,11 @@ ; } ; ; CHECK: DW_TAG_subprogram -; CHECK-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_Z3bazv" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_Z3bazv" ; CHECK: DW_TAG_subprogram -; CHECK-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZL3barv" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZL3barv" ; CHECK: DW_TAG_class_type ; CHECK-NEXT: DW_AT_name {{.*}} "A" ; CHECK-NOT: DW_TAG @@ -33,8 +35,10 @@ ; CHECK-NEXT: DW_AT_name {{.*}} "data" ; CHECK-NOT: DW_TAG ; CHECK: DW_TAG_subprogram -; CHECK-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZN1A6getFooEv" -; CHECK-NEXT: DW_AT_name {{.*}} "getFoo" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN1A6getFooEv" +; CHECK-NOT: DW_TAG +; CHECK: DW_AT_name {{.*}} "getFoo" ; getFoo and A may only appear once. ; CHECK-NOT: {{(getFoo)|("A")}} diff --git a/test/MC/ARM/coff-debugging-secrel.ll b/test/MC/ARM/coff-debugging-secrel.ll index a6c52db4ada..f37b19e6a70 100644 --- a/test/MC/ARM/coff-debugging-secrel.ll +++ b/test/MC/ARM/coff-debugging-secrel.ll @@ -34,8 +34,6 @@ entry: ; CHECK-ITANIUM: 0xC IMAGE_REL_ARM_SECREL .debug_str ; CHECK-ITANIUM: 0x12 IMAGE_REL_ARM_SECREL .debug_str ; CHECK-ITANIUM: 0x16 IMAGE_REL_ARM_SECREL .debug_line -; CHECK-ITANIUM: 0x1A IMAGE_REL_ARM_SECREL .debug_str -; CHECK-ITANIUM: 0x27 IMAGE_REL_ARM_SECREL .debug_str ; CHECK-ITANIUM: } ; CHECK-ITANIUM: Section {{.*}}.debug_pubnames { ; CHECK-ITANIUM: 0x6 IMAGE_REL_ARM_SECREL .debug_info -- 2.34.1