| 1 |
## This test checks handling of DWARFv5 address attribute. |
| 2 |
## It contains two compile units. One is a good one and |
| 3 |
## should be processed correctly. Second is a bad - it |
| 4 |
## missing DW_AT_addr_base attribute. All address attributes |
| 5 |
## inside this unit should be skipped. |
| 6 |
|
| 7 |
# RUN: yaml2obj %s -o %t.o |
| 8 |
# RUN: echo '---' > %t2.map |
| 9 |
# RUN: echo "triple: 'x86_64-apple-darwin'" >> %t2.map |
| 10 |
# RUN: echo 'objects:' >> %t2.map |
| 11 |
# RUN: echo " - filename: '%t.o'" >> %t2.map |
| 12 |
# RUN: echo ' symbols:' >> %t2.map |
| 13 |
# RUN: echo ' - { sym: __Z3foov, objAddr: 0x0, binAddr: 0x10000, size: 0x10 }' >> %t2.map |
| 14 |
# RUN: echo '...' >> %t2.map |
| 15 |
# RUN: dsymutil -y %t2.map -f -o - | llvm-dwarfdump -a - | FileCheck %s |
| 16 |
|
| 17 |
# CHECK: file format Mach-O 64-bit x86-64 |
| 18 |
# CHECK: .debug_info contents: |
| 19 |
# CHECK: Compile Unit: |
| 20 |
# CHECK: DW_TAG_compile_unit |
| 21 |
# CHECK: DW_AT_name{{.*}}"GoodCU" |
| 22 |
# CHECK: DW_AT_low_pc |
| 23 |
# CHECK: DW_TAG_subprogram |
| 24 |
# CHECK: DW_AT_name{{.*}}"foo" |
| 25 |
# CHECK: DW_TAG_variable |
| 26 |
# CHECK: DW_AT_name{{.*}}"var1" |
| 27 |
# CHECK: DW_AT_location (DW_OP_addr |
| 28 |
# CHECK: 0x00000043: NULL |
| 29 |
# CHECK: Compile Unit: |
| 30 |
# CHECK: DW_TAG_compile_unit |
| 31 |
# CHECK-NOT: DW_AT_low_pc |
| 32 |
# CHECK: DW_AT_name{{.*}}"BadCU" |
| 33 |
# CHECK-NOT: DW_TAG_subprogram |
| 34 |
# CHECK-NOT: DW_TAG_variable |
| 35 |
# CHECK: 0x0000005b: NULL |
| 36 |
|
| 37 |
--- !mach-o |
| 38 |
FileHeader: |
| 39 |
magic: 0xFEEDFACF |
| 40 |
cputype: 0x01000007 |
| 41 |
cpusubtype: 0x00000003 |
| 42 |
filetype: 0x00000001 |
| 43 |
ncmds: 2 |
| 44 |
sizeofcmds: 472 |
| 45 |
flags: 0x00002000 |
| 46 |
reserved: 0x00000000 |
| 47 |
LoadCommands: |
| 48 |
- cmd: LC_SEGMENT_64 |
| 49 |
cmdsize: 312 |
| 50 |
segname: '' |
| 51 |
vmaddr: 0x00 |
| 52 |
vmsize: 0x300 |
| 53 |
fileoff: 0x300 |
| 54 |
filesize: 0x300 |
| 55 |
maxprot: 7 |
| 56 |
initprot: 7 |
| 57 |
nsects: 3 |
| 58 |
flags: 0 |
| 59 |
Sections: |
| 60 |
- sectname: __debug_abbrev |
| 61 |
segname: __DWARF |
| 62 |
addr: 0x000000000000000F |
| 63 |
size: 0x60 |
| 64 |
offset: 0x00000210 |
| 65 |
align: 0 |
| 66 |
reloff: 0x00000000 |
| 67 |
nreloc: 0 |
| 68 |
flags: 0x00000000 |
| 69 |
reserved1: 0x00000000 |
| 70 |
reserved2: 0x00000000 |
| 71 |
reserved3: 0x00000000 |
| 72 |
- sectname: __debug_info |
| 73 |
segname: __DWARF |
| 74 |
addr: 0x000000000000100 |
| 75 |
size: 0x9e |
| 76 |
offset: 0x00000310 |
| 77 |
align: 0 |
| 78 |
reloff: 0x00000000 |
| 79 |
nreloc: 0 |
| 80 |
flags: 0x00000000 |
| 81 |
reserved1: 0x00000000 |
| 82 |
reserved2: 0x00000000 |
| 83 |
reserved3: 0x00000000 |
| 84 |
- sectname: __debug_addr |
| 85 |
segname: __DWARF |
| 86 |
addr: 0x0000000000000200 |
| 87 |
size: 0x30 |
| 88 |
offset: 0x00000400 |
| 89 |
align: 0 |
| 90 |
reloff: 0x00000600 |
| 91 |
nreloc: 2 |
| 92 |
flags: 0x02000000 |
| 93 |
reserved1: 0x00000000 |
| 94 |
reserved2: 0x00000000 |
| 95 |
reserved3: 0x00000000 |
| 96 |
relocations: |
| 97 |
- address: 0x8 |
| 98 |
symbolnum: 1 |
| 99 |
pcrel: true |
| 100 |
length: 3 |
| 101 |
extern: true |
| 102 |
type: 0 |
| 103 |
scattered: false |
| 104 |
value: 0 |
| 105 |
- address: 0x1c |
| 106 |
symbolnum: 1 |
| 107 |
pcrel: true |
| 108 |
length: 3 |
| 109 |
extern: true |
| 110 |
type: 0 |
| 111 |
scattered: false |
| 112 |
value: 0 |
| 113 |
- cmd: LC_SYMTAB |
| 114 |
cmdsize: 24 |
| 115 |
symoff: 0x700 |
| 116 |
nsyms: 2 |
| 117 |
stroff: 0x720 |
| 118 |
strsize: 10 |
| 119 |
LinkEditData: |
| 120 |
NameList: |
| 121 |
- n_strx: 1 |
| 122 |
n_type: 0x0F |
| 123 |
n_sect: 1 |
| 124 |
n_desc: 0 |
| 125 |
n_value: 0 |
| 126 |
- n_strx: 1 |
| 127 |
n_type: 0x0F |
| 128 |
n_sect: 1 |
| 129 |
n_desc: 0 |
| 130 |
n_value: 0 |
| 131 |
StringTable: |
| 132 |
- '' |
| 133 |
- '__Z3foov' |
| 134 |
- '' |
| 135 |
DWARF: |
| 136 |
debug_abbrev: |
| 137 |
- Table: |
| 138 |
- Tag: DW_TAG_compile_unit |
| 139 |
Children: DW_CHILDREN_yes |
| 140 |
Attributes: |
| 141 |
- Attribute: DW_AT_producer |
| 142 |
Form: DW_FORM_string |
| 143 |
- Attribute: DW_AT_language |
| 144 |
Form: DW_FORM_data2 |
| 145 |
- Attribute: DW_AT_name |
| 146 |
Form: DW_FORM_string |
| 147 |
- Attribute: DW_AT_low_pc |
| 148 |
Form: DW_FORM_addrx |
| 149 |
- Attribute: DW_AT_high_pc |
| 150 |
Form: DW_FORM_data8 |
| 151 |
- Attribute: DW_AT_addr_base |
| 152 |
Form: DW_FORM_sec_offset |
| 153 |
- Tag: DW_TAG_subprogram |
| 154 |
Children: DW_CHILDREN_yes |
| 155 |
Attributes: |
| 156 |
- Attribute: DW_AT_name |
| 157 |
Form: DW_FORM_string |
| 158 |
- Attribute: DW_AT_low_pc |
| 159 |
Form: DW_FORM_addrx |
| 160 |
- Attribute: DW_AT_high_pc |
| 161 |
Form: DW_FORM_data8 |
| 162 |
- Attribute: DW_AT_type |
| 163 |
Form: DW_FORM_ref4 |
| 164 |
- Tag: DW_TAG_base_type |
| 165 |
Children: DW_CHILDREN_no |
| 166 |
Attributes: |
| 167 |
- Attribute: DW_AT_name |
| 168 |
Form: DW_FORM_string |
| 169 |
- Tag: DW_TAG_variable |
| 170 |
Children: DW_CHILDREN_no |
| 171 |
Attributes: |
| 172 |
- Attribute: DW_AT_name |
| 173 |
Form: DW_FORM_string |
| 174 |
- Attribute: DW_AT_type |
| 175 |
Form: DW_FORM_ref4 |
| 176 |
- Attribute: DW_AT_location |
| 177 |
Form: DW_FORM_exprloc |
| 178 |
- Table: |
| 179 |
- Tag: DW_TAG_compile_unit |
| 180 |
Children: DW_CHILDREN_yes |
| 181 |
Attributes: |
| 182 |
- Attribute: DW_AT_producer |
| 183 |
Form: DW_FORM_string |
| 184 |
- Attribute: DW_AT_language |
| 185 |
Form: DW_FORM_data2 |
| 186 |
- Attribute: DW_AT_name |
| 187 |
Form: DW_FORM_string |
| 188 |
- Attribute: DW_AT_low_pc |
| 189 |
Form: DW_FORM_addrx |
| 190 |
- Attribute: DW_AT_high_pc |
| 191 |
Form: DW_FORM_data8 |
| 192 |
- Tag: DW_TAG_subprogram |
| 193 |
Children: DW_CHILDREN_yes |
| 194 |
Attributes: |
| 195 |
- Attribute: DW_AT_name |
| 196 |
Form: DW_FORM_string |
| 197 |
- Attribute: DW_AT_low_pc |
| 198 |
Form: DW_FORM_addrx |
| 199 |
- Attribute: DW_AT_high_pc |
| 200 |
Form: DW_FORM_data8 |
| 201 |
- Attribute: DW_AT_type |
| 202 |
Form: DW_FORM_ref4 |
| 203 |
- Tag: DW_TAG_base_type |
| 204 |
Children: DW_CHILDREN_no |
| 205 |
Attributes: |
| 206 |
- Attribute: DW_AT_name |
| 207 |
Form: DW_FORM_string |
| 208 |
- Tag: DW_TAG_variable |
| 209 |
Children: DW_CHILDREN_no |
| 210 |
Attributes: |
| 211 |
- Attribute: DW_AT_name |
| 212 |
Form: DW_FORM_string |
| 213 |
- Attribute: DW_AT_type |
| 214 |
Form: DW_FORM_ref4 |
| 215 |
- Attribute: DW_AT_location |
| 216 |
Form: DW_FORM_exprloc |
| 217 |
debug_info: |
| 218 |
- Version: 5 |
| 219 |
UnitType: DW_UT_compile |
| 220 |
Entries: |
| 221 |
- AbbrCode: 1 |
| 222 |
Values: |
| 223 |
- CStr: by_hand |
| 224 |
- Value: 0x04 |
| 225 |
- CStr: GoodCU |
| 226 |
- Value: 0x0 |
| 227 |
- Value: 0x10 |
| 228 |
- Value: 0x8 |
| 229 |
- AbbrCode: 2 |
| 230 |
Values: |
| 231 |
- CStr: foo |
| 232 |
- Value: 0x0 |
| 233 |
- Value: 0x10 |
| 234 |
- Value: 0x3e |
| 235 |
- AbbrCode: 0 |
| 236 |
- AbbrCode: 3 |
| 237 |
Values: |
| 238 |
- CStr: int |
| 239 |
- AbbrCode: 4 |
| 240 |
Values: |
| 241 |
- CStr: var1 |
| 242 |
- Value: 0x0000003e |
| 243 |
- BlockData: |
| 244 |
- 0xa1 |
| 245 |
- 0x00 |
| 246 |
- AbbrCode: 0 |
| 247 |
- Version: 5 |
| 248 |
UnitType: DW_UT_compile |
| 249 |
Entries: |
| 250 |
- AbbrCode: 1 |
| 251 |
Values: |
| 252 |
- CStr: by_hand |
| 253 |
- Value: 0x04 |
| 254 |
- CStr: BadCU |
| 255 |
- Value: 0x0 |
| 256 |
- Value: 0x10 |
| 257 |
- AbbrCode: 2 |
| 258 |
Values: |
| 259 |
- CStr: foo1 |
| 260 |
- Value: 0x0 |
| 261 |
- Value: 0x10 |
| 262 |
- Value: 0x3e |
| 263 |
- AbbrCode: 0 |
| 264 |
- AbbrCode: 3 |
| 265 |
Values: |
| 266 |
- CStr: int |
| 267 |
- AbbrCode: 4 |
| 268 |
Values: |
| 269 |
- CStr: var1 |
| 270 |
- Value: 0x0000003e |
| 271 |
- BlockData: |
| 272 |
- 0xa1 |
| 273 |
- 0x00 |
| 274 |
- AbbrCode: 0 |
| 275 |
debug_addr: |
| 276 |
- Version: 5 |
| 277 |
AddressSize: 0x08 |
| 278 |
Entries: |
| 279 |
- Address: 0x1130 |
| 280 |
- Version: 5 |
| 281 |
AddressSize: 0x08 |
| 282 |
Entries: |
| 283 |
- Address: 0x10 |
| 284 |
... |