109 lines · plain
1# REQUIRES: x86-registered-target2 3## Test that the relative names option to llvm-symbolizer works properly.4## See llvm/docs/CommandGuide/llvm-symbolizer.rst for commands5## that would produce this test case6 7# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux -o %t.o8 9# RUN: llvm-symbolizer 0 --relativenames --obj=%t.o \10# RUN: | FileCheck %s -DDIR=%p --check-prefix=RELATIVENAMES11 12## A basic correctness check for default.13# RUN: llvm-symbolizer 0 --obj=%t.o \14# RUN: | FileCheck %s -DDIR=%p --check-prefix=ABSOLUTENAMES15 16## Ensure last option wins.17# RUN: llvm-symbolizer 0 --basenames --relativenames --obj=%t.o \18# RUN: | FileCheck %s -DDIR=%p --check-prefix=RELATIVENAMES19# RUN: llvm-symbolizer 0 --relativenames --basenames --obj=%t.o \20# RUN: | FileCheck %s --check-prefix=BASENAMES21 22# ABSOLUTENAMES: {{\\|/}}tmp{{\\|/}}foo{{\\|/}}relativenames.s:423# RELATIVENAMES: {{^}}foo{{\\|/}}relativenames.s:424# BASENAMES: {{^}}relativenames.s:425 26## Provide just enough info in debug info for the symbolizer27## to find the line table.28.section .debug_abbrev,"",@progbits29 .byte 0x01 ## Abbreviation Code30 .byte 0x11 ## DW_TAG_compile_unit31 .byte 0x01 ## DW_CHILDREN_yes32 .byte 0x10 ## DW_AT_stmt_list33 .byte 0x17 ## DW_FORM_sec_offset34 .byte 0x11 ## DW_AT_low_pc35 .byte 0x01 ## DW_FORM_addr36 .byte 0x12 ## DW_AT_high_pc37 .byte 0x01 ## DW_FORM_addr38 .byte 0x1b ## DW_AT_comp_dir39 .byte 0x08 ## DW_FORM_string40 .byte 0x03 ## DW_AT_name41 .byte 0x08 ## DW_FORM_string42 .byte 0x00 ## EOM(1)43 .byte 0x00 ## EOM(2)44 .byte 0x02 ## Abbreviation Code45 .byte 0x2e ## DW_TAG_subprogram46 .byte 0x0 ## DW_CHILDREN_no47 .byte 0x11 ## DW_AT_low_pc48 .byte 0x01 ## DW_FORM_addr49 .byte 0x12 ## DW_AT_high_pc50 .byte 0x01 ## DW_FORM_addr51 .byte 0x00 ## EOM(1)52 .byte 0x00 ## EOM(2)53 .byte 0x00 ## EOM(3)54 55.section .debug_info,"",@progbits56 .long .Ldebug_info_end-.Ldebug_info_start ## length57.Ldebug_info_start:58 .short 0x05 ## version59 .byte 0x01 ## DW_TAG_compile_unit60 .byte 0x08 ## address size61 .long .debug_abbrev ## offset into abbrev section62 .byte 0x01 ## cu abbrev code63 .long .debug_line ## DW_AT_stmt_list64 .quad 0x00 ## DW_AT_low_pc65 .quad 0x01 ## DW_AT_high_pc66 .asciz "/tmp" ## DW_AT_comp_dir67 .asciz "foo/relativenames.s" ## DW_AT_name68 .byte 0x02 ## subprog abbrev code69 .quad 0x00 ## DW_AT_low_pc70 .quad 0x01 ## DW_AT_high_pc71.Ldebug_info_end:72 73 74.section .debug_line,"",@progbits75 .long .Lunit_end - .Lunit_begin ## unit_length76.Lunit_begin:77 .short 0x05 ## version78 .byte 0x08 ## address_size79 .byte 0x00 ## segment_selector_size80 .long .Lheader_end - .Lheader_begin ## header_length81.Lheader_begin:82 .byte 0x01 ## minimum_instruction_length83 .byte 0x01 ## maximum_operations_per_instruction84 .byte 0x01 ## default_is_stmt85 .byte 0xfb ## line_base86 .byte 0x0e ## line_range87 .byte 0x0d ## opcode_base and lengths88 .byte 0x00, 0x01, 0x01, 0x01, 0x01, 0x0089 .byte 0x00, 0x00, 0x01, 0x00, 0x00, 0x0190 .byte 0x01 ## directory entry format count91 .byte 0x01, 0x8 ## DW_LNCT_path, DW_FORM_string92 .byte 0x01 ## directories count93 .asciz "/tmp" ## directory entry 094 .byte 0x02 ## file_name_entry_format_count95 .byte 0x02, 0x0B ## DW_LNCT_directory_index, DW_FORM_data196 .byte 0x01, 0x08 ## DW_LNCT_path, DW_FORM_string97 .byte 0x01 ## filname count98 .byte 0x00 ## directory index99 .asciz "foo/relativenames.s"100.Lheader_end:101 .byte 0x04, 0x00 ## set file to zero102 ## set address to 0x0103 .byte 0x00, 0x09, 0x02, 0x00, 0x00, 0x00, 0x00104 .byte 0x00, 0x00, 0x00, 0x00105 .byte 0x15 ## Advance Address by 0 and line by 3106 .byte 0x02, 0x01 ## Advance PC by 1107 .byte 0x0, 0x1, 0x1 ## DW_LNE_end_sequence108.Lunit_end:109