blob: d779dac1a41f069d31eb2260653128c9e43e5d2d [file] [log] [blame]
George Rimarca532112017-04-24 10:19:45 +00001# RUN: llvm-mc -triple x86_64-pc-linux -filetype=obj %s -o %t
Adrian Prantl16aa4cf2017-09-11 23:05:20 +00002# RUN: llvm-dwarfdump -v %t | FileCheck %s
George Rimarca532112017-04-24 10:19:45 +00003
George Rimar6957ab52017-08-15 12:32:54 +00004# CHECK: .debug_info contents:
5# CHECK: DW_TAG_compile_unit
6# CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000
Jonas Devlieghere6f24c872018-01-16 11:17:57 +00007# CHECK-NEXT: [0x0000000000000000, 0x0000000000000001) ".text.foo1"
8# CHECK-NEXT: [0x0000000000000000, 0x0000000000000002) ".text.foo2" [4]
9# CHECK-NEXT: [0x0000000000000000, 0x0000000000000003) ".text.foo2" [5])
George Rimar6957ab52017-08-15 12:32:54 +000010
George Rimarca532112017-04-24 10:19:45 +000011# CHECK: .debug_ranges contents:
Alexander Kornienkoe74e0f12018-09-17 15:40:01 +000012# CHECK: 00000000 0000000000000000 0000000000000001
13# CHECK: 00000000 0000000000000000 0000000000000002
14# CHECK: 00000000 0000000000000000 0000000000000003
15# CHECK: 00000000 <End of list>
George Rimarca532112017-04-24 10:19:45 +000016
Adrian Prantl16aa4cf2017-09-11 23:05:20 +000017# RUN: llvm-dwarfdump %t | FileCheck %s --check-prefix=BRIEF
George Rimar6957ab52017-08-15 12:32:54 +000018# BRIEF: DW_TAG_compile_unit
19# BRIEF: DW_AT_ranges (0x00000000
Jonas Devlieghere6f24c872018-01-16 11:17:57 +000020# BRIEF-NEXT: [0x0000000000000000, 0x0000000000000001)
21# BRIEF-NEXT: [0x0000000000000000, 0x0000000000000002)
22# BRIEF-NEXT: [0x0000000000000000, 0x0000000000000003))
George Rimar6957ab52017-08-15 12:32:54 +000023
Jonas Devlieghere344cac52018-10-19 17:57:53 +000024# 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 Rimar6957ab52017-08-15 12:32:54 +000034## Asm code for testcase is a reduced and modified output from next
35## invocation and source:
George Rimarca532112017-04-24 10:19:45 +000036# clang test.cpp -S -o test.s -gmlt -ffunction-sections
37# test.cpp:
Jonas Devlieghere6f24c872018-01-16 11:17:57 +000038# void foo1() { }
39# void foo2() { }
George Rimarca532112017-04-24 10:19:45 +000040
41.section .text.foo1,"ax",@progbits
42.Lfunc_begin0:
43 nop
44.Lfunc_end0:
45
George Rimar6957ab52017-08-15 12:32:54 +000046.section .text.foo2,"ax",@progbits, unique, 1
George Rimarca532112017-04-24 10:19:45 +000047.Lfunc_begin1:
48 nop
49 nop
50.Lfunc_end1:
51
George Rimar6957ab52017-08-15 12:32:54 +000052.section .text.foo2,"ax",@progbits, unique, 2
53.Lfunc_begin2:
54 nop
55 nop
56 nop
57.Lfunc_end2:
58
George Rimarca532112017-04-24 10:19:45 +000059.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 Rimar6957ab52017-08-15 12:32:54 +0000102.quad .Lfunc_begin2
103.quad .Lfunc_end2
George Rimarca532112017-04-24 10:19:45 +0000104.quad 0
105.quad 0