Follow up to d0858bffa11, add missing REQUIRES x86
[llvm-project.git] / llvm / test / tools / dsymutil / X86 / dwarf5-rnglists.test
blob651a874ff3ec4c95fbd2cf6b04a59ed77ce8bf73
1 ## This test checks that .debug_rnglists table correclty handled
2 ## and transformed into the DW_FORM_sec_offset form in case
3 ## --no-update. Or correctly preservedi in --update case.
5 ## cat dwarf5-rnglists.c
6 ##
7 ## #include <stdio.h>
8 ##
9 ## int g1;
11 ## int main ( int argv, char** argc ) {
13 ##   if ( argv > 10 ) {
14 ##     volatile int a = 0x4;
16 ##     if ( g1 ) {
17 ##       volatile int b = 0;
18 ##       return b;
19 ##     }
21 ##     volatile int c = 7;
22 ##   } else if ( g1 ) {
23 ##     volatile int a = 0x5;
24 ##   }
26 ##   return 0;
27 ## }
29 ## $ clang -gdwarf-5 dwarf5-rnglists.c -c -O2 -o dwarf5-rnglists.o
30 ## $ clang -gdwarf-5 dwarf5-rnglists.o -o dwarf5-rnglists
32 #RUN: dsymutil -oso-prepend-path %p/../Inputs -y %s -o %t.dSYM
33 #RUN: llvm-dwarfdump --verify  %t.dSYM | FileCheck %s
34 #RUN: llvm-dwarfdump -a --verbose  %t.dSYM | FileCheck %s --check-prefix DWARF-CHECK
36 #RUN: dsymutil --update -oso-prepend-path %p/../Inputs -y %s -o %t.dSYM
37 #RUN: llvm-dwarfdump --verify  %t.dSYM | FileCheck %s
38 #RUN: llvm-dwarfdump -a --verbose  %t.dSYM | FileCheck %s --check-prefix UPD-DWARF-CHECK
40 #RUN: dsymutil --linker llvm -oso-prepend-path %p/../Inputs -y %s -o %t.dSYM
41 #RUN: llvm-dwarfdump --verify  %t.dSYM | FileCheck %s
42 #RUN: llvm-dwarfdump -a --verbose  %t.dSYM | FileCheck %s --check-prefix DWARF-CHECK
44 #RUN: dsymutil --linker llvm --update -oso-prepend-path %p/../Inputs -y %s -o %t.dSYM
45 #RUN: llvm-dwarfdump --verify  %t.dSYM | FileCheck %s
46 #RUN: llvm-dwarfdump -a --verbose  %t.dSYM | FileCheck %s --check-prefix UPD-DWARF-CHECK
48 #CHECK: No errors.
50 #DWARF-CHECK: DW_TAG_compile_unit
51 #DWARF-CHECK:   DW_AT_addr_base [DW_FORM_sec_offset]      (0x00000008)
52 #DWARF-CHECK: DW_TAG_lexical_block
53 #DWARF-CHECK:   DW_AT_ranges [DW_FORM_sec_offset]     (0x0000000c
54 #DWARF-CHECK:      [0x0000000100000f79, 0x0000000100000f96)
55 #DWARF-CHECK:      [0x0000000100000fad, 0x0000000100000fb4))
56 #DWARF-CHECK: .debug_rnglists contents:
57 #DWARF-CHECK: 0x00000000: range list header: length = 0x00000011, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
58 #DWARF-CHECK: ranges:
59 #DWARF-CHECK: 0x0000000c: [DW_RLE_base_addressx]:  0x0000000000000003
60 #DWARF-CHECK: 0x0000000e: [DW_RLE_offset_pair  ]:  0x0000000000000000, 0x000000000000001d
61 #DWARF-CHECK: 0x00000011: [DW_RLE_offset_pair  ]:  0x0000000000000034, 0x000000000000003b
62 #DWARF-CHECK: 0x00000014: [DW_RLE_end_of_list  ]
64 #UPD-DWARF-CHECK: DW_TAG_compile_unit
65 #UPD-DWARF-CHECK:   DW_AT_addr_base [DW_FORM_sec_offset]      (0x00000008)
66 #UPD-DWARF-CHECK: DW_TAG_lexical_block
67 #UPD-DWARF-CHECK:   DW_AT_ranges [DW_FORM_rnglistx]       (indexed (0x0) rangelist = 0x00000010
68 #UPD-DWARF-CHECK:     [0x0000000000000009, 0x0000000000000026)
69 #UPD-DWARF-CHECK:     [0x000000000000003d, 0x0000000000000044))
70 #UPD-DWARF-CHECK: .debug_addr contents:
71 #UPD-DWARF-CHECK: 0x00000000: Address table header: length = 0x00000024, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00
72 #UPD-DWARF-CHECK: Addrs: [
73 #UPD-DWARF-CHECK: 0x0000000000000000
74 #UPD-DWARF-CHECK: 0x0000000000000000
75 #UPD-DWARF-CHECK: 0x000000000000001c
76 #UPD-DWARF-CHECK: 0x0000000000000034
77 #UPD-DWARF-CHECK: ]
79 #UPD-DWARF-CHECK: .debug_rnglists contents:
80 #UPD-DWARF-CHECK: 0x00000000: range list header: length = 0x00000013, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000001
81 #UPD-DWARF-CHECK: offsets: [
82 #UPD-DWARF-CHECK: 0x00000004 => 0x00000010
83 #UPD-DWARF-CHECK: ]
84 #UPD-DWARF-CHECK: ranges:
85 #UPD-DWARF-CHECK: 0x00000010: [DW_RLE_offset_pair]:  0x0000000000000009, 0x0000000000000026 => [0x0000000000000009, 0x0000000000000026)
86 #UPD-DWARF-CHECK: 0x00000013: [DW_RLE_offset_pair]:  0x000000000000003d, 0x0000000000000044 => [0x000000000000003d, 0x0000000000000044)
87 #UPD-DWARF-CHECK: 0x00000016: [DW_RLE_end_of_list]
89 ---
90 triple:          'x86_64-apple-darwin'
91 objects:
92   - filename:        'dwarf5-rnglists.o'
93     timestamp:       1676048242
94     symbols:
95       - { sym: _main, objAddr: 0x0, binAddr: 0x100000F70, size: 0x48 }
96       - { sym: _g1, binAddr: 0x100001000, size: 0x0 }