George Rimar | ca53211 | 2017-04-24 10:19:45 +0000 | [diff] [blame] | 1 | # RUN: llvm-mc -triple x86_64-pc-linux -filetype=obj %s -o %t |
Adrian Prantl | 16aa4cf | 2017-09-11 23:05:20 +0000 | [diff] [blame] | 2 | # RUN: llvm-dwarfdump -v %t | FileCheck %s |
George Rimar | ca53211 | 2017-04-24 10:19:45 +0000 | [diff] [blame] | 3 | |
George Rimar | 6957ab5 | 2017-08-15 12:32:54 +0000 | [diff] [blame] | 4 | # CHECK: .debug_info contents: |
| 5 | # CHECK: DW_TAG_compile_unit |
| 6 | # CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000 |
Jonas Devlieghere | 6f24c87 | 2018-01-16 11:17:57 +0000 | [diff] [blame] | 7 | # CHECK-NEXT: [0x0000000000000000, 0x0000000000000001) ".text.foo1" |
| 8 | # CHECK-NEXT: [0x0000000000000000, 0x0000000000000002) ".text.foo2" [4] |
| 9 | # CHECK-NEXT: [0x0000000000000000, 0x0000000000000003) ".text.foo2" [5]) |
George Rimar | 6957ab5 | 2017-08-15 12:32:54 +0000 | [diff] [blame] | 10 | |
George Rimar | ca53211 | 2017-04-24 10:19:45 +0000 | [diff] [blame] | 11 | # CHECK: .debug_ranges contents: |
Alexander Kornienko | e74e0f1 | 2018-09-17 15:40:01 +0000 | [diff] [blame] | 12 | # CHECK: 00000000 0000000000000000 0000000000000001 |
| 13 | # CHECK: 00000000 0000000000000000 0000000000000002 |
| 14 | # CHECK: 00000000 0000000000000000 0000000000000003 |
| 15 | # CHECK: 00000000 <End of list> |
George Rimar | ca53211 | 2017-04-24 10:19:45 +0000 | [diff] [blame] | 16 | |
Adrian Prantl | 16aa4cf | 2017-09-11 23:05:20 +0000 | [diff] [blame] | 17 | # RUN: llvm-dwarfdump %t | FileCheck %s --check-prefix=BRIEF |
George Rimar | 6957ab5 | 2017-08-15 12:32:54 +0000 | [diff] [blame] | 18 | # BRIEF: DW_TAG_compile_unit |
| 19 | # BRIEF: DW_AT_ranges (0x00000000 |
Jonas Devlieghere | 6f24c87 | 2018-01-16 11:17:57 +0000 | [diff] [blame] | 20 | # BRIEF-NEXT: [0x0000000000000000, 0x0000000000000001) |
| 21 | # BRIEF-NEXT: [0x0000000000000000, 0x0000000000000002) |
| 22 | # BRIEF-NEXT: [0x0000000000000000, 0x0000000000000003)) |
George Rimar | 6957ab5 | 2017-08-15 12:32:54 +0000 | [diff] [blame] | 23 | |
Jonas Devlieghere | 344cac5 | 2018-10-19 17:57:53 +0000 | [diff] [blame] | 24 | # RUN: llvm-dwarfdump -diff %t | FileCheck %s --check-prefix=DIFF |
| 25 | # DIFF: DW_TAG_compile_unit |
| 26 | # DIFF-NEXT: DW_AT_producer () |
| 27 | # DIFF-NEXT: DW_AT_language (DW_LANG_C_plus_plus) |
| 28 | # DIFF-NEXT: DW_AT_name () |
| 29 | # DIFF-NEXT: DW_AT_stmt_list () |
| 30 | # DIFF-NEXT: DW_AT_comp_dir () |
| 31 | # DIFF-NEXT: DW_AT_low_pc () |
| 32 | # DIFF-NEXT: DW_AT_ranges () |
| 33 | |
George Rimar | 6957ab5 | 2017-08-15 12:32:54 +0000 | [diff] [blame] | 34 | ## Asm code for testcase is a reduced and modified output from next |
| 35 | ## invocation and source: |
George Rimar | ca53211 | 2017-04-24 10:19:45 +0000 | [diff] [blame] | 36 | # clang test.cpp -S -o test.s -gmlt -ffunction-sections |
| 37 | # test.cpp: |
Jonas Devlieghere | 6f24c87 | 2018-01-16 11:17:57 +0000 | [diff] [blame] | 38 | # void foo1() { } |
| 39 | # void foo2() { } |
George Rimar | ca53211 | 2017-04-24 10:19:45 +0000 | [diff] [blame] | 40 | |
| 41 | .section .text.foo1,"ax",@progbits |
| 42 | .Lfunc_begin0: |
| 43 | nop |
| 44 | .Lfunc_end0: |
| 45 | |
George Rimar | 6957ab5 | 2017-08-15 12:32:54 +0000 | [diff] [blame] | 46 | .section .text.foo2,"ax",@progbits, unique, 1 |
George Rimar | ca53211 | 2017-04-24 10:19:45 +0000 | [diff] [blame] | 47 | .Lfunc_begin1: |
| 48 | nop |
| 49 | nop |
| 50 | .Lfunc_end1: |
| 51 | |
George Rimar | 6957ab5 | 2017-08-15 12:32:54 +0000 | [diff] [blame] | 52 | .section .text.foo2,"ax",@progbits, unique, 2 |
| 53 | .Lfunc_begin2: |
| 54 | nop |
| 55 | nop |
| 56 | nop |
| 57 | .Lfunc_end2: |
| 58 | |
George Rimar | ca53211 | 2017-04-24 10:19:45 +0000 | [diff] [blame] | 59 | .section .debug_abbrev,"",@progbits |
| 60 | .byte 1 # Abbreviation Code |
| 61 | .byte 17 # DW_TAG_compile_unit |
| 62 | .byte 0 # DW_CHILDREN_no |
| 63 | .byte 37 # DW_AT_producer |
| 64 | .byte 14 # DW_FORM_strp |
| 65 | .byte 19 # DW_AT_language |
| 66 | .byte 5 # DW_FORM_data2 |
| 67 | .byte 3 # DW_AT_name |
| 68 | .byte 14 # DW_FORM_strp |
| 69 | .byte 16 # DW_AT_stmt_list |
| 70 | .byte 23 # DW_FORM_sec_offset |
| 71 | .byte 27 # DW_AT_comp_dir |
| 72 | .byte 14 # DW_FORM_strp |
| 73 | .byte 17 # DW_AT_low_pc |
| 74 | .byte 1 # DW_FORM_addr |
| 75 | .byte 85 # DW_AT_ranges |
| 76 | .byte 23 # DW_FORM_sec_offset |
| 77 | .byte 0 # EOM(1) |
| 78 | .byte 0 # EOM(2) |
| 79 | .byte 0 # EOM(3) |
| 80 | |
| 81 | .section .debug_info,"",@progbits |
| 82 | .Lcu_begin0: |
| 83 | .long 38 # Length of Unit |
| 84 | .short 4 # DWARF version number |
| 85 | .long .debug_abbrev # Offset Into Abbrev. Section |
| 86 | .byte 8 # Address Size (in bytes) |
| 87 | .byte 1 # Abbrev [1] 0xb:0x1f DW_TAG_compile_unit |
| 88 | .long 0 # DW_AT_producer |
| 89 | .short 4 # DW_AT_language |
| 90 | .long 0 # DW_AT_name |
| 91 | .long 0 # DW_AT_stmt_list |
| 92 | .long 0 # DW_AT_comp_dir |
| 93 | .quad 0 # DW_AT_low_pc |
| 94 | .long .Ldebug_ranges0 # DW_AT_ranges |
| 95 | |
| 96 | .section .debug_ranges,"",@progbits |
| 97 | .Ldebug_ranges0: |
| 98 | .quad .Lfunc_begin0 |
| 99 | .quad .Lfunc_end0 |
| 100 | .quad .Lfunc_begin1 |
| 101 | .quad .Lfunc_end1 |
George Rimar | 6957ab5 | 2017-08-15 12:32:54 +0000 | [diff] [blame] | 102 | .quad .Lfunc_begin2 |
| 103 | .quad .Lfunc_end2 |
George Rimar | ca53211 | 2017-04-24 10:19:45 +0000 | [diff] [blame] | 104 | .quad 0 |
| 105 | .quad 0 |