xref: /llvm-project/bolt/test/X86/asm-func-debug.test (revision 11791ae7b0b05b8bd8d806331ff51da618912cf8)
1*11791ae7SSayhaan Siddiqui## Verify that we update DW_TAG_compile_unit' ranges and .debug_aranges
2*11791ae7SSayhaan Siddiqui## for assembly function that doesn't have corresponding DIE.
3*11791ae7SSayhaan Siddiqui##
4*11791ae7SSayhaan Siddiqui## The input test case foo() contains nops that we remove.
58331f75eSAmir Ayupov
64ff1bc2fSAlexander YermolovichRUN: %clang %cflags -gdwarf-5 -no-pie %p/../Inputs/asm_foo.s %p/../Inputs/asm_main.c -o %t.exe
7d648aa1bSMaksim PanchenkoRUN: llvm-bolt %t.exe -o %t --update-debug-sections
88331f75eSAmir AyupovRUN: llvm-dwarfdump -all %t | FileCheck %s
98331f75eSAmir Ayupov
10*11791ae7SSayhaan Siddiqui## Check ranges were created/updated for asm compile unit
114ff1bc2fSAlexander YermolovichCHECK:       0x0000000c: DW_TAG_compile_unit
128331f75eSAmir AyupovCHECK-NEXT:       DW_AT_stmt_list (0x00000000)
138331f75eSAmir AyupovCHECK-NEXT:       DW_AT_low_pc (0x0000000000000000)
148331f75eSAmir AyupovCHECK-NEXT:       DW_AT_ranges
158331f75eSAmir AyupovCHECK-NEXT:          [0x0000000000[[#%x,ADDR:]],
168331f75eSAmir AyupovCHECK-SAME:           0x0000000000[[#ADDR+1]]))
175c238be0SAmir AyupovCHECK-NEXT:       DW_AT_name ("{{.*}}asm_foo.s")
188331f75eSAmir Ayupov
19*11791ae7SSayhaan Siddiqui## Check .debug_aranges was updated for asm module
208331f75eSAmir AyupovCHECK: .debug_aranges contents:
218331f75eSAmir AyupovCHECK-NEXT:   Address Range Header: length = 0x0000002c, format = DWARF32, version = 0x0002, cu_offset = 0x00000000, addr_size = 0x08, seg_size = 0x00
228331f75eSAmir AyupovCHECK-NEXT:   [0x0000000000[[#ADDR]], 0x0000000000[[#ADDR+1]])
238331f75eSAmir Ayupov
24*11791ae7SSayhaan Siddiqui## Check line number info was updated
256aa94c64SDavid StenbergCHECK:       0x0000000000[[#ADDR]]   13      0      0   0             0       0  is_stmt
266aa94c64SDavid StenbergCHECK-NEXT:  0x0000000000[[#ADDR+1]] 13      0      0   0             0       0  is_stmt end_sequence
27