1# REQUIRES: x86-registered-target 2 3## Test that the relative names option to llvm-symbolizer works properly. 4## See llvm/docs/CommandGuide/llvm-symbolizer.rst for commands 5## that would produce this test case 6 7# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux -o %t.o 8 9# RUN: llvm-symbolizer 0 --relativenames --obj=%t.o \ 10# RUN: | FileCheck %s -DDIR=%p --check-prefix=RELATIVENAMES 11 12## Sanity check for default. 13# RUN: llvm-symbolizer 0 --obj=%t.o \ 14# RUN: | FileCheck %s -DDIR=%p --check-prefix=ABSOLUTENAMES 15 16## Ensure last option wins. 17# RUN: llvm-symbolizer 0 --basenames --relativenames --obj=%t.o \ 18# RUN: | FileCheck %s -DDIR=%p --check-prefix=RELATIVENAMES 19# RUN: llvm-symbolizer 0 --relativenames --basenames --obj=%t.o \ 20# RUN: | FileCheck %s --check-prefix=BASENAMES 21 22# ABSOLUTENAMES: {{\\|/}}tmp{{\\|/}}foo{{\\|/}}relativenames.s:4 23# RELATIVENAMES: {{^}}foo{{\\|/}}relativenames.s:4 24# BASENAMES: {{^}}relativenames.s:4 25 26## Provide just enough info in debug info for the symbolizer 27## to find the line table. 28.section .debug_abbrev,"",@progbits 29 .byte 0x01 ## Abbreviation Code 30 .byte 0x11 ## DW_TAG_compile_unit 31 .byte 0x01 ## DW_CHILDREN_yes 32 .byte 0x10 ## DW_AT_stmt_list 33 .byte 0x17 ## DW_FORM_sec_offset 34 .byte 0x11 ## DW_AT_low_pc 35 .byte 0x01 ## DW_FORM_addr 36 .byte 0x12 ## DW_AT_high_pc 37 .byte 0x01 ## DW_FORM_addr 38 .byte 0x1b ## DW_AT_comp_dir 39 .byte 0x08 ## DW_FORM_string 40 .byte 0x03 ## DW_AT_name 41 .byte 0x08 ## DW_FORM_string 42 .byte 0x00 ## EOM(1) 43 .byte 0x00 ## EOM(2) 44 .byte 0x02 ## Abbreviation Code 45 .byte 0x2e ## DW_TAG_subprogram 46 .byte 0x0 ## DW_CHILDREN_no 47 .byte 0x11 ## DW_AT_low_pc 48 .byte 0x01 ## DW_FORM_addr 49 .byte 0x12 ## DW_AT_high_pc 50 .byte 0x01 ## DW_FORM_addr 51 .byte 0x00 ## EOM(1) 52 .byte 0x00 ## EOM(2) 53 .byte 0x00 ## EOM(3) 54 55.section .debug_info,"",@progbits 56 .long .Ldebug_info_end-.Ldebug_info_start ## length 57.Ldebug_info_start: 58 .short 0x05 ## version 59 .byte 0x01 ## DW_TAG_compile_unit 60 .byte 0x08 ## address size 61 .long .debug_abbrev ## offset into abbrev section 62 .byte 0x01 ## cu abbrev code 63 .long .debug_line ## DW_AT_stmt_list 64 .quad 0x00 ## DW_AT_low_pc 65 .quad 0x01 ## DW_AT_high_pc 66 .asciz "/tmp" ## DW_AT_comp_dir 67 .asciz "foo/relativenames.s" ## DW_AT_name 68 .byte 0x02 ## subprog abbrev code 69 .quad 0x00 ## DW_AT_low_pc 70 .quad 0x01 ## DW_AT_high_pc 71.Ldebug_info_end: 72 73 74.section .debug_line,"",@progbits 75 .long .Lunit_end - .Lunit_begin ## unit_length 76.Lunit_begin: 77 .short 0x05 ## version 78 .byte 0x08 ## address_size 79 .byte 0x00 ## segment_selector_size 80 .long .Lheader_end - .Lheader_begin ## header_length 81.Lheader_begin: 82 .byte 0x01 ## minimum_instruction_length 83 .byte 0x01 ## maximum_operations_per_instruction 84 .byte 0x01 ## default_is_stmt 85 .byte 0xfb ## line_base 86 .byte 0x0e ## line_range 87 .byte 0x0d ## opcode_base and lengths 88 .byte 0x00, 0x01, 0x01, 0x01, 0x01, 0x00 89 .byte 0x00, 0x00, 0x01, 0x00, 0x00, 0x01 90 .byte 0x01 ## directory entry format count 91 .byte 0x01, 0x8 ## DW_LNCT_path, DW_FORM_string 92 .byte 0x01 ## directories count 93 .asciz "/tmp" ## directory entry 0 94 .byte 0x02 ## file_name_entry_format_count 95 .byte 0x02, 0x0B ## DW_LNCT_directory_index, DW_FORM_data1 96 .byte 0x01, 0x08 ## DW_LNCT_path, DW_FORM_string 97 .byte 0x01 ## filname count 98 .byte 0x00 ## directory index 99 .asciz "foo/relativenames.s" 100.Lheader_end: 101 .byte 0x04, 0x00 ## set file to zero 102 ## set address to 0x0 103 .byte 0x00, 0x09, 0x02, 0x00, 0x00, 0x00, 0x00 104 .byte 0x00, 0x00, 0x00, 0x00 105 .byte 0x15 ## Advance Address by 0 and line by 3 106 .byte 0x02, 0x01 ## Advance PC by 1 107 .byte 0x0, 0x1, 0x1 ## DW_LNE_end_sequence 108.Lunit_end: 109