authorgravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2021-04-12 06:10:02-04:00
committergravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2021-04-12 06:12:00-04:00
log746f65f8b3ce11d67d8fd392aea8bc05a24adae6
treed2f7aef5214a541615f39a990ccb75814024079c
parent93cf9560b13619159efb3ca12eeeb13d6031ad85
signature Commit is signed but in an unrecognized format.

dwarf: fix LineNumberProgram check

- tolerate out-of-order DW_AT_ranges closes #8421

2 files changed, 1 insertions(+), 16 deletions(-)

lib/std/dwarf.zig+1-1
...@@ -208,7 +208,7 @@ const LineNumberProgram = struct {...@@ -208,7 +208,7 @@ const LineNumberProgram = struct {
208 }208 }
209209
210 pub fn checkLineMatch(self: *LineNumberProgram) !?debug.LineInfo {210 pub fn checkLineMatch(self: *LineNumberProgram) !?debug.LineInfo {
211 if (self.target_address >= self.prev_address and self.target_address < self.address) {211 if (self.prev_address > 0 and self.target_address >= self.prev_address and self.target_address < self.address) {
212 const file_entry = if (self.prev_file == 0) {212 const file_entry = if (self.prev_file == 0) {
213 return error.MissingDebugInfo;213 return error.MissingDebugInfo;
214 } else if (self.prev_file - 1 >= self.file_entries.items.len) {214 } else if (self.prev_file - 1 >= self.file_entries.items.len) {
test/stack_traces.zig-15
...@@ -20,11 +20,6 @@ pub fn addCases(cases: *tests.StackTracesContext) void {...@@ -20,11 +20,6 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
20 ,20 ,
21 },21 },
22 .ReleaseSafe = .{22 .ReleaseSafe = .{
23 .exclude = struct {
24 pub fn exclude() bool {
25 return if (std.builtin.object_format == .elf) true else false;
26 }
27 },
28 .exclude_os = .{23 .exclude_os = .{
29 .windows, // segfault24 .windows, // segfault
30 },25 },
...@@ -74,11 +69,6 @@ pub fn addCases(cases: *tests.StackTracesContext) void {...@@ -74,11 +69,6 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
74 ,69 ,
75 },70 },
76 .ReleaseSafe = .{71 .ReleaseSafe = .{
77 .exclude = struct {
78 pub fn exclude() bool {
79 return if (std.builtin.object_format == .elf) true else false;
80 }
81 },
82 .exclude_os = .{72 .exclude_os = .{
83 .windows, // segfault73 .windows, // segfault
84 },74 },
...@@ -145,11 +135,6 @@ pub fn addCases(cases: *tests.StackTracesContext) void {...@@ -145,11 +135,6 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
145 ,135 ,
146 },136 },
147 .ReleaseSafe = .{137 .ReleaseSafe = .{
148 .exclude = struct {
149 pub fn exclude() bool {
150 return if (std.builtin.object_format == .elf) true else false;
151 }
152 },
153 .exclude_os = .{138 .exclude_os = .{
154 .windows, // segfault139 .windows, // segfault
155 },140 },