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.

llvm-svn: 209554
This commit is contained in:
David Blaikie 2014-05-23 21:11:46 +00:00
parent 71ed20f671
commit 2f75351c02
12 changed files with 73 additions and 58 deletions

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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 }

View File

@ -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)

View File

@ -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]]

View File

@ -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

View File

@ -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 }

View File

@ -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]])

View File

@ -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")}}

View File

@ -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