1 ## This test checks that .debug_loclists table is correclty handled
2 ## and transformed into the DW_FORM_sec_offset form in case
3 ## --no-update. Or correctly preserved in --update case.
5 ## cat dwarf5-loclists.c
8 ## int main ( int argv, char** argc ) {
9 ## printf ("\n argv %d", argv );
11 ## printf ("\n argv %d", argv );
13 ## printf ("\n argv %d", &argv );
17 ## $ clang -gdwarf-5 dwarf5-loclists.c -c -O2 -o dwarf5-rnglists.o
19 #RUN: dsymutil -oso-prepend-path %p/../Inputs -y %s -o %t.dSYM
20 #RUN: llvm-dwarfdump --verify %t.dSYM | FileCheck %s
21 #RUN: llvm-dwarfdump -a --verbose %t.dSYM | FileCheck %s --check-prefix DWARF-CHECK
23 #RUN: dsymutil --update -oso-prepend-path %p/../Inputs -y %s -o %t.dSYM
24 #RUN: llvm-dwarfdump --verify %t.dSYM | FileCheck %s
25 #RUN: llvm-dwarfdump -a --verbose %t.dSYM | FileCheck %s --check-prefix UPD-DWARF-CHECK
27 #RUN: dsymutil --linker llvm -oso-prepend-path %p/../Inputs -y %s -o %t.dSYM
28 #RUN: llvm-dwarfdump --verify %t.dSYM | FileCheck %s
29 #RUN: llvm-dwarfdump -a --verbose %t.dSYM | FileCheck %s --check-prefix DWARF-CHECK
31 #RUN: dsymutil --linker llvm --update -oso-prepend-path %p/../Inputs -y %s -o %t.dSYM
32 #RUN: llvm-dwarfdump --verify %t.dSYM | FileCheck %s
33 #RUN: llvm-dwarfdump -a --verbose %t.dSYM | FileCheck %s --check-prefix UPD-DWARF-CHECK
37 #DWARF-CHECK: DW_TAG_formal_parameter
38 #DWARF-CHECK: DW_AT_name {{.*}} "dwarf5-loclists.c"
39 #DWARF-CHECK-NOT: DW_AT_loclists_base
40 #DWARF-CHECK: DW_TAG_formal_parameter
41 #DWARF-CHECK: DW_AT_location [DW_FORM_sec_offset] (0x0000000c:
42 #DWARF-CHECK: [0x0000000100000f70, 0x0000000100000f87): DW_OP_reg5 RDI
43 #DWARF-CHECK: [0x0000000100000f87, 0x0000000100000f93): DW_OP_reg3 RBX
44 #DWARF-CHECK: [0x0000000100000f93, 0x0000000100000f9d): DW_OP_reg4 RSI
45 #DWARF-CHECK: [0x0000000100000fa0, 0x0000000100000fa3): DW_OP_reg3 RBX
46 #DWARF-CHECK: [0x0000000100000fa3, 0x0000000100000fbc): DW_OP_breg6 RBP-20)
47 #DWARF-CHECK: DW_AT_name {{.*}} "argv"
48 #DWARF-CHECK: DW_TAG_formal_parameter
49 #DWARF-CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000029:
50 #DWARF-CHECK: [0x0000000100000f70, 0x0000000100000f89): DW_OP_reg4 RSI
51 #DWARF-CHECK: [0x0000000100000f89, 0x0000000100000fbc): DW_OP_entry_value(DW_OP_reg4 RSI), DW_OP_stack_value)
52 #DWARF-CHECK: DW_AT_name {{.*}} "argc"
53 #DWARF-CHECK: .debug_loclists contents:
54 #DWARF-CHECK: 0x00000000: locations list header: length = 0x00000035, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
55 #DWARF-CHECK: 0x0000000c:
56 #DWARF-CHECK: DW_LLE_base_addressx (0x0000000000000000)
57 #DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000000, 0x0000000000000017): DW_OP_reg5 RDI
58 #DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000017, 0x0000000000000023): DW_OP_reg3 RBX
59 #DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000023, 0x000000000000002d): DW_OP_reg4 RSI
60 #DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000030, 0x0000000000000033): DW_OP_reg3 RBX
61 #DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000033, 0x000000000000004c): DW_OP_breg6 RBP-20
62 #DWARF-CHECK: DW_LLE_end_of_list ()
63 #DWARF-CHECK: 0x00000029:
64 #DWARF-CHECK: DW_LLE_base_addressx (0x0000000000000000)
65 #DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000000, 0x0000000000000019): DW_OP_reg4 RSI
66 #DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000019, 0x000000000000004c): DW_OP_entry_value(DW_OP_reg4 RSI), DW_OP_stack_value
67 #DWARF-CHECK: DW_LLE_end_of_list ()
73 #UPD-DWARF-CHECK: DW_TAG_compile_unit
74 #UPD-DWARF-CHECK: DW_AT_name {{.*}} "dwarf5-loclists.c"
75 #UPD-DWARF-CHECK: DW_AT_loclists_base [DW_FORM_sec_offset] (0x0000000c)
76 #UPD-DWARF-CHECK: DW_TAG_formal_parameter [8] (0x00000047)
77 #UPD-DWARF-CHECK: DW_AT_location [DW_FORM_loclistx] (indexed (0x0) loclist = 0x00000014:
78 #UPD-DWARF-CHECK: [0x0000000000000000, 0x0000000000000017): DW_OP_reg5 RDI
79 #UPD-DWARF-CHECK: [0x0000000000000017, 0x0000000000000023): DW_OP_reg3 RBX
80 #UPD-DWARF-CHECK: [0x0000000000000023, 0x000000000000002d): DW_OP_reg4 RSI
81 #UPD-DWARF-CHECK: [0x0000000000000030, 0x0000000000000033): DW_OP_reg3 RBX
82 #UPD-DWARF-CHECK: [0x0000000000000033, 0x000000000000004c): DW_OP_breg6 RBP-20)
83 #UPD-DWARF-CHECK: DW_AT_name {{.*}} "argv"
84 #UPD-DWARF-CHECK: DW_TAG_formal_parameter [8] (0x00000047)
85 #UPD-DWARF-CHECK: DW_AT_location [DW_FORM_loclistx] (indexed (0x1) loclist = 0x0000002f:
86 #UPD-DWARF-CHECK: [0x0000000000000000, 0x0000000000000019): DW_OP_reg4 RSI
87 #UPD-DWARF-CHECK: [0x0000000000000019, 0x000000000000004c): DW_OP_entry_value(DW_OP_reg4 RSI), DW_OP_stack_value)
88 #UPD-DWARF-CHECK: DW_AT_name {{.*}} "argc"
89 #UPD-DWARF-CHECK: .debug_loclists contents:
90 #UPD-DWARF-CHECK: 0x00000000: locations list header: length = 0x00000039, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000002
91 #UPD-DWARF-CHECK: offsets: [
92 #UPD-DWARF-CHECK: 0x00000008 => 0x00000014
93 #UPD-DWARF-CHECK: 0x00000023 => 0x0000002f
95 #UPD-DWARF-CHECK: 0x00000014:
96 #UPD-DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000000, 0x0000000000000017): DW_OP_reg5 RDI
97 #UPD-DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000017, 0x0000000000000023): DW_OP_reg3 RBX
98 #UPD-DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000023, 0x000000000000002d): DW_OP_reg4 RSI
99 #UPD-DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000030, 0x0000000000000033): DW_OP_reg3 RBX
100 #UPD-DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000033, 0x000000000000004c): DW_OP_breg6 RBP-20
101 #UPD-DWARF-CHECK: DW_LLE_end_of_list ()
102 #UPD-DWARF-CHECK: 0x0000002f:
103 #UPD-DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000000, 0x0000000000000019): DW_OP_reg4 RSI
104 #UPD-DWARF-CHECK: DW_LLE_offset_pair (0x0000000000000019, 0x000000000000004c): DW_OP_entry_value(DW_OP_reg4 RSI), DW_OP_stack_value
105 #UPD-DWARF-CHECK: DW_LLE_end_of_list ()
108 triple: 'x86_64-apple-darwin'
110 - filename: 'dwarf5-loclists.o'
111 timestamp: 1676048242
113 - { sym: _main, objAddr: 0x0, binAddr: 0x100000F70, size: 0x48 }
114 - { sym: _g1, binAddr: 0x100001000, size: 0x0 }