authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-12-18 06:15:42-05:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-12-19 17:10:03-05:00
log06206479a91be3cac9d5169b61c8691744fd5135
tree975d55ba0c9f88e8c013e07db83ad1367338ed83
parent0ff0bdb4a71d8fd055272abfdadea2f23f99574a

Dwarf: remove redundant debug info


3 files changed, 28 insertions(+), 68 deletions(-)

lib/std/dwarf/AT.zig-1
...@@ -225,7 +225,6 @@ pub const ZIG_padding = 0x2cce;...@@ -225,7 +225,6 @@ pub const ZIG_padding = 0x2cce;
225pub const ZIG_relative_decl = 0x2cd0;225pub const ZIG_relative_decl = 0x2cd0;
226pub const ZIG_decl_line_relative = 0x2cd1;226pub const ZIG_decl_line_relative = 0x2cd1;
227pub const ZIG_comptime_value = 0x2cd2;227pub const ZIG_comptime_value = 0x2cd2;
228pub const ZIG_comptime_default_value = 0x2cd3;
229pub const ZIG_sentinel = 0x2ce2;228pub const ZIG_sentinel = 0x2ce2;
230229
231// UPC extension.230// UPC extension.
src/link/Dwarf.zig+27-66
...@@ -2687,23 +2687,19 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool...@@ -2687,23 +2687,19 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
2687 },2687 },
2688 };2688 };
2689 try wip_nav.abbrevCode(if (is_comptime)2689 try wip_nav.abbrevCode(if (is_comptime)
2690 if (has_runtime_bits and has_comptime_state)2690 if (has_comptime_state)
2691 .struct_field_comptime_runtime_bits_comptime_state
2692 else if (has_comptime_state)
2693 .struct_field_comptime_comptime_state2691 .struct_field_comptime_comptime_state
2694 else if (has_runtime_bits)2692 else if (has_runtime_bits)
2695 .struct_field_comptime_runtime_bits2693 .struct_field_comptime_runtime_bits
2696 else2694 else
2697 .struct_field_comptime2695 .struct_field_comptime
2698 else if (field_init != .none)2696 else if (field_init != .none)
2699 if (has_runtime_bits and has_comptime_state)2697 if (has_comptime_state)
2700 .struct_field_default_runtime_bits_comptime_state
2701 else if (has_comptime_state)
2702 .struct_field_default_comptime_state2698 .struct_field_default_comptime_state
2703 else if (has_runtime_bits)2699 else if (has_runtime_bits)
2704 .struct_field_default_runtime_bits2700 .struct_field_default_runtime_bits
2705 else2701 else
2706 .struct_field_default2702 .struct_field
2707 else2703 else
2708 .struct_field);2704 .struct_field);
2709 if (loaded_struct.fieldName(ip, field_index).unwrap()) |field_name| try wip_nav.strp(field_name.toSlice(ip)) else {2705 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...@@ -2717,8 +2713,10 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
2717 try uleb128(diw, loaded_struct.fieldAlign(ip, field_index).toByteUnits() orelse2713 try uleb128(diw, loaded_struct.fieldAlign(ip, field_index).toByteUnits() orelse
2718 field_type.abiAlignment(zcu).toByteUnits().?);2714 field_type.abiAlignment(zcu).toByteUnits().?);
2719 }2715 }
2720 if (has_runtime_bits) try wip_nav.blockValue(nav_src_loc, .fromInterned(field_init));2716 if (has_comptime_state)
2721 if (has_comptime_state) try wip_nav.refValue(.fromInterned(field_init));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));
2722 }2720 }
2723 try uleb128(diw, @intFromEnum(AbbrevCode.null));2721 try uleb128(diw, @intFromEnum(AbbrevCode.null));
2724 }2722 }
...@@ -3363,9 +3361,7 @@ fn updateLazyType(...@@ -3363,9 +3361,7 @@ fn updateLazyType(
3363 field_type.comptimeOnly(zcu) and try field_type.onePossibleValue(pt) == null,3361 field_type.comptimeOnly(zcu) and try field_type.onePossibleValue(pt) == null,
3364 },3362 },
3365 };3363 };
3366 try wip_nav.abbrevCode(if (has_runtime_bits and has_comptime_state)3364 try wip_nav.abbrevCode(if (has_comptime_state)
3367 .struct_field_comptime_runtime_bits_comptime_state
3368 else if (has_comptime_state)
3369 .struct_field_comptime_comptime_state3365 .struct_field_comptime_comptime_state
3370 else if (has_runtime_bits)3366 else if (has_runtime_bits)
3371 .struct_field_comptime_runtime_bits3367 .struct_field_comptime_runtime_bits
...@@ -3386,8 +3382,10 @@ fn updateLazyType(...@@ -3386,8 +3382,10 @@ fn updateLazyType(
3386 try uleb128(diw, field_type.abiAlignment(zcu).toByteUnits().?);3382 try uleb128(diw, field_type.abiAlignment(zcu).toByteUnits().?);
3387 field_byte_offset += field_type.abiSize(zcu);3383 field_byte_offset += field_type.abiSize(zcu);
3388 }3384 }
3389 if (has_runtime_bits) try wip_nav.blockValue(src_loc, .fromInterned(comptime_value));3385 if (has_comptime_state)
3390 if (has_comptime_state) try wip_nav.refValue(.fromInterned(comptime_value));3386 try wip_nav.refValue(.fromInterned(comptime_value))
3387 else if (has_runtime_bits)
3388 try wip_nav.blockValue(src_loc, .fromInterned(comptime_value));
3391 }3389 }
3392 try uleb128(diw, @intFromEnum(AbbrevCode.null));3390 try uleb128(diw, @intFromEnum(AbbrevCode.null));
3393 },3391 },
...@@ -3956,23 +3954,19 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP...@@ -3956,23 +3954,19 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP
3956 },3954 },
3957 };3955 };
3958 try wip_nav.abbrevCode(if (is_comptime)3956 try wip_nav.abbrevCode(if (is_comptime)
3959 if (has_runtime_bits and has_comptime_state)3957 if (has_comptime_state)
3960 .struct_field_comptime_runtime_bits_comptime_state
3961 else if (has_comptime_state)
3962 .struct_field_comptime_comptime_state3958 .struct_field_comptime_comptime_state
3963 else if (has_runtime_bits)3959 else if (has_runtime_bits)
3964 .struct_field_comptime_runtime_bits3960 .struct_field_comptime_runtime_bits
3965 else3961 else
3966 .struct_field_comptime3962 .struct_field_comptime
3967 else if (field_init != .none)3963 else if (field_init != .none)
3968 if (has_runtime_bits and has_comptime_state)3964 if (has_comptime_state)
3969 .struct_field_default_runtime_bits_comptime_state
3970 else if (has_comptime_state)
3971 .struct_field_default_comptime_state3965 .struct_field_default_comptime_state
3972 else if (has_runtime_bits)3966 else if (has_runtime_bits)
3973 .struct_field_default_runtime_bits3967 .struct_field_default_runtime_bits
3974 else3968 else
3975 .struct_field_default3969 .struct_field
3976 else3970 else
3977 .struct_field);3971 .struct_field);
3978 if (loaded_struct.fieldName(ip, field_index).unwrap()) |field_name| try wip_nav.strp(field_name.toSlice(ip)) else {3972 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...@@ -3986,8 +3980,10 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP
3986 try uleb128(diw, loaded_struct.fieldAlign(ip, field_index).toByteUnits() orelse3980 try uleb128(diw, loaded_struct.fieldAlign(ip, field_index).toByteUnits() orelse
3987 field_type.abiAlignment(zcu).toByteUnits().?);3981 field_type.abiAlignment(zcu).toByteUnits().?);
3988 }3982 }
3989 if (has_runtime_bits) try wip_nav.blockValue(ty_src_loc, .fromInterned(field_init));3983 if (has_comptime_state)
3990 if (has_comptime_state) try wip_nav.refValue(.fromInterned(field_init));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));
3991 }3987 }
3992 try uleb128(diw, @intFromEnum(AbbrevCode.null));3988 try uleb128(diw, @intFromEnum(AbbrevCode.null));
3993 }3989 }
...@@ -4064,23 +4060,19 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP...@@ -4064,23 +4060,19 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP
4064 },4060 },
4065 };4061 };
4066 try wip_nav.abbrevCode(if (is_comptime)4062 try wip_nav.abbrevCode(if (is_comptime)
4067 if (has_runtime_bits and has_comptime_state)4063 if (has_comptime_state)
4068 .struct_field_comptime_runtime_bits_comptime_state
4069 else if (has_comptime_state)
4070 .struct_field_comptime_comptime_state4064 .struct_field_comptime_comptime_state
4071 else if (has_runtime_bits)4065 else if (has_runtime_bits)
4072 .struct_field_comptime_runtime_bits4066 .struct_field_comptime_runtime_bits
4073 else4067 else
4074 .struct_field_comptime4068 .struct_field_comptime
4075 else if (field_init != .none)4069 else if (field_init != .none)
4076 if (has_runtime_bits and has_comptime_state)4070 if (has_comptime_state)
4077 .struct_field_default_runtime_bits_comptime_state
4078 else if (has_comptime_state)
4079 .struct_field_default_comptime_state4071 .struct_field_default_comptime_state
4080 else if (has_runtime_bits)4072 else if (has_runtime_bits)
4081 .struct_field_default_runtime_bits4073 .struct_field_default_runtime_bits
4082 else4074 else
4083 .struct_field_default4075 .struct_field
4084 else4076 else
4085 .struct_field);4077 .struct_field);
4086 if (loaded_struct.fieldName(ip, field_index).unwrap()) |field_name| try wip_nav.strp(field_name.toSlice(ip)) else {4078 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...@@ -4094,8 +4086,10 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP
4094 try uleb128(diw, loaded_struct.fieldAlign(ip, field_index).toByteUnits() orelse4086 try uleb128(diw, loaded_struct.fieldAlign(ip, field_index).toByteUnits() orelse
4095 field_type.abiAlignment(zcu).toByteUnits().?);4087 field_type.abiAlignment(zcu).toByteUnits().?);
4096 }4088 }
4097 if (has_runtime_bits) try wip_nav.blockValue(ty_src_loc, .fromInterned(field_init));4089 if (has_comptime_state)
4098 if (has_comptime_state) try wip_nav.refValue(.fromInterned(field_init));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));
4099 }4093 }
4100 try uleb128(diw, @intFromEnum(AbbrevCode.null));4094 try uleb128(diw, @intFromEnum(AbbrevCode.null));
4101 }4095 }
...@@ -4680,14 +4674,11 @@ const AbbrevCode = enum {...@@ -4680,14 +4674,11 @@ const AbbrevCode = enum {
4680 big_enum_field,4674 big_enum_field,
4681 generated_field,4675 generated_field,
4682 struct_field,4676 struct_field,
4683 struct_field_default,
4684 struct_field_default_runtime_bits,4677 struct_field_default_runtime_bits,
4685 struct_field_default_comptime_state,4678 struct_field_default_comptime_state,
4686 struct_field_default_runtime_bits_comptime_state,
4687 struct_field_comptime,4679 struct_field_comptime,
4688 struct_field_comptime_runtime_bits,4680 struct_field_comptime_runtime_bits,
4689 struct_field_comptime_comptime_state,4681 struct_field_comptime_comptime_state,
4690 struct_field_comptime_runtime_bits_comptime_state,
4691 packed_struct_field,4682 packed_struct_field,
4692 untagged_union_field,4683 untagged_union_field,
4693 tagged_union,4684 tagged_union,
...@@ -4980,15 +4971,6 @@ const AbbrevCode = enum {...@@ -4980,15 +4971,6 @@ const AbbrevCode = enum {
4980 .{ .alignment, .udata },4971 .{ .alignment, .udata },
4981 },4972 },
4982 },4973 },
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 },
4992 .struct_field_default_runtime_bits = .{4974 .struct_field_default_runtime_bits = .{
4993 .tag = .member,4975 .tag = .member,
4994 .attrs = &.{4976 .attrs = &.{
...@@ -5006,18 +4988,7 @@ const AbbrevCode = enum {...@@ -5006,18 +4988,7 @@ const AbbrevCode = enum {
5006 .{ .type, .ref_addr },4988 .{ .type, .ref_addr },
5007 .{ .data_member_location, .udata },4989 .{ .data_member_location, .udata },
5008 .{ .alignment, .udata },4990 .{ .alignment, .udata },
5009 .{ .ZIG_comptime_default_value, .ref_addr },4991 .{ .ZIG_comptime_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 },
5021 },4992 },
5022 },4993 },
5023 .struct_field_comptime = .{4994 .struct_field_comptime = .{
...@@ -5046,16 +5017,6 @@ const AbbrevCode = enum {...@@ -5046,16 +5017,6 @@ const AbbrevCode = enum {
5046 .{ .ZIG_comptime_value, .ref_addr },5017 .{ .ZIG_comptime_value, .ref_addr },
5047 },5018 },
5048 },5019 },
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 },
5059 .packed_struct_field = .{5020 .packed_struct_field = .{
5060 .tag = .member,5021 .tag = .member,
5061 .attrs = &.{5022 .attrs = &.{
tools/lldb_pretty_printers.py+1-1
...@@ -702,7 +702,7 @@ class root_InternPool_Local_List_SynthProvider:...@@ -702,7 +702,7 @@ class root_InternPool_Local_List_SynthProvider:
702 def __init__(self, value, _=None): self.value = value702 def __init__(self, value, _=None): self.value = value
703 def update(self):703 def update(self):
704 capacity = self.value.EvaluateExpression('@as(*@This().Header, @alignCast(@ptrCast(@this().bytes - @This().bytes_offset))).capacity')704 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()
706 def has_children(self): return True706 def has_children(self): return True
707 def num_children(self): return 1707 def num_children(self): return 1
708 def get_child_index(self, name):708 def get_child_index(self, name):