332 lines · plain
1# REQUIRES: system-linux2 3# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-dwarf4-monolithic-main.s -o %tmain.o4# RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-dwarf4-monolithic-helper0.s -o %t0.o5# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-dwarf4-monolithic-helper1.s -o %t1.o6# RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-dwarf4-monolithic-helper2.s -o %t2.o7# RUN: %clang %cflags -dwarf-5 %tmain.o %t0.o %t1.o %t2.o -o %t.exe -Wl,-q8# RUN: llvm-bolt --always-convert-to-ranges %t.exe -o %t.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=49# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe | FileCheck --check-prefix=PRECHECK %s10# RUN: llvm-dwarfdump --show-form --verbose --debug-line %t.exe > %t_line.txt11# RUN: llvm-dwarfdump --show-form --verbose --debug-addr %t.bolt > %t.txt12# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt >> %t.txt13# RUN: cat %t.txt | FileCheck --check-prefix=POSTCHECK %s14# RUN: llvm-dwarfdump --show-form --verbose --debug-line %t.bolt >> %t_line.txt15# RUN: FileCheck --check-prefix=CHECK-LINE %s --input-file %t_line.txt16 17 18## Check BOLT handles monolithic mix of DWARF4 and DWARF5.19 20# main.cpp21# PRECHECK: version = 0x000522# PRECHECK: DW_TAG_compile_unit [1] *23# PRECHECK-NEXT: DW_AT_producer [DW_FORM_strx1] (indexed (00000000)24# PRECHECK-NEXT: DW_AT_language25# PRECHECK-NEXT: DW_AT_name26# PRECHECK-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)27# PRECHECK-NEXT: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)28# PRECHECK-NEXT: DW_AT_comp_dir29# PRECHECK-NEXT: DW_AT_low_pc30# PRECHECK: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x1)31# PRECHECK-NEXT: [0x32# PRECHECK-NEXT: [0x33# PRECHECK-NEXT: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)34# PRECHECK-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x0000000c)35# PRECHECK-NEXT: DW_AT_loclists_base [DW_FORM_sec_offset] (0x0000000c)36# PRECHECK: DW_TAG_subprogram [2] * (0x0000000c)37# PRECHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000)38# PRECHECK-NEXT: DW_AT_high_pc [DW_FORM_data4]39# PRECHECK: DW_TAG_subprogram [8]40# PRECHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001)41# PRECHECK-NEXT: DW_AT_high_pc [DW_FORM_data4]42# PRECHECK: DW_TAG_formal_parameter [9]43# PRECHECK-NEXT: DW_AT_location [DW_FORM_loclistx] (indexed (0x0) loclist = 0x0000001844# PRECHECK: DW_TAG_formal_parameter [9]45# PRECHECK-NEXT: DW_AT_location [DW_FORM_loclistx] (indexed (0x1) loclist = 0x0000002846# PRECHECK: DW_TAG_variable47# PRECHECK-NEXT: DW_AT_location [DW_FORM_loclistx] (indexed (0x2) loclist = 0x0000003848# PRECHECK: DW_TAG_inlined_subroutine [12]49# PRECHECK-NEXT: DW_AT_abstract_origin50# PRECHECK-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x0) rangelist = 0x0000001451 52# helper0.cpp53# PRECHECK: version = 0x000454# PRECHECK: DW_TAG_compile_unit55# PRECHECK-NEXT: DW_AT_producer56# PRECHECK-NEXT: DW_AT_language57# PRECHECK-NEXT: DW_AT_name58# PRECHECK-NEXT: DW_AT_stmt_list59# PRECHECK-NEXT: DW_AT_comp_dir60# PRECHECK-NEXT: DW_AT_low_pc [DW_FORM_addr]61# PRECHECK-NEXT: DW_AT_high_pc62# PRECHECK: DW_TAG_subprogram [7]63# PRECHECK-NEXT: DW_AT_low_pc [DW_FORM_addr]64# PRECHECK-NEXT: DW_AT_high_pc65# PRECHECK: DW_TAG_variable [9]66# PRECHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x00000000:67# PRECHECK: DW_TAG_inlined_subroutine [10]68# PRECHECK-NEXT: DW_AT_abstract_origin69# PRECHECK-NEXT: DW_AT_low_pc [DW_FORM_addr]70# PRECHECK-NEXT: DW_AT_high_pc71 72# helper1.cpp73# PRECHECK: version = 0x000574# PRECHECK: DW_TAG_compile_unit [1] *75# PRECHECK-NEXT: DW_AT_producer76# PRECHECK-NEXT: DW_AT_language77# PRECHECK-NEXT: DW_AT_name78# PRECHECK-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000058)79# PRECHECK-NEXT: DW_AT_stmt_list80# PRECHECK-NEXT: DW_AT_comp_dir81# PRECHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001)82# PRECHECK-NEXT: DW_AT_high_pc [DW_FORM_data4]83# PRECHECK-NEXT: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000038)84# PRECHECK-NEXT: DW_AT_loclists_base [DW_FORM_sec_offset] (0x00000051)85# PRECHECK: DW_TAG_variable [2]86# PRECHECK-NEXT: DW_AT_name87# PRECHECK-NEXT: DW_AT_type88# PRECHECK-NEXT: DW_AT_external89# PRECHECK-NEXT: DW_AT_decl_file90# PRECHECK-NEXT: DW_AT_decl_line91# PRECHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx 0x0)92# PRECHECK: DW_TAG_subprogram [7]93# PRECHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001)94# PRECHECK-NEXT: DW_AT_high_pc [DW_FORM_data4]95# PRECHECK: DW_TAG_variable [9]96# PRECHECK-NEXT: DW_AT_location [DW_FORM_loclistx] (indexed (0x0)97# PRECHECK: DW_TAG_inlined_subroutine [10]98# PRECHECK-NEXT: DW_AT_abstract_origin99# PRECHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001)100# PRECHECK-NEXT: DW_AT_high_pc [DW_FORM_data4]101 102# helper2.cpp103# PRECHECK: version = 0x0004104# PRECHECK: DW_TAG_compile_unit [1] *105# PRECHECK-NEXT: DW_AT_producer106# PRECHECK-NEXT: DW_AT_language107# PRECHECK-NEXT: DW_AT_name108# PRECHECK-NEXT: DW_AT_stmt_list109# PRECHECK-NEXT: DW_AT_comp_dir110# PRECHECK-NEXT: DW_AT_low_pc [DW_FORM_addr]111# PRECHECK-NEXT: DW_AT_high_pc [DW_FORM_data4]112# PRECHECK: DW_TAG_subprogram [7]113# PRECHECK-NEXT: DW_AT_low_pc [DW_FORM_addr]114# PRECHECK-NEXT: DW_AT_high_pc [DW_FORM_data4]115# PRECHECK: DW_TAG_variable [9]116# PRECHECK-NEXT: DW_AT_location [DW_FORM_sec_offset]117# PRECHECK: DW_TAG_inlined_subroutine [10]118# PRECHECK-NEXT: DW_AT_abstract_origin119# PRECHECK-NEXT: DW_AT_low_pc [DW_FORM_addr]120# PRECHECK-NEXT: DW_AT_high_pc121 122# Checking debug line.123 124# CHECK-LINE: debug_line[125# CHECK-LINE: version: 5126# CHECK-LINE: include_directories[ 0] = .debug_line_str[0x[[#%.8x,TEST_DEBUG_LINE:]]] = "/test"127# CHECK-LINE-NEXT: file_names[ 0]:128# CHECK-LINE-NEXT: name: .debug_line_str[0x[[#%.8x,MAIN_DEBUG_LINE:]]] = "main.cpp"129# CHECK-LINE-NEXT: dir_index: 0130# CHECK-LINE-NEXT: md5_checksum: e3a18fae8565a087d09d6076b542cdab131 132# CHECK-LINE: debug_line[133# CHECK-LINE: version: 4134# CHECK-LINE: include_directories[ 1] = "/test"135# CHECK-LINE-NEXT: file_names[ 1]:136# CHECK-LINE-NEXT: name: "helper0.cpp"137# CHECK-LINE-NEXT: dir_index: 1138# CHECK-LINE-NEXT: mod_time:139# CHECK-LINE-NEXT: length:140 141# CHECK-LINE: debug_line[142# CHECK-LINE: version: 5143# CHECK-LINE: include_directories[ 0] = .debug_line_str[0x[[#TEST_DEBUG_LINE]]] = "/test"144# CHECK-LINE-NEXT: file_names[ 0]:145# CHECK-LINE-NEXT: name: .debug_line_str[0x[[#%.8x,HELPER_DEBUG_LINE:]]] = "helper1.cpp"146# CHECK-LINE-NEXT: dir_index: 0147# CHECK-LINE-NEXT: md5_checksum: e6dbd773fdf80bfea332cdf8284cddce148 149# CHECK-LINE: debug_line[150# CHECK-LINE: version: 4151# CHECK-LINE: include_directories[ 1] = "/test"152# CHECK-LINE-NEXT: file_names[ 1]:153# CHECK-LINE-NEXT: name: "helper2.cpp"154# CHECK-LINE-NEXT: dir_index: 1155# CHECK-LINE-NEXT: mod_time:156# CHECK-LINE-NEXT: length:157 158 159# POST BOLT.160 161# POSTCHECK: Addrs: [162# POSTCHECK-NEXT: 0x[[#%.16x,ADDR:]]163# POSTCHECK-NEXT: 0x[[#%.16x,ADDR1:]]164# POSTCHECK-NEXT: 0x[[#%.16x,ADDR2:]]165# POSTCHECK-NEXT: 0x[[#%.16x,ADDR3:]]166# POSTCHECK-NEXT: 0x[[#%.16x,ADDR4:]]167# POSTCHECK-NEXT: 0x[[#%.16x,ADDR5:]]168# POSTCHECK-NEXT: 0x[[#%.16x,ADDR6:]]169 170# POSTCHECK: Addrs: [171# POSTCHECK-NEXT: 0x[[#%.16x,ADDRB:]]172# POSTCHECK-NEXT: 0x[[#%.16x,ADDRB1:]]173# POSTCHECK-NEXT: 0x[[#%.16x,ADDRB2:]]174 175 176# main.cpp177# POSTCHECK: version = 0x0005178# POSTCHECK: DW_TAG_compile_unit [1] *179# POSTCHECK-NEXT: DW_AT_producer [DW_FORM_strx1] (indexed (00000000)180# POSTCHECK-NEXT: DW_AT_language181# POSTCHECK-NEXT: DW_AT_name182# POSTCHECK-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)183# POSTCHECK-NEXT: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)184# POSTCHECK-NEXT: DW_AT_comp_dir185# POSTCHECK-NEXT: DW_AT_low_pc186# POSTCHECK: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x0)187# POSTCHECK-NEXT: [0x[[#ADDR]], 0x[[#ADDR + 0x7]]188# POSTCHECK-NEXT: [0x[[#ADDR1]], 0x[[#ADDR1 + 0x51]]189# POSTCHECK-NEXT: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)190# POSTCHECK-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x0000000c)191# POSTCHECK-NEXT: DW_AT_loclists_base [DW_FORM_sec_offset] (0x0000000c)192# POSTCHECK: DW_TAG_subprogram [2]193# POSTCHECK-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x1) rangelist194# POSTCHECK-NEXT: [0x[[#ADDR]], 0x[[#ADDR + 0x7]]195# POSTCHECK: DW_TAG_subprogram [8]196# POSTCHECK-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x2) rangelist = 0x00000029197# POSTCHECK-NEXT: [0x[[#ADDR1]], 0x[[#ADDR1 + 0x51]]198# POSTCHECK: DW_TAG_formal_parameter [9]199# POSTCHECK-NEXT: DW_AT_location [DW_FORM_loclistx] (indexed (0x0) loclist = 0x00000018200# POSTCHECK-NEXT: [0x[[#ADDR1]], 0x[[#ADDR1 + 0x22]]201# POSTCHECK-NEXT: [0x[[#ADDR1 + 0x22]], 0x[[#ADDR1 + 0x51]]202# POSTCHECK: DW_TAG_formal_parameter [9]203# POSTCHECK-NEXT: DW_AT_location [DW_FORM_loclistx] (indexed (0x1) loclist = 0x00000028204# POSTCHECK-NEXT: [0x[[#ADDR1]], 0x[[#ADDR1 + 0x27]]205# POSTCHECK-NEXT: [0x[[#ADDR1 + 0x27]], 0x[[#ADDR1 + 0x51]]206# POSTCHECK: DW_TAG_variable207# POSTCHECK-NEXT: DW_AT_location [DW_FORM_loclistx] (indexed (0x2) loclist = 0x00000038208# POSTCHECK-NEXT: [0x[[#ADDR2]], 0x[[#ADDR2 + 0x6]]209# POSTCHECK-NEXT: [0x[[#ADDR2 + 0x6]], 0x[[#ADDR2 + 0x46]]210# POSTCHECK: DW_TAG_inlined_subroutine [12]211# POSTCHECK-NEXT: DW_AT_abstract_origin212# POSTCHECK-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x3) rangelist = 0x0000002d213# POSTCHECK-NEXT: [0x[[#ADDR3]], 0x[[#ADDR3 + 0x4]]214# POSTCHECK-NEXT: [0x[[#ADDR3 + 0x10]], 0x[[#ADDR3 + 0x16]]215 216# helper0.cpp217# POSTCHECK: version = 0x0004218# POSTCHECK: DW_TAG_compile_unit219# POSTCHECK-NEXT: DW_AT_producer220# POSTCHECK-NEXT: DW_AT_language221# POSTCHECK-NEXT: DW_AT_name222# POSTCHECK-NEXT: DW_AT_stmt_list223# POSTCHECK-NEXT: DW_AT_comp_dir224# POSTCHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)225# POSTCHECK-NEXT: DW_AT_ranges [DW_FORM_sec_offset]226# POSTCHECK-NEXT: [0x227# POSTCHECK: DW_TAG_subprogram [22]228# POSTCHECK-NEXT: DW_AT_ranges [DW_FORM_sec_offset]229# POSTCHECK-NEXT: [0x230# POSTCHECK: DW_TAG_variable [24]231# POSTCHECK-NEXT: DW_AT_location [DW_FORM_sec_offset]232# POSTCHECK-NEXT: [0x233# POSTCHECK-NEXT: [0x234# POSTCHECK: DW_TAG_inlined_subroutine [25]235# POSTCHECK-NEXT: DW_AT_abstract_origin236# POSTCHECK-NEXT: DW_AT_ranges [DW_FORM_sec_offset]237# POSTCHECK-NEXT: [0x238 239# helper1.cpp240# POSTCHECK: version = 0x0005241# POSTCHECK: DW_TAG_compile_unit [26] *242# POSTCHECK-NEXT: DW_AT_producer243# POSTCHECK-NEXT: DW_AT_language244# POSTCHECK-NEXT: DW_AT_name245# POSTCHECK-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000058)246# POSTCHECK-NEXT: DW_AT_stmt_list247# POSTCHECK-NEXT: DW_AT_comp_dir248# POSTCHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001)249# POSTCHECK-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x0)250# POSTCHECK-NEXT: [0x[[#ADDRB]], 0x[[#ADDRB + 0x4]]251# POSTCHECK-NEXT: DW_AT_addr_base [DW_FORM_sec_offset]252# POSTCHECK-NEXT: DW_AT_loclists_base [DW_FORM_sec_offset]253# POSTCHECK-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset]254# POSTCHECK: DW_TAG_variable [27]255# POSTCHECK-NEXT: DW_AT_name256# POSTCHECK-NEXT: DW_AT_type257# POSTCHECK-NEXT: DW_AT_external258# POSTCHECK-NEXT: DW_AT_decl_file259# POSTCHECK-NEXT: DW_AT_decl_line260# POSTCHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addrx 0x2)261# POSTCHECK: DW_TAG_subprogram [29]262# POSTCHECK-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x1)263# POSTCHECK-NEXT: [0x[[#ADDRB]], 0x[[#ADDRB + 0x4]]264# POSTCHECK: DW_TAG_variable [10]265# POSTCHECK-NEXT: DW_AT_location [DW_FORM_loclistx] (indexed (0x0)266# POSTCHECK-NEXT: [0x[[#ADDRB]], 0x[[#ADDRB + 0x3]]267# POSTCHECK-NEXT: [0x[[#ADDRB + 0x3]], 0x[[#ADDRB + 0x4]]268# POSTCHECK: DW_TAG_inlined_subroutine269# POSTCHECK-NEXT: DW_AT_abstract_origin270# POSTCHECK-NEXT: DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x2) rangelist271# POSTCHECK-NEXT: [0x[[#ADDRB]], 0x[[#ADDRB + 0x3]]272 273# helper2.cpp274# POSTCHECK: version = 0x0004275# POSTCHECK: DW_TAG_compile_unit [17] *276# POSTCHECK-NEXT: DW_AT_producer277# POSTCHECK-NEXT: DW_AT_language278# POSTCHECK-NEXT: DW_AT_name279# POSTCHECK-NEXT: DW_AT_stmt_list280# POSTCHECK-NEXT: DW_AT_comp_dir281# POSTCHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)282# POSTCHECK-NEXT: DW_AT_ranges [DW_FORM_sec_offset]283# POSTCHECK-NEXT: [0x284# POSTCHECK: DW_TAG_subprogram [22]285# POSTCHECK-NEXT: DW_AT_ranges [DW_FORM_sec_offset]286# POSTCHECK-NEXT: [0x287# POSTCHECK: DW_TAG_variable [24]288# POSTCHECK-NEXT: DW_AT_location [DW_FORM_sec_offset]289# POSTCHECK-NEXT: [0x290# POSTCHECK-NEXT: [0x291# POSTCHECK: DW_TAG_inlined_subroutine [25]292# POSTCHECK-NEXT: DW_AT_abstract_origin293# POSTCHECK-NEXT: DW_AT_ranges [DW_FORM_sec_offset]294# POSTCHECK-NEXT: [0x295 296 297# Checking debug line.298 299# CHECK-LINE: debug_line[300# CHECK-LINE: version: 5301# CHECK-LINE: include_directories[ 0] = .debug_line_str[0x[[#TEST_DEBUG_LINE]]] = "/test"302# CHECK-LINE-NEXT: file_names[ 0]:303# CHECK-LINE-NEXT: name: .debug_line_str[0x[[#MAIN_DEBUG_LINE]]] = "main.cpp"304# CHECK-LINE-NEXT: dir_index: 0305# CHECK-LINE-NEXT: md5_checksum: e3a18fae8565a087d09d6076b542cdab306 307# CHECK-LINE: debug_line[308# CHECK-LINE: version: 4309# CHECK-LINE: include_directories[ 1] = "/test"310# CHECK-LINE-NEXT: file_names[ 1]:311# CHECK-LINE-NEXT: name: "helper0.cpp"312# CHECK-LINE-NEXT: dir_index: 1313# CHECK-LINE-NEXT: mod_time:314# CHECK-LINE-NEXT: length:315 316# CHECK-LINE: debug_line[317# CHECK-LINE: version: 5318# CHECK-LINE: include_directories[ 0] = .debug_line_str[0x[[#TEST_DEBUG_LINE]]] = "/test"319# CHECK-LINE-NEXT: file_names[ 0]:320# CHECK-LINE-NEXT: name: .debug_line_str[0x[[#HELPER_DEBUG_LINE]]] = "helper1.cpp"321# CHECK-LINE-NEXT: dir_index: 0322# CHECK-LINE-NEXT: md5_checksum: e6dbd773fdf80bfea332cdf8284cddce323 324# CHECK-LINE: debug_line[325# CHECK-LINE: version: 4326# CHECK-LINE: include_directories[ 1] = "/test"327# CHECK-LINE-NEXT: file_names[ 1]:328# CHECK-LINE-NEXT: name: "helper2.cpp"329# CHECK-LINE-NEXT: dir_index: 1330# CHECK-LINE-NEXT: mod_time:331# CHECK-LINE-NEXT: length:332