xref: /llvm-project/llvm/test/MC/MachO/gen-dwarf.s (revision 6aa94c64a532237674433713a70ec2bda57b4fed)
1// RUN: mkdir -p %t0 && cd %t0 && llvm-mc -g -triple i386-apple-darwin10 %s -filetype=obj -o %t
2// RUN: llvm-dwarfdump -all %t | FileCheck %s
3
4.globl _bar
5_bar:
6	movl	$0, %eax
7L1:	leave
8	ret
9_foo:
10_baz:
11	nop
12.data
13_x:	.long 1
14
15// CHECK: file format Mach-O 32-bit i386
16
17// CHECK: .debug_abbrev contents:
18// CHECK: Abbrev table for offset: 0x00000000
19// CHECK: [1] DW_TAG_compile_unit	DW_CHILDREN_yes
20// CHECK: 	DW_AT_stmt_list	DW_FORM_sec_offset
21// CHECK: 	DW_AT_low_pc	DW_FORM_addr
22// CHECK: 	DW_AT_high_pc	DW_FORM_addr
23// CHECK: 	DW_AT_name	DW_FORM_string
24// CHECK: 	DW_AT_comp_dir	DW_FORM_string
25// CHECK: 	DW_AT_producer	DW_FORM_string
26// CHECK: 	DW_AT_language	DW_FORM_data2
27
28// CHECK: [2] DW_TAG_label	DW_CHILDREN_no
29// CHECK: 	DW_AT_name	DW_FORM_string
30// CHECK: 	DW_AT_decl_file	DW_FORM_data4
31// CHECK: 	DW_AT_decl_line	DW_FORM_data4
32// CHECK: 	DW_AT_low_pc	DW_FORM_addr
33
34
35// CHECK: .debug_info contents:
36
37// We don't check the leading addresses these are at.
38// CHECK:  DW_TAG_compile_unit
39// CHECK:    DW_AT_stmt_list (0x00000000)
40// CHECK:    DW_AT_low_pc (0x00000000)
41// CHECK:    DW_AT_high_pc (0x00000008)
42// We don't check the file name as it is a temp directory
43// CHECK:    DW_AT_name
44// We don't check the DW_AT_comp_dir which is the current working directory
45// CHECK:    DW_AT_producer ("llvm-mc (based on {{.*}})")
46// CHECK:    DW_AT_language (DW_LANG_Mips_Assembler)
47
48// CHECK:    DW_TAG_label
49// CHECK:      DW_AT_name ("bar")
50// CHECK:      DW_AT_decl_file ([[FILE:".*gen-dwarf.s"]])
51// CHECK:      DW_AT_decl_line (5)
52// CHECK:      DW_AT_low_pc (0x00000000)
53
54// CHECK:    DW_TAG_label
55// CHECK:      DW_AT_name ("foo")
56// CHECK:      DW_AT_decl_file ([[FILE]])
57// CHECK:      DW_AT_decl_line (9)
58// CHECK:      DW_AT_low_pc (0x00000007)
59
60// CHECK:    DW_TAG_label
61// CHECK:      DW_AT_name ("baz")
62// CHECK:      DW_AT_decl_file ([[FILE]])
63// CHECK:      DW_AT_decl_line (10)
64// CHECK:      DW_AT_low_pc (0x00000007)
65
66// CHECK:    NULL
67
68// CHECK: .debug_aranges contents:
69// CHECK: Address Range Header: length = 0x0000001c, format = DWARF32, version = 0x0002, cu_offset = 0x00000000, addr_size = 0x04, seg_size = 0x00
70
71// CHECK: .debug_line contents:
72// CHECK: Line table prologue:
73// We don't check the total_length as it includes lengths of temp paths
74// CHECK:         version: 4
75// We don't check the prologue_length as it too includes lengths of temp paths
76// CHECK: min_inst_length: 1
77// CHECK: default_is_stmt: 1
78// CHECK:       line_base: -5
79// CHECK:      line_range: 14
80// CHECK:     opcode_base: 13
81// CHECK: standard_opcode_lengths[DW_LNS_copy] = 0
82// CHECK: standard_opcode_lengths[DW_LNS_advance_pc] = 1
83// CHECK: standard_opcode_lengths[DW_LNS_advance_line] = 1
84// CHECK: standard_opcode_lengths[DW_LNS_set_file] = 1
85// CHECK: standard_opcode_lengths[DW_LNS_set_column] = 1
86// CHECK: standard_opcode_lengths[DW_LNS_negate_stmt] = 0
87// CHECK: standard_opcode_lengths[DW_LNS_set_basic_block] = 0
88// CHECK: standard_opcode_lengths[DW_LNS_const_add_pc] = 0
89// CHECK: standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1
90// CHECK: standard_opcode_lengths[DW_LNS_set_prologue_end] = 0
91// CHECK: standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0
92// CHECK: standard_opcode_lengths[DW_LNS_set_isa] = 1
93// We don't check include_directories as it has a temp path
94// CHECK: file_names[  1]:
95// CHECK-NEXT: name: "gen-dwarf.s"
96// CHECK-NEXT: dir_index: 1
97
98// CHECK: Address            Line   Column File   ISA Discriminator OpIndex Flags
99// CHECK: ------------------ ------ ------ ------ --- ------------- ------- -------------
100// CHECK: 0x0000000000000000      6      0      1   0             0       0  is_stmt
101// CHECK: 0x0000000000000005      7      0      1   0             0       0  is_stmt
102// CHECK: 0x0000000000000006      8      0      1   0             0       0  is_stmt
103// CHECK: 0x0000000000000007     11      0      1   0             0       0  is_stmt
104// CHECK: 0x0000000000000008     11      0      1   0             0       0  is_stmt end_sequence
105