File tree 1 file changed +4
-2
lines changed 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -243,11 +243,13 @@ pub const DeclState = struct {
243
243
.Pointer = > {
244
244
if (ty .isSlice ()) {
245
245
// Slices are structs: struct { .ptr = *, .len = N }
246
+ const ptr_bits = target .cpu .arch .ptrBitWidth ();
247
+ const ptr_bytes = @intCast (u8 , @divExact (ptr_bits , 8 ));
246
248
// DW.AT.structure_type
247
249
try dbg_info_buffer .ensureUnusedCapacity (2 );
248
250
dbg_info_buffer .appendAssumeCapacity (@enumToInt (AbbrevKind .struct_type ));
249
251
// DW.AT.byte_size, DW.FORM.sdata
250
- dbg_info_buffer .appendAssumeCapacity (@sizeOf ( usize ) * 2 );
252
+ dbg_info_buffer .appendAssumeCapacity (ptr_bytes * 2 );
251
253
// DW.AT.name, DW.FORM.string
252
254
try dbg_info_buffer .writer ().print ("{}\x00 " , .{ty .fmt (module )});
253
255
// DW.AT.member
@@ -276,7 +278,7 @@ pub const DeclState = struct {
276
278
try self .addTypeRelocGlobal (atom , Type .usize , @intCast (u32 , index ));
277
279
// DW.AT.data_member_location, DW.FORM.sdata
278
280
try dbg_info_buffer .ensureUnusedCapacity (2 );
279
- dbg_info_buffer .appendAssumeCapacity (@sizeOf ( usize ) );
281
+ dbg_info_buffer .appendAssumeCapacity (ptr_bytes );
280
282
// DW.AT.structure_type delimit children
281
283
dbg_info_buffer .appendAssumeCapacity (0 );
282
284
} else {
You can’t perform that action at this time.
0 commit comments