diff options
Diffstat (limited to 'test/DebugInfo')
| -rwxr-xr-x | test/DebugInfo/Inputs/dwarfdump.elf-mips64-64-bit-dwarf | bin | 0 -> 15638 bytes | |||
| -rw-r--r-- | test/DebugInfo/Inputs/invalid.elf | bin | 0 -> 64 bytes | |||
| -rw-r--r-- | test/DebugInfo/Inputs/invalid.elf.2 | 1 | ||||
| -rw-r--r-- | test/DebugInfo/Inputs/invalid.elf.3 | 1 | ||||
| -rw-r--r-- | test/DebugInfo/Inputs/test-multiple-macho.o | bin | 0 -> 2452 bytes | |||
| -rw-r--r-- | test/DebugInfo/Inputs/test-simple-macho.o | bin | 0 -> 1944 bytes | |||
| -rw-r--r-- | test/DebugInfo/X86/expressions.ll | 110 | ||||
| -rw-r--r-- | test/DebugInfo/X86/inlined-indirect-value.ll | 81 | ||||
| -rw-r--r-- | test/DebugInfo/debuglineinfo-macho.test | 43 | ||||
| -rw-r--r-- | test/DebugInfo/debuglineinfo.test | 3 | ||||
| -rw-r--r-- | test/DebugInfo/dwarfdump-64-bit-dwarf.test | 15 | ||||
| -rw-r--r-- | test/DebugInfo/dwarfdump-invalid.test | 6 |
12 files changed, 257 insertions, 3 deletions
diff --git a/test/DebugInfo/Inputs/dwarfdump.elf-mips64-64-bit-dwarf b/test/DebugInfo/Inputs/dwarfdump.elf-mips64-64-bit-dwarf Binary files differnew file mode 100755 index 0000000000000..5dbfea52212b2 --- /dev/null +++ b/test/DebugInfo/Inputs/dwarfdump.elf-mips64-64-bit-dwarf diff --git a/test/DebugInfo/Inputs/invalid.elf b/test/DebugInfo/Inputs/invalid.elf Binary files differnew file mode 100644 index 0000000000000..23acad80bc968 --- /dev/null +++ b/test/DebugInfo/Inputs/invalid.elf diff --git a/test/DebugInfo/Inputs/invalid.elf.2 b/test/DebugInfo/Inputs/invalid.elf.2 new file mode 100644 index 0000000000000..16528a55a9313 --- /dev/null +++ b/test/DebugInfo/Inputs/invalid.elf.2 @@ -0,0 +1 @@ +ELF'L:þB“ELFï
\ No newline at end of file diff --git a/test/DebugInfo/Inputs/invalid.elf.3 b/test/DebugInfo/Inputs/invalid.elf.3 new file mode 100644 index 0000000000000..f49446000044b --- /dev/null +++ b/test/DebugInfo/Inputs/invalid.elf.3 @@ -0,0 +1 @@ +ELF‚Lþ'ELFB
\ No newline at end of file diff --git a/test/DebugInfo/Inputs/test-multiple-macho.o b/test/DebugInfo/Inputs/test-multiple-macho.o Binary files differnew file mode 100644 index 0000000000000..428a1af6826fb --- /dev/null +++ b/test/DebugInfo/Inputs/test-multiple-macho.o diff --git a/test/DebugInfo/Inputs/test-simple-macho.o b/test/DebugInfo/Inputs/test-simple-macho.o Binary files differnew file mode 100644 index 0000000000000..8ae4154626c36 --- /dev/null +++ b/test/DebugInfo/Inputs/test-simple-macho.o diff --git a/test/DebugInfo/X86/expressions.ll b/test/DebugInfo/X86/expressions.ll new file mode 100644 index 0000000000000..52c1b08f8b071 --- /dev/null +++ b/test/DebugInfo/X86/expressions.ll @@ -0,0 +1,110 @@ +; REQUIRES: object-emission +; RUN: llc -mtriple x86_64-apple-darwin14.0.0-elf -filetype=obj %s -o %t +; RUN: llc -mtriple x86_64-apple-darwin14.0.0-elf -O0 -filetype=obj %s -o %t0 +; RUN: llvm-dwarfdump -debug-dump=loc %t | FileCheck %s +; RUN: llvm-dwarfdump -debug-dump=loc %t0 | FileCheck -check-prefix CHECK-O0 %s + +; CHECK: 0x00000000: Beginning address offset: 0x0000000000000000 +; CHECK: Ending address offset: 0x[[END:[0-9a-f]+]] +; CHECK: Location description: +; CHECK-NOT: 75 00 55 +; CHECK-SAME: 55 +; CHECK: 0x00000023: Beginning address offset: 0x0000000000000000 +; CHECK: Ending address offset: 0x{{.*}}[[END]] +; CHECK: Location description: 75 08 9f +; CHECK: 0x00000048: Beginning address offset: 0x0000000000000000 +; CHECK: Ending address offset: 0x{{.*}}[[END]] +; CHECK: Location description: 75 10 9f +; CHECK: 0x0000006d: Beginning address offset: 0x0000000000000000 +; CHECK: Ending address offset: 0x{{.*}}[[END]] +; CHECK: Location description: 75 18 + + +; CHECK-O0: 0x00000000: Beginning address offset: 0x0000000000000000 +; CHECK-O0: Ending address offset: 0x000000000000001b +; CHECK-O0: Location description: 55 +; CHECK-O0: Beginning address offset: 0x000000000000001b +; CHECK-O0: Ending address offset: 0x0000000000000024 +; CHECK-O0: Location description: 54 +; CHECK-O0: Beginning address offset: 0x0000000000000024 +; CHECK-O0: Ending address offset: 0x0000000000000025 +; CHECK-O0: Location description: 77 78 23 00 +; CHECK-O0: 0x0000004c: Beginning address offset: 0x0000000000000000 +; CHECK-O0: Ending address offset: 0x000000000000001b +; CHECK-O0: Location description: 75 08 9f +; CHECK-O0: Beginning address offset: 0x000000000000001b +; CHECK-O0: Ending address offset: 0x0000000000000024 +; CHECK-O0: Location description: 74 08 9f +; CHECK-O0: Beginning address offset: 0x0000000000000024 +; CHECK-O0: Ending address offset: 0x0000000000000025 +; CHECK-O0: Location description: 77 78 23 08 +; CHECK-O0: 0x0000009c: Beginning address offset: 0x0000000000000000 +; CHECK-O0: Ending address offset: 0x000000000000001b +; CHECK-O0: Location description: 75 10 9f +; CHECK-O0: Beginning address offset: 0x000000000000001b +; CHECK-O0: Ending address offset: 0x0000000000000024 +; CHECK-O0: Location description: 74 10 9f +; CHECK-O0: Beginning address offset: 0x0000000000000024 +; CHECK-O0: Ending address offset: 0x0000000000000025 +; CHECK-O0: Location description: 77 78 23 08 23 08 +; CHECK-O0: 0x000000ee: Beginning address offset: 0x0000000000000000 +; CHECK-O0: Ending address offset: 0x000000000000001b +; CHECK-O0: Location description: 75 18 +; CHECK-O0: Beginning address offset: 0x000000000000001b +; CHECK-O0: Ending address offset: 0x0000000000000024 +; CHECK-O0: Location description: 74 18 +; CHECK-O0: Beginning address offset: 0x0000000000000024 +; CHECK-O0: Ending address offset: 0x0000000000000025 +; CHECK-O0: Location description: 77 78 23 10 23 08 06 + +declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #0 + +define float @foo(float* %args, float *%args2) +{ + call void @llvm.dbg.value(metadata float* %args, i64 0, metadata !11, metadata !12), !dbg !19 + call void @llvm.dbg.value(metadata float* %args, i64 0, metadata !13, metadata !14), !dbg !19 + call void @llvm.dbg.value(metadata float* %args, i64 0, metadata !15, metadata !16), !dbg !19 + call void @llvm.dbg.value(metadata float* %args, i64 0, metadata !17, metadata !18), !dbg !19 + %a = load float, float* %args, !dbg !19 + %bptr = getelementptr float, float* %args, i32 1, !dbg !19 + %b = load float, float* %bptr, !dbg !19 + %cptr = getelementptr float, float* %args, i32 2, !dbg !19 + %c = load float, float* %cptr, !dbg !19 + %dptr = getelementptr float, float* %args, i32 3, !dbg !19 + %d = load float, float* %dptr, !dbg !19 + %ret1 = fadd float %a, %b, !dbg !19 + %ret2 = fadd float %c, %d, !dbg !19 + call void @llvm.dbg.value(metadata float* %args2, i64 0, metadata !11, metadata !12), !dbg !19 + call void @llvm.dbg.value(metadata float* %args2, i64 0, metadata !13, metadata !14), !dbg !19 + call void @llvm.dbg.value(metadata float* %args2, i64 0, metadata !15, metadata !16), !dbg !19 + call void @llvm.dbg.value(metadata float* %args2, i64 0, metadata !17, metadata !18), !dbg !19 + %ret = fsub float %ret1, %ret2, !dbg !19 + ret float %ret, !dbg !19 +} + +attributes #0 = { nounwind readnone } + +!llvm.module.flags = !{!0, !1} +!llvm.dbg.cu = !{!2} + +!0 = !{i32 2, !"Dwarf Version", i32 4} +!1 = !{i32 1, !"Debug Info Version", i32 3} + +!2 = !DICompileUnit(language: DW_LANG_C89, file: !3, producer: "byHand", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !4, retainedTypes: !4, subprograms: !5, globals: !4, imports: !4) +!3 = !DIFile(filename: "expressions", directory: ".") +!4 = !{} +!5 = !{!6} +!6 = !DISubprogram(name: "foo", linkageName: "foo", scope: null, file: !3, type: !7, isLocal: false, isDefinition: true, isOptimized: true, function: float (float*, float*)* @foo, variables: !4) +!7 = !DISubroutineType(types: !8) +!8 = !{!10, !10} +!9 = !DIBasicType(name: "float", size: 4, align: 4, encoding: DW_ATE_float) +!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64, align: 64) +!11 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "a", arg: 1, scope: !6, file: !3, line: 1, type: !10) +!12 = !DIExpression(DW_OP_plus, 0) +!13 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "b", arg: 2, scope: !6, file: !3, line: 1, type: !10) +!14 = !DIExpression(DW_OP_plus, 8) +!15 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "c", arg: 3, scope: !6, file: !3, line: 1, type: !10) +!16 = !DIExpression(DW_OP_plus, 8, DW_OP_plus, 8) +!17 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "d", arg: 4, scope: !6, file: !3, line: 1, type: !9) +!18 = !DIExpression(DW_OP_plus, 16, DW_OP_plus, 8, DW_OP_deref) +!19 = !DILocation(line: 1, scope: !6) diff --git a/test/DebugInfo/X86/inlined-indirect-value.ll b/test/DebugInfo/X86/inlined-indirect-value.ll new file mode 100644 index 0000000000000..7f95691fbb8fd --- /dev/null +++ b/test/DebugInfo/X86/inlined-indirect-value.ll @@ -0,0 +1,81 @@ +; RUN: llc -filetype=asm -asm-verbose=0 < %s | FileCheck %s + +; "1" from line 09 in the snippet below shouldn't be marked with location of "1" +; from line 04. Instead it will have location inside main() (real location is +; just erased, so it won't be perfectly accurate). + +; options: -g -O3 +; 01 volatile int x; +; 02 int y; +; 03 static __attribute__((always_inline)) int f1() { +; 04 if (x * 3 < 14) return 1; +; 05 return 2; +; 06 } +; 07 int main() { +; 08 x = f1(); +; 09 x = x ? 1 : 2; +; 10 } + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@x = common global i32 0, align 4 +@y = common global i32 0, align 4 + +define i32 @main() { +; CHECK: .loc 1 {{[89]}} +; CHECK-NOT: .loc +; CHECK: movl $1 + +entry: + %0 = load volatile i32, i32* @x, align 4, !dbg !16, !tbaa !19 + %mul.i = mul nsw i32 %0, 3, !dbg !23 + %cmp.i = icmp slt i32 %mul.i, 14, !dbg !24 + %..i = select i1 %cmp.i, i32 1, i32 2, !dbg !25 + store volatile i32 %..i, i32* @x, align 4, !dbg !27, !tbaa !19 + %1 = load volatile i32, i32* @x, align 4, !dbg !28, !tbaa !19 + %tobool = icmp ne i32 %1, 0, !dbg !28 + br i1 %tobool, label %select.end, label %select.mid + +select.mid: ; preds = %entry + br label %select.end + +select.end: ; preds = %entry, %select.mid + %cond = phi i32 [ 1, %entry ], [ 2, %select.mid ] + store volatile i32 %cond, i32* @x, align 4, !dbg !29, !tbaa !19 + ret i32 0, !dbg !30 +} + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!13, !14} + +!0 = !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !9, imports: !2) +!1 = !DIFile(filename: "inline-break.c", directory: "/build/dir") +!2 = !{} +!3 = !{!4, !8} +!4 = !DISubprogram(name: "main", scope: !1, file: !1, line: 7, type: !5, isLocal: false, isDefinition: true, scopeLine: 7, isOptimized: true, function: i32 ()* @main, variables: !2) +!5 = !DISubroutineType(types: !6) +!6 = !{!7} +!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) +!8 = !DISubprogram(name: "f1", scope: !1, file: !1, line: 3, type: !5, isLocal: true, isDefinition: true, scopeLine: 3, isOptimized: true, variables: !2) +!9 = !{!10, !12} +!10 = !DIGlobalVariable(name: "x", scope: !0, file: !1, line: 1, type: !11, isLocal: false, isDefinition: true, variable: i32* @x) +!11 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7) +!12 = !DIGlobalVariable(name: "y", scope: !0, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, variable: i32* @y) +!13 = !{i32 2, !"Dwarf Version", i32 4} +!14 = !{i32 2, !"Debug Info Version", i32 3} +!16 = !DILocation(line: 4, column: 9, scope: !17, inlinedAt: !18) +!17 = distinct !DILexicalBlock(scope: !8, file: !1, line: 4, column: 9) +!18 = distinct !DILocation(line: 8, column: 9, scope: !4) +!19 = !{!20, !20, i64 0} +!20 = !{!"int", !21, i64 0} +!21 = !{!"omnipotent char", !22, i64 0} +!22 = !{!"Simple C/C++ TBAA"} +!23 = !DILocation(line: 4, column: 11, scope: !17, inlinedAt: !18) +!24 = !DILocation(line: 4, column: 15, scope: !17, inlinedAt: !18) +!25 = !DILocation(line: 4, column: 21, scope: !26, inlinedAt: !18) +!26 = !DILexicalBlockFile(scope: !17, file: !1, discriminator: 1) +!27 = !DILocation(line: 8, column: 7, scope: !4) +!28 = !DILocation(line: 9, column: 9, scope: !4) +!29 = !DILocation(line: 9, column: 7, scope: !4) +!30 = !DILocation(line: 10, column: 1, scope: !4) diff --git a/test/DebugInfo/debuglineinfo-macho.test b/test/DebugInfo/debuglineinfo-macho.test new file mode 100644 index 0000000000000..0c63dd6e8b0db --- /dev/null +++ b/test/DebugInfo/debuglineinfo-macho.test @@ -0,0 +1,43 @@ +# Check that relocations get applied +RUN: llvm-dwarfdump %p/Inputs/test-simple-macho.o | FileCheck %s +RUN: llvm-dwarfdump %p/Inputs/test-multiple-macho.o | FileCheck %s +RUN: llvm-rtdyld -printline %p/Inputs/test-multiple-macho.o | FileCheck %s +RUN: llvm-rtdyld -printobjline %p/Inputs/test-multiple-macho.o | FileCheck %s + +CHECK-NOT: error: failed to compute relocation: X86_64_RELOC_UNSIGNED + +# Check that relocations get applied correctly +RUN: llvm-rtdyld -printobjline %p/Inputs/test-simple-macho.o \ +RUN: | FileCheck %s -check-prefix TEST_SIMPLE +RUN: llvm-rtdyld -printline %p/Inputs/test-simple-macho.o \ +RUN: | FileCheck %s -check-prefix TEST_SIMPLE +RUN: llvm-rtdyld -printobjline %p/Inputs/test-multiple-macho.o \ +RUN: | FileCheck %s -check-prefix TEST_MULTIPLE +RUN: llvm-rtdyld -printline %p/Inputs/test-multiple-macho.o \ +RUN: | FileCheck %s -check-prefix TEST_MULTIPLE + +TEST_SIMPLE: Function: _foo, Size = 11 +TEST_SIMPLE-NEXT: Line info @ 0: simple.c, line:1 +TEST_SIMPLE-NEXT: Line info @ 7: simple.c, line:2 +TEST_SIMPLE-NOT: Line info @ 11: simple.c, line:2 + +TEST_MULTIPLE: Function: _bar, Size = 48 +TEST_MULTIPLE-NEXT: Line info @ 0: multiple.c, line:5 +TEST_MULTIPLE-NEXT: Line info @ 7: multiple.c, line:6 +TEST_MULTIPLE-NEXT: Line info @ 16: multiple.c, line:9 +TEST_MULTIPLE-NEXT: Line info @ 21: multiple.c, line:9 +TEST_MULTIPLE-NEXT: Line info @ 26: multiple.c, line:7 +TEST_MULTIPLE-NEXT: Line info @ 33: multiple.c, line:10 +TEST_MULTIPLE-NOT: Line info @ 48: multiple.c, line:12 +TEST_MULTIPLE-NEXT: Function: _foo, Size = 16 +TEST_MULTIPLE-NEXT: Line info @ 0: multiple.c, line:1 +TEST_MULTIPLE-NEXT: Line info @ 7: multiple.c, line:2 +TEST_MULTIPLE-NOT: Line info @ 16: multiple.c, line:5 +TEST_MULTIPLE-NEXT: Function: _fubar, Size = 46 +TEST_MULTIPLE-NEXT: Line info @ 0: multiple.c, line:12 +TEST_MULTIPLE-NEXT: Line info @ 7: multiple.c, line:13 +TEST_MULTIPLE-NEXT: Line info @ 12: multiple.c, line:17 +TEST_MULTIPLE-NEXT: Line info @ 25: multiple.c, line:15 +TEST_MULTIPLE-NEXT: Line info @ 34: multiple.c, line:19 +TEST_MULTIPLE-NEXT: Line info @ 41: multiple.c, line:21 +TEST_MULTIPLE-NOT: Line info @ 46: multiple.c, line:21 diff --git a/test/DebugInfo/debuglineinfo.test b/test/DebugInfo/debuglineinfo.test index 96a32285be46b..720ba12ed7614 100644 --- a/test/DebugInfo/debuglineinfo.test +++ b/test/DebugInfo/debuglineinfo.test @@ -18,7 +18,6 @@ TEST_INLINE-NEXT: Line info @ 165: test-inline.cpp, line:35 TEST_INLINE-NEXT: Function: _Z3foov, Size = 3 TEST_INLINE-NEXT: Line info @ 0: test-inline.cpp, line:28 TEST_INLINE-NEXT: Line info @ 2: test-inline.cpp, line:29 -TEST_INLINE-NEXT: Line info @ 3: test-inline.cpp, line:29 TEST_INLINE-NEXT: Function: main, Size = 146 TEST_INLINE-NEXT: Line info @ 0: test-inline.cpp, line:39 TEST_INLINE-NEXT: Line info @ 21: test-inline.cpp, line:41 @@ -29,7 +28,6 @@ TEST_INLINE-NEXT: Line info @ 90: test-inline.cpp, line:45 TEST_INLINE-NEXT: Line info @ 95: test-inline.cpp, line:46 TEST_INLINE-NEXT: Line info @ 114: test-inline.cpp, line:48 TEST_INLINE-NEXT: Line info @ 141: test-inline.cpp, line:49 -TEST_INLINE-NEXT: Line info @ 146: test-inline.cpp, line:49 ; This test checks the case where all code is in a single section. TEST_PARAMETERS: Function: _Z15test_parametersPfPA2_dR11char_structPPitm, Size = 170 @@ -49,5 +47,4 @@ TEST_PARAMETERS-NEXT: Line info @ 90: test-parameters.cpp, line:45 TEST_PARAMETERS-NEXT: Line info @ 95: test-parameters.cpp, line:46 TEST_PARAMETERS-NEXT: Line info @ 114: test-parameters.cpp, line:48 TEST_PARAMETERS-NEXT: Line info @ 141: test-parameters.cpp, line:49 -TEST_PARAMETERS-NEXT: Line info @ 146: test-parameters.cpp, line:49 diff --git a/test/DebugInfo/dwarfdump-64-bit-dwarf.test b/test/DebugInfo/dwarfdump-64-bit-dwarf.test new file mode 100644 index 0000000000000..0a24414c27bba --- /dev/null +++ b/test/DebugInfo/dwarfdump-64-bit-dwarf.test @@ -0,0 +1,15 @@ +RUN: llvm-dwarfdump %p/Inputs/dwarfdump.elf-mips64-64-bit-dwarf \ +RUN: --debug-dump=line | FileCheck %s + +# FIXME: llvm-dwarfdump's support for 64-bit dwarf is currently limited to +# .debug_line. + +CHECK: total_length: 0x00000212 +CHECK: version: 2 +CHECK:prologue_length: 0x000001ab +CHECK:min_inst_length: 1 +CHECK:default_is_stmt: 1 +CHECK: line_base: -5 +CHECK: line_range: 14 +CHECK: opcode_base: 13 +CHECK: is_stmt end_sequence diff --git a/test/DebugInfo/dwarfdump-invalid.test b/test/DebugInfo/dwarfdump-invalid.test new file mode 100644 index 0000000000000..da5b23e30ceb9 --- /dev/null +++ b/test/DebugInfo/dwarfdump-invalid.test @@ -0,0 +1,6 @@ +; Verify that llvm-dwarfdump doesn't crash on broken input files. + +RUN: llvm-dwarfdump %p/Inputs/invalid.elf 2>&1 | FileCheck %s --check-prefix=INVALID-ELF +RUN: llvm-dwarfdump %p/Inputs/invalid.elf.2 2>&1 | FileCheck %s --check-prefix=INVALID-ELF +RUN: llvm-dwarfdump %p/Inputs/invalid.elf.3 2>&1 | FileCheck %s --check-prefix=INVALID-ELF +INVALID-ELF: Invalid data was encountered while parsing the file |
