summaryrefslogtreecommitdiff
path: root/test/DebugInfo/X86
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-11-21 23:46:41 +0000
committerEric Christopher <echristo@gmail.com>2013-11-21 23:46:41 +0000
commit2d5d104c5b945a214c117328fd9982360782cef0 (patch)
tree151eb10412ee11909e0814d3edda067454dbae73 /test/DebugInfo/X86
parent46f7257ed1bbd2a169f6c930a805e702407d955b (diff)
downloadllvm-2d5d104c5b945a214c117328fd9982360782cef0.tar.gz
llvm-2d5d104c5b945a214c117328fd9982360782cef0.tar.bz2
llvm-2d5d104c5b945a214c117328fd9982360782cef0.tar.xz
In Dwarf 3 (and Dwarf 2) attributes whose value are offsets into a
section use the form DW_FORM_data4 whilst in Dwarf 4 and later they use the form DW_FORM_sec_offset. This patch updates the places where such attributes are generated to use the appropriate form depending on the Dwarf version. The DIE entries affected have the following tags: DW_AT_stmt_list, DW_AT_ranges, DW_AT_location, DW_AT_GNU_pubnames, DW_AT_GNU_pubtypes, DW_AT_GNU_addr_base, DW_AT_GNU_ranges_base It also adds a hidden command line option "--dwarf-version=<uint>" to llc which allows the version of Dwarf to be generated to override what is specified in the metadata; this makes it possible to update existing tests to check the debugging information generated for both Dwarf 4 (the default) and Dwarf 3 using the same metadata. Patch (slightly modified) by Keith Walker! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195391 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/DebugInfo/X86')
-rw-r--r--test/DebugInfo/X86/DW_AT_stmt_list_sec_offset.ll81
-rw-r--r--test/DebugInfo/X86/block-capture.ll7
-rw-r--r--test/DebugInfo/X86/gnu-public-names.ll80
-rw-r--r--test/DebugInfo/X86/op_deref.ll7
-rw-r--r--test/DebugInfo/X86/stmt-list-multiple-compile-units.ll24
5 files changed, 158 insertions, 41 deletions
diff --git a/test/DebugInfo/X86/DW_AT_stmt_list_sec_offset.ll b/test/DebugInfo/X86/DW_AT_stmt_list_sec_offset.ll
index ccbfcdd881..ec84e87fe0 100644
--- a/test/DebugInfo/X86/DW_AT_stmt_list_sec_offset.ll
+++ b/test/DebugInfo/X86/DW_AT_stmt_list_sec_offset.ll
@@ -1,40 +1,43 @@
-; RUN: llc -mtriple=i686-w64-mingw32 -o %t -filetype=obj %s
-; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s
-
-; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset]
-;
-; generated from:
-; clang -g -S -emit-llvm test.c -o test.ll
-; int main()
-; {
-; return 0;
-; }
-
-; ModuleID = 'test.c'
-target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S32"
-target triple = "i686-pc-win32"
-
-; Function Attrs: nounwind
-define i32 @main() #0 {
-entry:
- %retval = alloca i32, align 4
- store i32 0, i32* %retval
- ret i32 0, !dbg !10
-}
-
-attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
-
-!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!9}
-
-!0 = metadata !{i32 786449, metadata !1, i32 12, metadata !"clang version 3.4 ", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [C:\Projects/test.c] [DW_LANG_C99]
-!1 = metadata !{metadata !"test.c", metadata !"C:\5CProjects"}
-!2 = metadata !{i32 0}
-!3 = metadata !{metadata !4}
-!4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"main", metadata !"main", metadata !"", i32 1, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 false, i32 ()* @main, null, null, metadata !2, i32 2} ; [ DW_TAG_subprogram ] [line 1] [def] [scope 2] [main]
-!5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [C:\Projects/test.c]
+; RUN: llc -mtriple=i686-w64-mingw32 -o %t -filetype=obj %s
+; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s
+; RUN: llc -mtriple=i686-w64-mingw32 -o %t -filetype=obj -dwarf-version=3 %s
+; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s -check-prefix=DWARF3
+
+; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset]
+; DWARF3: DW_AT_stmt_list [DW_FORM_data4]
+;
+; generated from:
+; clang -g -S -emit-llvm test.c -o test.ll
+; int main()
+; {
+; return 0;
+; }
+
+; ModuleID = 'test.c'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S32"
+target triple = "i686-pc-win32"
+
+; Function Attrs: nounwind
+define i32 @main() #0 {
+entry:
+ %retval = alloca i32, align 4
+ store i32 0, i32* %retval
+ ret i32 0, !dbg !10
+}
+
+attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!9}
+
+!0 = metadata !{i32 786449, metadata !1, i32 12, metadata !"clang version 3.4 ", i1 false, metadata !"", i32 0, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [C:\Projects/test.c] [DW_LANG_C99]
+!1 = metadata !{metadata !"test.c", metadata !"C:\5CProjects"}
+!2 = metadata !{i32 0}
+!3 = metadata !{metadata !4}
+!4 = metadata !{i32 786478, metadata !1, metadata !5, metadata !"main", metadata !"main", metadata !"", i32 1, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 false, i32 ()* @main, null, null, metadata !2, i32 2} ; [ DW_TAG_subprogram ] [line 1] [def] [scope 2] [main]
+!5 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [C:\Projects/test.c]
!6 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
-!7 = metadata !{metadata !8}
-!8 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
-!9 = metadata !{i32 2, metadata !"Dwarf Version", i32 3}
-!10 = metadata !{i32 3, i32 0, metadata !4, null}
+!7 = metadata !{metadata !8}
+!8 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
+!9 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
+!10 = metadata !{i32 3, i32 0, metadata !4, null}
diff --git a/test/DebugInfo/X86/block-capture.ll b/test/DebugInfo/X86/block-capture.ll
index 1853607f63..e33f03304d 100644
--- a/test/DebugInfo/X86/block-capture.ll
+++ b/test/DebugInfo/X86/block-capture.ll
@@ -1,5 +1,7 @@
; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
+; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj -dwarf-version=3
+; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s -check-prefix=DWARF3
; Checks that we emit debug info for the block variable declare.
; CHECK: DW_TAG_subprogram [3]
@@ -7,6 +9,11 @@
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[{{.*}}] = "block")
; CHECK: DW_AT_location [DW_FORM_sec_offset] ({{.*}})
+; DWARF3: DW_TAG_subprogram [3]
+; DWARF3: DW_TAG_variable [5]
+; DWARF3: DW_AT_name [DW_FORM_strp] ( .debug_str[{{.*}}] = "block")
+; DWARF3: DW_AT_location [DW_FORM_data4] ({{.*}})
+
%struct.__block_descriptor = type { i64, i64 }
%struct.__block_literal_generic = type { i8*, i32, i32, i8*, %struct.__block_descriptor* }
diff --git a/test/DebugInfo/X86/gnu-public-names.ll b/test/DebugInfo/X86/gnu-public-names.ll
index a9fc0ed48b..e2e2b3ac6b 100644
--- a/test/DebugInfo/X86/gnu-public-names.ll
+++ b/test/DebugInfo/X86/gnu-public-names.ll
@@ -1,5 +1,6 @@
; RUN: llc -mtriple=x86_64-pc-linux-gnu -generate-gnu-dwarf-pub-sections < %s | FileCheck -check-prefix=ASM %s
; RUN: llc -mtriple=x86_64-pc-linux-gnu -generate-gnu-dwarf-pub-sections -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s
+; RUN: llc -mtriple=x86_64-pc-linux-gnu -generate-gnu-dwarf-pub-sections -filetype=obj -dwarf-version=3 < %s | llvm-dwarfdump - | FileCheck %s -check-prefix=DWARF3
; ModuleID = 'dwarf-public-names.cpp'
;
; Generated from:
@@ -123,6 +124,85 @@
; CHECK-DAG: [[D]] EXTERNAL TYPE "ns::D"
; CHECK-DAG: [[INT]] STATIC TYPE "int"
+; DWARF3: .debug_info contents:
+; DWARF3: DW_AT_GNU_pubnames [DW_FORM_data4] (0x00000000)
+; DWARF3: DW_AT_GNU_pubtypes [DW_FORM_data4] (0x00000000)
+
+; DWARF3: [[C:[0-9a-f]+]]: DW_TAG_structure_type
+; DWARF3-NEXT: DW_AT_name {{.*}} "C"
+
+; DWARF3: [[STATIC_MEM_DECL:[0-9a-f]+]]: DW_TAG_member
+; DWARF3-NEXT: DW_AT_name {{.*}} "static_member_variable"
+
+; DWARF3: [[MEM_FUNC_DECL:[0-9a-f]+]]: DW_TAG_subprogram
+; DWARF3-NEXT: DW_AT_MIPS_linkage_name
+; DWARF3-NEXT: DW_AT_name {{.*}} "member_function"
+
+; DWARF3: [[STATIC_MEM_FUNC_DECL:[0-9a-f]+]]: DW_TAG_subprogram
+; DWARF3-NEXT: DW_AT_MIPS_linkage_name
+; DWARF3-NEXT: DW_AT_name {{.*}} "static_member_function"
+
+; DWARF3: [[INT:[0-9a-f]+]]: DW_TAG_base_type
+; DWARF3-NEXT: DW_AT_name {{.*}} "int"
+
+; DWARF3: [[STATIC_MEM_VAR:[0-9a-f]+]]: DW_TAG_variable
+; DWARF3-NEXT: DW_AT_specification {{.*}}[[STATIC_MEM_DECL]]
+
+; DWARF3: [[GLOB_VAR:[0-9a-f]+]]: DW_TAG_variable
+; DWARF3-NEXT: DW_AT_name {{.*}} "global_variable"
+
+; DWARF3: [[NS:[0-9a-f]+]]: DW_TAG_namespace
+; DWARF3-NEXT: DW_AT_name {{.*}} "ns"
+
+; DWARF3: [[GLOB_NS_VAR_DECL:[0-9a-f]+]]: DW_TAG_variable
+; DWARF3-NEXT: DW_AT_name {{.*}} "global_namespace_variable"
+
+; DWARF3: [[D_VAR_DECL:[0-9a-f]+]]: DW_TAG_variable
+; DWARF3-NEXT: DW_AT_name {{.*}} "d"
+
+; DWARF3: [[D:[0-9a-f]+]]: DW_TAG_structure_type
+; 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: [[GLOB_NS_VAR:[0-9a-f]+]]: DW_TAG_variable
+; DWARF3-NEXT: DW_AT_specification {{.*}}[[GLOB_NS_VAR_DECL]]
+
+; DWARF3: [[D_VAR:[0-9a-f]+]]: DW_TAG_variable
+; 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: [[STATIC_MEM_FUNC:[0-9a-f]+]]: DW_TAG_subprogram
+; DWARF3-NEXT: 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-LABEL: .debug_gnu_pubnames contents:
+; DWARF3-NEXT: length = 0x000000e7 version = 0x0002 unit_offset = 0x00000000 unit_size = 0x0000018b
+; DWARF3-NEXT: Offset Linkage Kind Name
+; DWARF3-DAG: [[GLOBAL_FUNC]] EXTERNAL FUNCTION "global_function"
+; DWARF3-DAG: [[NS]] EXTERNAL TYPE "ns"
+; DWARF3-DAG: [[MEM_FUNC]] EXTERNAL FUNCTION "C::member_function"
+; DWARF3-DAG: [[GLOB_VAR]] EXTERNAL VARIABLE "global_variable"
+; DWARF3-DAG: [[GLOB_NS_VAR]] EXTERNAL VARIABLE "ns::global_namespace_variable"
+; DWARF3-DAG: [[GLOB_NS_FUNC]] EXTERNAL FUNCTION "ns::global_namespace_function"
+; DWARF3-DAG: [[D_VAR]] EXTERNAL VARIABLE "ns::d"
+; DWARF3-DAG: [[STATIC_MEM_VAR]] EXTERNAL VARIABLE "C::static_member_variable"
+; DWARF3-DAG: [[STATIC_MEM_FUNC]] EXTERNAL FUNCTION "C::static_member_function"
+
+
+; DWARF3-LABEL: debug_gnu_pubtypes contents:
+; DWARF3: Offset Linkage Kind Name
+; DWARF3-DAG: [[C]] EXTERNAL TYPE "C"
+; DWARF3-DAG: [[D]] EXTERNAL TYPE "ns::D"
+; DWARF3-DAG: [[INT]] STATIC TYPE "int"
+
%struct.C = type { i8 }
%"struct.ns::D" = type { i32 }
diff --git a/test/DebugInfo/X86/op_deref.ll b/test/DebugInfo/X86/op_deref.ll
index 6cb44966d1..c971a39798 100644
--- a/test/DebugInfo/X86/op_deref.ll
+++ b/test/DebugInfo/X86/op_deref.ll
@@ -1,11 +1,18 @@
; RUN: llc -O0 -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s -check-prefix=DW-CHECK
+; RUN: llc -O0 -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj -dwarf-version=3
+; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s -check-prefix=DWARF3
; DW-CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000067] = "vla")
; FIXME: The location here needs to be fixed, but llvm-dwarfdump doesn't handle
; DW_AT_location lists yet.
; DW-CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000000)
+; DWARF3: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000067] = "vla")
+; FIXME: The location here needs to be fixed, but llvm-dwarfdump doesn't handle
+; DW_AT_location lists yet.
+; DWARF3: DW_AT_location [DW_FORM_data4] (0x00000000)
+
; Unfortunately llvm-dwarfdump can't unparse a list of DW_AT_locations
; right now, so we check the asm output:
; RUN: llc -O0 -mtriple=x86_64-apple-darwin %s -o - -filetype=asm | FileCheck %s -check-prefix=ASM-CHECK
diff --git a/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll b/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll
index d43d347958..61cfd52912 100644
--- a/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll
+++ b/test/DebugInfo/X86/stmt-list-multiple-compile-units.ll
@@ -1,16 +1,18 @@
; RUN: llc -O0 %s -mtriple=x86_64-apple-darwin -filetype=obj -o %t
; RUN: llvm-dwarfdump %t | FileCheck %s
+; RUN: llc -O0 %s -mtriple=x86_64-apple-darwin -filetype=obj -o %t -dwarf-version=3
+; RUN: llvm-dwarfdump %t | FileCheck %s -check-prefix=DWARF3
; RUN: llc < %s -O0 -mtriple=x86_64-apple-macosx10.7 | FileCheck %s -check-prefix=ASM
; rdar://13067005
; CHECK: .debug_info contents:
; CHECK: DW_TAG_compile_unit
; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
-; CHECK: DW_AT_stmt_list [DW_FORM_data4] (0x00000000)
+; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
; CHECK: DW_TAG_compile_unit
; CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
-; CHECK: DW_AT_stmt_list [DW_FORM_data4] (0x0000003c)
+; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x0000003c)
; CHECK: .debug_line contents:
; CHECK-NEXT: Line table prologue:
@@ -21,6 +23,24 @@
; CHECK: file_names[ 1] 0 0x00000000 0x00000000 simple2.c
; CHECK-NOT: file_names
+; DWARF3: .debug_info contents:
+; DWARF3: DW_TAG_compile_unit
+; DWARF3: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
+; DWARF3: DW_AT_stmt_list [DW_FORM_data4] (0x00000000)
+
+; DWARF3: DW_TAG_compile_unit
+; DWARF3: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
+; DWARF3: DW_AT_stmt_list [DW_FORM_data4] (0x0000003c)
+
+; DWARF3: .debug_line contents:
+; DWARF3-NEXT: Line table prologue:
+; DWARF3-NEXT: total_length: 0x00000038
+; DWARF3: file_names[ 1] 0 0x00000000 0x00000000 simple.c
+; DWARF3: Line table prologue:
+; DWARF3-NEXT: total_length: 0x00000039
+; DWARF3: file_names[ 1] 0 0x00000000 0x00000000 simple2.c
+; DWARF3-NOT: file_names
+
; PR15408
; ASM: L__DWARF__debug_info_begin0:
; ASM: .long 0 ## DW_AT_stmt_list