The second part of support for generating dwarf for assembly source files. This
[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 %t | FileCheck %s
3
4 .globl _bar
5 _bar:
6         movl    $0, %eax
7 L1:     leave
8         ret
9 _foo:
10         nop
11 .data
12 _x:     .long 1
13
14 // CHECK: file format Mach-O 32-bit i386
15
16 // CHECK: .debug_abbrev contents:
17 // CHECK: Abbrev table for offset: 0x00000000
18 // CHECK: [1] DW_TAG_compile_unit       DW_CHILDREN_yes
19 // CHECK:       DW_AT_stmt_list DW_FORM_data4
20 // CHECK:       DW_AT_low_pc    DW_FORM_addr
21 // CHECK:       DW_AT_high_pc   DW_FORM_addr
22 // CHECK:       DW_AT_name      DW_FORM_string
23 // CHECK:       DW_AT_comp_dir  DW_FORM_string
24 // CHECK:       DW_AT_producer  DW_FORM_string
25 // CHECK:       DW_AT_language  DW_FORM_data2
26
27 // CHECK: [2] DW_TAG_subprogram DW_CHILDREN_yes
28 // CHECK:       DW_AT_name      DW_FORM_string
29 // CHECK:       DW_AT_decl_file DW_FORM_data4
30 // CHECK:       DW_AT_decl_line DW_FORM_data4
31 // CHECK:       DW_AT_low_pc    DW_FORM_addr
32 // CHECK:       DW_AT_high_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 LLVM 3.1svn)")
49 // CHECK:    DW_AT_language [DW_FORM_data2]     (0x8001)
50
51 // CHECK:    DW_TAG_subprogram [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_high_pc [DW_FORM_addr]     (0x0000000000000007)
57 // CHECK:      DW_AT_prototyped [DW_FORM_flag]  (0x00)
58
59 // CHECK:      DW_TAG_unspecified_parameters [3]  
60
61 // CHECK:      NULL
62
63 // CHECK:    DW_TAG_subprogram [2] *
64 // CHECK:      DW_AT_name [DW_FORM_string]      ("foo")
65 // CHECK:      DW_AT_decl_file [DW_FORM_data4]  (0x00000001)
66 // CHECK:      DW_AT_decl_line [DW_FORM_data4]  (0x00000009)
67 // CHECK:      DW_AT_low_pc [DW_FORM_addr]      (0x0000000000000007)
68 // CHECK:      DW_AT_high_pc [DW_FORM_addr]     (0x0000000000000008)
69 // CHECK:      DW_AT_prototyped [DW_FORM_flag]  (0x00)
70
71 // CHECK:      DW_TAG_unspecified_parameters [3]  
72
73 // CHECK:      NULL
74
75 // CHECK:    NULL
76
77 // CHECK: .debug_aranges contents:
78 // CHECK: Address Range Header: length = 0x0000001c, version = 0x0002, cu_offset = 0x00000000, addr_size = 0x04, seg_size = 0x00
79
80 // CHECK: .debug_lines contents:
81 // CHECK: Line table prologue:
82 // We don't check the total_length as it includes lengths of temp paths
83 // CHECK:         version: 2
84 // We don't check the prologue_length as it too includes lengths of temp paths
85 // CHECK: min_inst_length: 1
86 // CHECK: default_is_stmt: 1
87 // CHECK:       line_base: -5
88 // CHECK:      line_range: 14
89 // CHECK:     opcode_base: 13
90 // CHECK: standard_opcode_lengths[DW_LNS_copy] = 0
91 // CHECK: standard_opcode_lengths[DW_LNS_advance_pc] = 1
92 // CHECK: standard_opcode_lengths[DW_LNS_advance_line] = 1
93 // CHECK: standard_opcode_lengths[DW_LNS_set_file] = 1
94 // CHECK: standard_opcode_lengths[DW_LNS_set_column] = 1
95 // CHECK: standard_opcode_lengths[DW_LNS_negate_stmt] = 0
96 // CHECK: standard_opcode_lengths[DW_LNS_set_basic_block] = 0
97 // CHECK: standard_opcode_lengths[DW_LNS_const_add_pc] = 0
98 // CHECK: standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1
99 // CHECK: standard_opcode_lengths[DW_LNS_set_prologue_end] = 0
100 // CHECK: standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0
101 // CHECK: standard_opcode_lengths[DW_LNS_set_isa] = 1
102 // We don't check include_directories as it has a temp path
103 // CHECK:                 Dir  Mod Time   File Len   File Name
104 // CHECK:                 ---- ---------- ---------- ---------------------------
105 // CHECK: file_names[  1]    1 0x00000000 0x00000000 gen-dwarf.s
106
107 // CHECK: Address            Line   Column File   ISA Flags
108 // CHECK: ------------------ ------ ------ ------ --- -------------
109 // CHECK: 0x0000000000000000      6      0      1   0  is_stmt
110 // CHECK: 0x0000000000000005      7      0      1   0  is_stmt
111 // CHECK: 0x0000000000000006      8      0      1   0  is_stmt
112 // CHECK: 0x0000000000000007     10      0      1   0  is_stmt
113 // CHECK: 0x0000000000000008     10      0      1   0  is_stmt end_sequence