Skip to content

Commit 0620647

Browse files
committed
Dwarf: remove redundant debug info
1 parent 0ff0bdb commit 0620647

File tree

3 files changed

+28
-68
lines changed

3 files changed

+28
-68
lines changed

lib/std/dwarf/AT.zig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ pub const ZIG_padding = 0x2cce;
225225
pub const ZIG_relative_decl = 0x2cd0;
226226
pub const ZIG_decl_line_relative = 0x2cd1;
227227
pub const ZIG_comptime_value = 0x2cd2;
228-
pub const ZIG_comptime_default_value = 0x2cd3;
229228
pub const ZIG_sentinel = 0x2ce2;
230229

231230
// UPC extension.

src/link/Dwarf.zig

Lines changed: 27 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2687,23 +2687,19 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
26872687
},
26882688
};
26892689
try wip_nav.abbrevCode(if (is_comptime)
2690-
if (has_runtime_bits and has_comptime_state)
2691-
.struct_field_comptime_runtime_bits_comptime_state
2692-
else if (has_comptime_state)
2690+
if (has_comptime_state)
26932691
.struct_field_comptime_comptime_state
26942692
else if (has_runtime_bits)
26952693
.struct_field_comptime_runtime_bits
26962694
else
26972695
.struct_field_comptime
26982696
else if (field_init != .none)
2699-
if (has_runtime_bits and has_comptime_state)
2700-
.struct_field_default_runtime_bits_comptime_state
2701-
else if (has_comptime_state)
2697+
if (has_comptime_state)
27022698
.struct_field_default_comptime_state
27032699
else if (has_runtime_bits)
27042700
.struct_field_default_runtime_bits
27052701
else
2706-
.struct_field_default
2702+
.struct_field
27072703
else
27082704
.struct_field);
27092705
if (loaded_struct.fieldName(ip, field_index).unwrap()) |field_name| try wip_nav.strp(field_name.toSlice(ip)) else {
@@ -2717,8 +2713,10 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
27172713
try uleb128(diw, loaded_struct.fieldAlign(ip, field_index).toByteUnits() orelse
27182714
field_type.abiAlignment(zcu).toByteUnits().?);
27192715
}
2720-
if (has_runtime_bits) try wip_nav.blockValue(nav_src_loc, .fromInterned(field_init));
2721-
if (has_comptime_state) try wip_nav.refValue(.fromInterned(field_init));
2716+
if (has_comptime_state)
2717+
try wip_nav.refValue(.fromInterned(field_init))
2718+
else if (has_runtime_bits)
2719+
try wip_nav.blockValue(nav_src_loc, .fromInterned(field_init));
27222720
}
27232721
try uleb128(diw, @intFromEnum(AbbrevCode.null));
27242722
}
@@ -3363,9 +3361,7 @@ fn updateLazyType(
33633361
field_type.comptimeOnly(zcu) and try field_type.onePossibleValue(pt) == null,
33643362
},
33653363
};
3366-
try wip_nav.abbrevCode(if (has_runtime_bits and has_comptime_state)
3367-
.struct_field_comptime_runtime_bits_comptime_state
3368-
else if (has_comptime_state)
3364+
try wip_nav.abbrevCode(if (has_comptime_state)
33693365
.struct_field_comptime_comptime_state
33703366
else if (has_runtime_bits)
33713367
.struct_field_comptime_runtime_bits
@@ -3386,8 +3382,10 @@ fn updateLazyType(
33863382
try uleb128(diw, field_type.abiAlignment(zcu).toByteUnits().?);
33873383
field_byte_offset += field_type.abiSize(zcu);
33883384
}
3389-
if (has_runtime_bits) try wip_nav.blockValue(src_loc, .fromInterned(comptime_value));
3390-
if (has_comptime_state) try wip_nav.refValue(.fromInterned(comptime_value));
3385+
if (has_comptime_state)
3386+
try wip_nav.refValue(.fromInterned(comptime_value))
3387+
else if (has_runtime_bits)
3388+
try wip_nav.blockValue(src_loc, .fromInterned(comptime_value));
33913389
}
33923390
try uleb128(diw, @intFromEnum(AbbrevCode.null));
33933391
},
@@ -3956,23 +3954,19 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP
39563954
},
39573955
};
39583956
try wip_nav.abbrevCode(if (is_comptime)
3959-
if (has_runtime_bits and has_comptime_state)
3960-
.struct_field_comptime_runtime_bits_comptime_state
3961-
else if (has_comptime_state)
3957+
if (has_comptime_state)
39623958
.struct_field_comptime_comptime_state
39633959
else if (has_runtime_bits)
39643960
.struct_field_comptime_runtime_bits
39653961
else
39663962
.struct_field_comptime
39673963
else if (field_init != .none)
3968-
if (has_runtime_bits and has_comptime_state)
3969-
.struct_field_default_runtime_bits_comptime_state
3970-
else if (has_comptime_state)
3964+
if (has_comptime_state)
39713965
.struct_field_default_comptime_state
39723966
else if (has_runtime_bits)
39733967
.struct_field_default_runtime_bits
39743968
else
3975-
.struct_field_default
3969+
.struct_field
39763970
else
39773971
.struct_field);
39783972
if (loaded_struct.fieldName(ip, field_index).unwrap()) |field_name| try wip_nav.strp(field_name.toSlice(ip)) else {
@@ -3986,8 +3980,10 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP
39863980
try uleb128(diw, loaded_struct.fieldAlign(ip, field_index).toByteUnits() orelse
39873981
field_type.abiAlignment(zcu).toByteUnits().?);
39883982
}
3989-
if (has_runtime_bits) try wip_nav.blockValue(ty_src_loc, .fromInterned(field_init));
3990-
if (has_comptime_state) try wip_nav.refValue(.fromInterned(field_init));
3983+
if (has_comptime_state)
3984+
try wip_nav.refValue(.fromInterned(field_init))
3985+
else if (has_runtime_bits)
3986+
try wip_nav.blockValue(ty_src_loc, .fromInterned(field_init));
39913987
}
39923988
try uleb128(diw, @intFromEnum(AbbrevCode.null));
39933989
}
@@ -4064,23 +4060,19 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP
40644060
},
40654061
};
40664062
try wip_nav.abbrevCode(if (is_comptime)
4067-
if (has_runtime_bits and has_comptime_state)
4068-
.struct_field_comptime_runtime_bits_comptime_state
4069-
else if (has_comptime_state)
4063+
if (has_comptime_state)
40704064
.struct_field_comptime_comptime_state
40714065
else if (has_runtime_bits)
40724066
.struct_field_comptime_runtime_bits
40734067
else
40744068
.struct_field_comptime
40754069
else if (field_init != .none)
4076-
if (has_runtime_bits and has_comptime_state)
4077-
.struct_field_default_runtime_bits_comptime_state
4078-
else if (has_comptime_state)
4070+
if (has_comptime_state)
40794071
.struct_field_default_comptime_state
40804072
else if (has_runtime_bits)
40814073
.struct_field_default_runtime_bits
40824074
else
4083-
.struct_field_default
4075+
.struct_field
40844076
else
40854077
.struct_field);
40864078
if (loaded_struct.fieldName(ip, field_index).unwrap()) |field_name| try wip_nav.strp(field_name.toSlice(ip)) else {
@@ -4094,8 +4086,10 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP
40944086
try uleb128(diw, loaded_struct.fieldAlign(ip, field_index).toByteUnits() orelse
40954087
field_type.abiAlignment(zcu).toByteUnits().?);
40964088
}
4097-
if (has_runtime_bits) try wip_nav.blockValue(ty_src_loc, .fromInterned(field_init));
4098-
if (has_comptime_state) try wip_nav.refValue(.fromInterned(field_init));
4089+
if (has_comptime_state)
4090+
try wip_nav.refValue(.fromInterned(field_init))
4091+
else if (has_runtime_bits)
4092+
try wip_nav.blockValue(ty_src_loc, .fromInterned(field_init));
40994093
}
41004094
try uleb128(diw, @intFromEnum(AbbrevCode.null));
41014095
}
@@ -4680,14 +4674,11 @@ const AbbrevCode = enum {
46804674
big_enum_field,
46814675
generated_field,
46824676
struct_field,
4683-
struct_field_default,
46844677
struct_field_default_runtime_bits,
46854678
struct_field_default_comptime_state,
4686-
struct_field_default_runtime_bits_comptime_state,
46874679
struct_field_comptime,
46884680
struct_field_comptime_runtime_bits,
46894681
struct_field_comptime_comptime_state,
4690-
struct_field_comptime_runtime_bits_comptime_state,
46914682
packed_struct_field,
46924683
untagged_union_field,
46934684
tagged_union,
@@ -4980,15 +4971,6 @@ const AbbrevCode = enum {
49804971
.{ .alignment, .udata },
49814972
},
49824973
},
4983-
.struct_field_default = .{
4984-
.tag = .member,
4985-
.attrs = &.{
4986-
.{ .name, .strp },
4987-
.{ .type, .ref_addr },
4988-
.{ .data_member_location, .udata },
4989-
.{ .alignment, .udata },
4990-
},
4991-
},
49924974
.struct_field_default_runtime_bits = .{
49934975
.tag = .member,
49944976
.attrs = &.{
@@ -5006,18 +4988,7 @@ const AbbrevCode = enum {
50064988
.{ .type, .ref_addr },
50074989
.{ .data_member_location, .udata },
50084990
.{ .alignment, .udata },
5009-
.{ .ZIG_comptime_default_value, .ref_addr },
5010-
},
5011-
},
5012-
.struct_field_default_runtime_bits_comptime_state = .{
5013-
.tag = .member,
5014-
.attrs = &.{
5015-
.{ .name, .strp },
5016-
.{ .type, .ref_addr },
5017-
.{ .data_member_location, .udata },
5018-
.{ .alignment, .udata },
5019-
.{ .default_value, .block },
5020-
.{ .ZIG_comptime_default_value, .ref_addr },
4991+
.{ .ZIG_comptime_value, .ref_addr },
50214992
},
50224993
},
50234994
.struct_field_comptime = .{
@@ -5046,16 +5017,6 @@ const AbbrevCode = enum {
50465017
.{ .ZIG_comptime_value, .ref_addr },
50475018
},
50485019
},
5049-
.struct_field_comptime_runtime_bits_comptime_state = .{
5050-
.tag = .member,
5051-
.attrs = &.{
5052-
.{ .const_expr, .flag_present },
5053-
.{ .name, .strp },
5054-
.{ .type, .ref_addr },
5055-
.{ .const_value, .block },
5056-
.{ .ZIG_comptime_value, .ref_addr },
5057-
},
5058-
},
50595020
.packed_struct_field = .{
50605021
.tag = .member,
50615022
.attrs = &.{

tools/lldb_pretty_printers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ class root_InternPool_Local_List_SynthProvider:
702702
def __init__(self, value, _=None): self.value = value
703703
def update(self):
704704
capacity = self.value.EvaluateExpression('@as(*@This().Header, @alignCast(@ptrCast(@this().bytes - @This().bytes_offset))).capacity')
705-
self.view = create_struct('view', self.value.EvaluateExpression('@This().View').GetValueAsType(), bytes=self.value.GetChildMemberWithName('bytes'), len=capacity, capacity=capacity).GetNonSyntheticValue()
705+
self.view = create_struct('view', self.value.type.FindDirectNestedType('View'), bytes=self.value.GetChildMemberWithName('bytes'), len=capacity, capacity=capacity).GetNonSyntheticValue()
706706
def has_children(self): return True
707707
def num_children(self): return 1
708708
def get_child_index(self, name):

0 commit comments

Comments
 (0)