262 lines · plain
1# REQUIRES: system-linux2 3# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -o %t1.o4# RUN: %clang %cflags -dwarf-5 %t1.o -o %t.exe -Wl,-q5# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --always-convert-to-ranges6# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe | FileCheck --check-prefix=PRECHECK %s7# RUN: llvm-dwarfdump --show-form --verbose --debug-addr %t.bolt > %t.txt8# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt >> %t.txt9# RUN: cat %t.txt | FileCheck --check-prefix=POSTCHECK %s10 11## This tests conversion for DWARF5 ranges DW_AT_ranges [DW_FORM_sec_offset] to DW_AT_ranges [DW_FORM_rnglistx]12 13# PRECHECK: version = 0x000514# PRECHECK: DW_AT_ranges [DW_FORM_sec_offset]15 16# POSTCHECK: Addrs: [17# POSTCHECK-NEXT: 0x[[#%.16x,ADDR:]]18# POSTCHECK-NEXT: 0x[[#%.16x,ADDR1:]]19# POSTCHECK: version = 0x000520# POSTCHECK: DW_AT_ranges [DW_FORM_rnglistx]21# POSTCHECK-SAME: (indexed (0x0) rangelist = 0x0000001822# POSTCHECK-NEXT: [0x[[#ADDR]], 0x[[#ADDR + 11]]23# POSTCHECK-NEXT: [0x[[#ADDR1]], 0x[[#ADDR1 + 11]]24# POSTCHECK-NEXT: DW_AT_low_pc [DW_FORM_addr]25# POSTCHECK-NEXT: DW_AT_stmt_list [DW_FORM_sec_offset]26# POSTCHECK-NEXT: DW_AT_rnglists_base [DW_FORM_sec_offset] (0x0000000c)27# POSTCHECK-NEXT: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)28 29 30# int foo() {31# return 3;32# }33#34# int main() {35# return foo();36# }37 38 .file "main.cpp"39 .text40.Ltext0:41 .file 0 "/testRangeOffsetToRangeX" "main.cpp"42 .section .text._Z3foov,"ax",@progbits43 .globl _Z3foov44 .type _Z3foov, @function45_Z3foov:46.LFB0:47 .file 1 "main.cpp"48 .loc 0 1 1149 .cfi_startproc50 pushq %rbp51 .cfi_def_cfa_offset 1652 .cfi_offset 6, -1653 movq %rsp, %rbp54 .cfi_def_cfa_register 655 .loc 0 2 1056 movl $3, %eax57 .loc 0 3 158 popq %rbp59 .cfi_def_cfa 7, 860 ret61 .cfi_endproc62.LFE0:63 .size _Z3foov, .-_Z3foov64 .section .text.main,"ax",@progbits65 .globl main66 .type main, @function67main:68.LFB1:69 .loc 0 5 1270 .cfi_startproc71 pushq %rbp72 .cfi_def_cfa_offset 1673 .cfi_offset 6, -1674 movq %rsp, %rbp75 .cfi_def_cfa_register 676 .loc 0 6 1377 call _Z3foov78 .loc 0 6 1479 nop80 .loc 0 7 181 popq %rbp82 .cfi_def_cfa 7, 883 ret84 .cfi_endproc85.LFE1:86 .size main, .-main87 .text88.Letext0:89 .section .debug_info,"",@progbits90.Ldebug_info0:91 .long 0x6e92 .value 0x593 .byte 0x194 .byte 0x895 .long .Ldebug_abbrev096 .uleb128 0x197 .long .LASF298 .byte 0x2199 .long .LASF0100 .long .LASF1101 .long .LLRL0102 .quad 0103 .long .Ldebug_line0104 .uleb128 0x2105 .long .LASF3106 .byte 0x1107 .byte 0x5108 .byte 0x5109 .long 0x48110 .quad .LFB1111 .quad .LFE1-.LFB1112 .uleb128 0x1113 .byte 0x9c114 .uleb128 0x3115 .byte 0x4116 .byte 0x5117 .string "int"118 .uleb128 0x4119 .string "foo"120 .byte 0x1121 .byte 0x1122 .byte 0x5123 .long .LASF4124 .long 0x48125 .quad .LFB0126 .quad .LFE0-.LFB0127 .uleb128 0x1128 .byte 0x9c129 .byte 0130 .section .debug_abbrev,"",@progbits131.Ldebug_abbrev0:132 .uleb128 0x1133 .uleb128 0x11134 .byte 0x1135 .uleb128 0x25136 .uleb128 0xe137 .uleb128 0x13138 .uleb128 0xb139 .uleb128 0x3140 .uleb128 0x1f141 .uleb128 0x1b142 .uleb128 0x1f143 .uleb128 0x55144 .uleb128 0x17145 .uleb128 0x11146 .uleb128 0x1147 .uleb128 0x10148 .uleb128 0x17149 .byte 0150 .byte 0151 .uleb128 0x2152 .uleb128 0x2e153 .byte 0154 .uleb128 0x3f155 .uleb128 0x19156 .uleb128 0x3157 .uleb128 0xe158 .uleb128 0x3a159 .uleb128 0xb160 .uleb128 0x3b161 .uleb128 0xb162 .uleb128 0x39163 .uleb128 0xb164 .uleb128 0x49165 .uleb128 0x13166 .uleb128 0x11167 .uleb128 0x1168 .uleb128 0x12169 .uleb128 0x7170 .uleb128 0x40171 .uleb128 0x18172 .uleb128 0x7c173 .uleb128 0x19174 .byte 0175 .byte 0176 .uleb128 0x3177 .uleb128 0x24178 .byte 0179 .uleb128 0xb180 .uleb128 0xb181 .uleb128 0x3e182 .uleb128 0xb183 .uleb128 0x3184 .uleb128 0x8185 .byte 0186 .byte 0187 .uleb128 0x4188 .uleb128 0x2e189 .byte 0190 .uleb128 0x3f191 .uleb128 0x19192 .uleb128 0x3193 .uleb128 0x8194 .uleb128 0x3a195 .uleb128 0xb196 .uleb128 0x3b197 .uleb128 0xb198 .uleb128 0x39199 .uleb128 0xb200 .uleb128 0x6e201 .uleb128 0xe202 .uleb128 0x49203 .uleb128 0x13204 .uleb128 0x11205 .uleb128 0x1206 .uleb128 0x12207 .uleb128 0x7208 .uleb128 0x40209 .uleb128 0x18210 .uleb128 0x7a211 .uleb128 0x19212 .byte 0213 .byte 0214 .byte 0215 .section .debug_aranges,"",@progbits216 .long 0x3c217 .value 0x2218 .long .Ldebug_info0219 .byte 0x8220 .byte 0221 .value 0222 .value 0223 .quad .LFB0224 .quad .LFE0-.LFB0225 .quad .LFB1226 .quad .LFE1-.LFB1227 .quad 0228 .quad 0229 .section .debug_rnglists,"",@progbits230.Ldebug_ranges0:231 .long .Ldebug_ranges3-.Ldebug_ranges2232.Ldebug_ranges2:233 .value 0x5234 .byte 0x8235 .byte 0236 .long 0237.LLRL0:238 .byte 0x7239 .quad .LFB0240 .uleb128 .LFE0-.LFB0241 .byte 0x7242 .quad .LFB1243 .uleb128 .LFE1-.LFB1244 .byte 0245.Ldebug_ranges3:246 .section .debug_line,"",@progbits247.Ldebug_line0:248 .section .debug_str,"MS",@progbits,1249.LASF4:250 .string "_Z3foov"251.LASF3:252 .string "main"253.LASF2:254 .string "GNU C++17 11.x"255 .section .debug_line_str,"MS",@progbits,1256.LASF0:257 .string "main.cpp"258.LASF1:259 .string "/testRangeOffsetToRangeX"260 .ident "GCC: (GNU) 11.x"261 .section .note.GNU-stack,"",@progbits262