| ... | @@ -270,6 +270,27 @@ pub const DeclState = struct { | ... | @@ -270,6 +270,27 @@ pub const DeclState = struct { |
| 270 | try self.addTypeReloc(atom, ty.childType(), @intCast(u32, index), null); | 270 | try self.addTypeReloc(atom, ty.childType(), @intCast(u32, index), null); |
| 271 | } | 271 | } |
| 272 | }, | 272 | }, |
| | 273 | .Array => { |
| | 274 | // DW.AT.array_type |
| | 275 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.array_type)); |
| | 276 | // DW.AT.name, DW.FORM.string |
| | 277 | try dbg_info_buffer.writer().print("{}\x00", .{ty.fmt(target)}); |
| | 278 | // DW.AT.type, DW.FORM.ref4 |
| | 279 | var index = dbg_info_buffer.items.len; |
| | 280 | try dbg_info_buffer.resize(index + 4); |
| | 281 | try self.addTypeReloc(atom, ty.childType(), @intCast(u32, index), null); |
| | 282 | // DW.AT.subrange_type |
| | 283 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.array_dim)); |
| | 284 | // DW.AT.type, DW.FORM.ref4 |
| | 285 | index = dbg_info_buffer.items.len; |
| | 286 | try dbg_info_buffer.resize(index + 4); |
| | 287 | try self.addTypeReloc(atom, Type.usize, @intCast(u32, index), null); |
| | 288 | // DW.AT.count, DW.FORM.udata |
| | 289 | const len = ty.arrayLenIncludingSentinel(); |
| | 290 | try leb128.writeULEB128(dbg_info_buffer.writer(), len); |
| | 291 | // DW.AT.array_type delimit children |
| | 292 | try dbg_info_buffer.append(0); |
| | 293 | }, |
| 273 | .Struct => blk: { | 294 | .Struct => blk: { |
| 274 | // DW.AT.structure_type | 295 | // DW.AT.structure_type |
| 275 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.struct_type)); | 296 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.struct_type)); |
| ... | @@ -564,6 +585,8 @@ pub const AbbrevKind = enum(u8) { | ... | @@ -564,6 +585,8 @@ pub const AbbrevKind = enum(u8) { |
| 564 | pad1, | 585 | pad1, |
| 565 | parameter, | 586 | parameter, |
| 566 | variable, | 587 | variable, |
| | 588 | array_type, |
| | 589 | array_dim, |
| 567 | }; | 590 | }; |
| 568 | | 591 | |
| 569 | /// The reloc offset for the virtual address of a function in its Line Number Program. | 592 | /// The reloc offset for the virtual address of a function in its Line Number Program. |
| ... | @@ -1357,6 +1380,18 @@ pub fn writeDbgAbbrev(self: *Dwarf, file: *File) !void { | ... | @@ -1357,6 +1380,18 @@ pub fn writeDbgAbbrev(self: *Dwarf, file: *File) !void { |
| 1357 | DW.AT.name, DW.FORM.string, | 1380 | DW.AT.name, DW.FORM.string, |
| 1358 | 0, | 1381 | 0, |
| 1359 | 0, // table sentinel | 1382 | 0, // table sentinel |
| | 1383 | @enumToInt(AbbrevKind.array_type), |
| | 1384 | DW.TAG.array_type, DW.CHILDREN.yes, // header |
| | 1385 | DW.AT.name, DW.FORM.string, |
| | 1386 | DW.AT.type, DW.FORM.ref4, |
| | 1387 | 0, |
| | 1388 | 0, // table sentinel |
| | 1389 | @enumToInt(AbbrevKind.array_dim), |
| | 1390 | DW.TAG.subrange_type, DW.CHILDREN.no, // header |
| | 1391 | DW.AT.type, DW.FORM.ref4, |
| | 1392 | DW.AT.count, DW.FORM.udata, |
| | 1393 | 0, |
| | 1394 | 0, // table sentinel |
| 1360 | 0, | 1395 | 0, |
| 1361 | 0, | 1396 | 0, |
| 1362 | 0, // section sentinel | 1397 | 0, // section sentinel |