997c83498ef1ec85831bab3f2464f8cea5338d46
[oota-llvm.git] / test / MC / MachO / gen-dwarf.s
1 // RUN: llvm-mc -g -triple i386-apple-darwin10 %s -filetype=obj -o %t
2 // RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s
3
4 .globl _bar
5 _bar:
6         movl    $0, %eax
7 L1:     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_data4
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_yes
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 // CHECK:       DW_AT_prototyped        DW_FORM_flag
34
35 // CHECK: [3] DW_TAG_unspecified_parameters     DW_CHILDREN_no
36
37
38 // CHECK: .debug_info contents:
39
40 // We don't check the leading addresses these are at.
41 // CHECK:  DW_TAG_compile_unit [1] *
42 // CHECK:    DW_AT_stmt_list [DW_FORM_data4]    (0x00000000)
43 // CHECK:    DW_AT_low_pc [DW_FORM_addr]        (0x0000000000000000)
44 // CHECK:    DW_AT_high_pc [DW_FORM_addr]       (0x0000000000000008)
45 // We don't check the file name as it is a temp directory
46 // CHECK:    DW_AT_name [DW_FORM_string]
47 // We don't check the DW_AT_comp_dir which is the current working directory
48 // CHECK:    DW_AT_producer [DW_FORM_string]    ("llvm-mc (based on {{.*}})")
49 // CHECK:    DW_AT_language [DW_FORM_data2]     (0x8001)
50
51 // CHECK:    DW_TAG_label [2] *
52 // CHECK:      DW_AT_name [DW_FORM_string]      ("bar")
53 // CHECK:      DW_AT_decl_file [DW_FORM_data4]  (0x00000001)
54 // CHECK:      DW_AT_decl_line [DW_FORM_data4]  (0x00000005)
55 // CHECK:      DW_AT_low_pc [DW_FORM_addr]      (0x0000000000000000)
56 // CHECK:      DW_AT_prototyped [DW_FORM_flag]  (0x00)
57
58 // CHECK:      DW_TAG_unspecified_parameters [3]  
59
60 // CHECK:      NULL
61
62 // CHECK:    DW_TAG_label [2] *
63 // CHECK:      DW_AT_name [DW_FORM_string]      ("foo")
64 // CHECK:      DW_AT_decl_file [DW_FORM_data4]  (0x00000001)
65 // CHECK:      DW_AT_decl_line [DW_FORM_data4]  (0x00000009)
66 // CHECK:      DW_AT_low_pc [DW_FORM_addr]      (0x0000000000000007)
67 // CHECK:      DW_AT_prototyped [DW_FORM_flag]  (0x00)
68
69 // CHECK:      DW_TAG_unspecified_parameters [3]  
70
71 // CHECK:      NULL
72
73 // CHECK:    DW_TAG_label [2] *
74 // CHECK:      DW_AT_name [DW_FORM_string]      ("baz")
75 // CHECK:      DW_AT_decl_file [DW_FORM_data4]  (0x00000001)
76 // CHECK:      DW_AT_decl_line [DW_FORM_data4]  (0x0000000a)
77 // CHECK:      DW_AT_low_pc [DW_FORM_addr]      (0x0000000000000007)
78 // CHECK:      DW_AT_prototyped [DW_FORM_flag]  (0x00)
79
80 // CHECK:      DW_TAG_unspecified_parameters [3]  
81
82 // CHECK:      NULL
83
84 // CHECK:    NULL
85
86 // CHECK: .debug_aranges contents:
87 // CHECK: Address Range Header: length = 0x0000001c, version = 0x0002, cu_offset = 0x00000000, addr_size = 0x04, seg_size = 0x00
88
89 // CHECK: .debug_line contents:
90 // CHECK: Line table prologue:
91 // We don't check the total_length as it includes lengths of temp paths
92 // CHECK:         version: 2
93 // We don't check the prologue_length as it too includes lengths of temp paths
94 // CHECK: min_inst_length: 1
95 // CHECK: default_is_stmt: 1
96 // CHECK:       line_base: -5
97 // CHECK:      line_range: 14
98 // CHECK:     opcode_base: 13
99 // CHECK: standard_opcode_lengths[DW_LNS_copy] = 0
100 // CHECK: standard_opcode_lengths[DW_LNS_advance_pc] = 1
101 // CHECK: standard_opcode_lengths[DW_LNS_advance_line] = 1
102 // CHECK: standard_opcode_lengths[DW_LNS_set_file] = 1
103 // CHECK: standard_opcode_lengths[DW_LNS_set_column] = 1
104 // CHECK: standard_opcode_lengths[DW_LNS_negate_stmt] = 0
105 // CHECK: standard_opcode_lengths[DW_LNS_set_basic_block] = 0
106 // CHECK: standard_opcode_lengths[DW_LNS_const_add_pc] = 0
107 // CHECK: standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1
108 // CHECK: standard_opcode_lengths[DW_LNS_set_prologue_end] = 0
109 // CHECK: standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0
110 // CHECK: standard_opcode_lengths[DW_LNS_set_isa] = 1
111 // We don't check include_directories as it has a temp path
112 // CHECK:                 Dir  Mod Time   File Len   File Name
113 // CHECK:                 ---- ---------- ---------- ---------------------------
114 // CHECK: file_names[  1]    1 0x00000000 0x00000000 gen-dwarf.s
115
116 // CHECK: Address            Line   Column File   ISA Discriminator Flags
117 // CHECK: ------------------ ------ ------ ------ --- ------------- -------------
118 // CHECK: 0x0000000000000000      6      0      1   0             0  is_stmt
119 // CHECK: 0x0000000000000005      7      0      1   0             0  is_stmt
120 // CHECK: 0x0000000000000006      8      0      1   0             0  is_stmt
121 // CHECK: 0x0000000000000007     11      0      1   0             0  is_stmt
122 // CHECK: 0x0000000000000008     11      0      1   0             0  is_stmt end_sequence