1# REQUIRES: x86-registered-target
2
3# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
4
5# RUN: llvm-symbolizer 0 --obj=%t.o | FileCheck %s --check-prefix=LINKAGE
6# RUN: llvm-symbolizer 0 -f --obj=%t.o | FileCheck %s --check-prefix=LINKAGE
7# RUN: llvm-symbolizer 0 --functions --obj=%t.o | FileCheck %s --check-prefix=LINKAGE
8# RUN: llvm-symbolizer 0 -f=linkage --obj=%t.o | FileCheck %s --check-prefix=LINKAGE
9# RUN: llvm-symbolizer 0 --functions=linkage --obj=%t.o | FileCheck %s --check-prefix=LINKAGE
10# RUN: llvm-symbolizer 0 -f=short --obj=%t.o | FileCheck %s --check-prefix=SHORT
11# RUN: llvm-symbolizer 0 --functions=short --obj=%t.o | FileCheck %s --check-prefix=SHORT
12# RUN: llvm-symbolizer 0 -f=none --obj=%t.o | FileCheck %s --check-prefix=NONE
13# RUN: llvm-symbolizer 0 --functions=none --obj=%t.o | FileCheck %s --check-prefix=NONE
14
15## Characterise behaviour for no '=' sign. llvm-symbolizer treats the next option as an
16## input address, and just prints it.
17# RUN: llvm-symbolizer 0 -f none --obj=%t.o | FileCheck %s --check-prefixes=LINKAGE,ERR
18# RUN: llvm-symbolizer 0 --functions none --obj=%t.o | FileCheck %s --check-prefixes=LINKAGE,ERR
19
20# LINKAGE:      {{^}}foo(int){{$}}
21# LINKAGE-NEXT: functions.cpp:2:0
22
23# SHORT:      {{^}}foo{{$}}
24# SHORT-NEXT: functions.cpp:2:0
25
26# NONE-NOT: foo
27# NONE:     functions.cpp:2:0
28
29# ERR: none
30
31# The assembly below is a stripped down version of the output of:
32#   clang -S -g --target=x86_64-pc-linux
33# for the following C++ source:
34#   void foo(int bar) {}
35  .type _Z3fooi,@function
36_Z3fooi:
37.Lfunc_begin0:
38  .file   1 "/llvm-symbolizer/Inputs" "functions.cpp"
39  .loc    1 2 0                 # functions.cpp:2:0
40  nop
41  .loc  1 2 20 prologue_end     # functions.cpp:2:20
42.Lfunc_end0:
43
44  .section    .debug_str,"MS",@progbits,1
45.Linfo_string1:
46  .asciz  "functions.cpp"
47.Linfo_string2:
48  .asciz  "/llvm-symbolizer/Inputs"
49.Linfo_string3:
50  .asciz  "_Z3fooi"
51.Linfo_string4:
52  .asciz  "foo"
53
54  .section  .debug_abbrev,"",@progbits
55  .byte 1                       # Abbreviation Code
56  .byte 17                      # DW_TAG_compile_unit
57  .byte 1                       # DW_CHILDREN_yes
58  .byte 3                       # DW_AT_name
59  .byte 14                      # DW_FORM_strp
60  .byte 16                      # DW_AT_stmt_list
61  .byte 23                      # DW_FORM_sec_offset
62  .byte 27                      # DW_AT_comp_dir
63  .byte 14                      # DW_FORM_strp
64  .byte 17                      # DW_AT_low_pc
65  .byte 1                       # DW_FORM_addr
66  .byte 18                      # DW_AT_high_pc
67  .byte 6                       # DW_FORM_data4
68  .byte 0                       # EOM(1)
69  .byte 0                       # EOM(2)
70  .byte 2                       # Abbreviation Code
71  .byte 46                      # DW_TAG_subprogram
72  .byte 0                       # DW_CHILDREN_no
73  .byte 17                      # DW_AT_low_pc
74  .byte 1                       # DW_FORM_addr
75  .byte 18                      # DW_AT_high_pc
76  .byte 6                       # DW_FORM_data4
77  .byte 110                     # DW_AT_linkage_name
78  .byte 14                      # DW_FORM_strp
79  .byte 3                       # DW_AT_name
80  .byte 14                      # DW_FORM_strp
81  .byte 58                      # DW_AT_decl_file
82  .byte 11                      # DW_FORM_data1
83  .byte 59                      # DW_AT_decl_line
84  .byte 11                      # DW_FORM_data1
85  .byte 0                       # EOM(1)
86  .byte 0                       # EOM(2)
87  .byte 0                       # EOM(3)
88
89  .section  .debug_info,"",@progbits
90.Lcu_begin0:
91  .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
92.Ldebug_info_start0:
93  .short  4                     # DWARF version number
94  .long .debug_abbrev           # Offset Into Abbrev. Section
95  .byte 8                       # Address Size (in bytes)
96  .byte 1                       # Abbrev [1] 0xb:0x4f DW_TAG_compile_unit
97  .long .Linfo_string1          # DW_AT_name
98  .long .Lline_table_start0     # DW_AT_stmt_list
99  .long .Linfo_string2          # DW_AT_comp_dir
100  .quad .Lfunc_begin0           # DW_AT_low_pc
101  .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
102  .byte 2                       # Abbrev [2] 0x2a:0x28 DW_TAG_subprogram
103  .quad .Lfunc_begin0           # DW_AT_low_pc
104  .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
105  .long .Linfo_string3          # DW_AT_linkage_name
106  .long .Linfo_string4          # DW_AT_name
107  .byte 1                       # DW_AT_decl_file
108  .byte 2                       # DW_AT_decl_line
109  .byte 0                       # End Of Children Mark
110  .byte 0                       # End Of Children Mark
111.Ldebug_info_end0:
112
113  .section  .debug_line,"",@progbits
114.Lline_table_start0:
115