authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-01-22 17:32:48-05:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-01-22 17:32:48-05:00
logb94525c45b695b116c2af69174283ad10dce6de9
treefb6c323383393f5ec00de41f5391ce5301619285
parent69c72e24d4aa2044bb9de0c101517af7afe555de
parentb8601e92524b9ea2e51b5dc8d816085b7399a08c
signature Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #4263 from LemonBoy/debug-thing

Refactor some debug stuff

3 files changed, 183 insertions(+), 162 deletions(-)

lib/std/debug.zig+77-158
...@@ -379,16 +379,7 @@ fn printSourceAtAddressWindows(di: *DebugInfo, out_stream: var, relocated_addres...@@ -379,16 +379,7 @@ fn printSourceAtAddressWindows(di: *DebugInfo, out_stream: var, relocated_addres
379 }379 }
380 } else {380 } else {
381 // we have no information to add to the address381 // we have no information to add to the address
382 if (tty_color) {382 return printLineInfo(out_stream, null, relocated_address, "???", "???", tty_color, printLineFromFileAnyOs);
383 try out_stream.print("???:?:?: ", .{});
384 setTtyColor(TtyColor.Dim);
385 try out_stream.print("0x{x} in ??? (???)", .{relocated_address});
386 setTtyColor(TtyColor.Reset);
387 try out_stream.print("\n\n\n", .{});
388 } else {
389 try out_stream.print("???:?:?: 0x{x} in ??? (???)\n\n\n", .{relocated_address});
390 }
391 return;
392 };383 };
393384
394 const mod = &di.modules[mod_index];385 const mod = &di.modules[mod_index];
...@@ -510,66 +501,15 @@ fn printSourceAtAddressWindows(di: *DebugInfo, out_stream: var, relocated_addres...@@ -510,66 +501,15 @@ fn printSourceAtAddressWindows(di: *DebugInfo, out_stream: var, relocated_addres
510 }501 }
511 };502 };
512503
513 if (tty_color) {504 try printLineInfo(
514 setTtyColor(TtyColor.White);505 out_stream,
515 if (opt_line_info) |li| {506 opt_line_info,
516 try out_stream.print("{}:{}:{}", .{ li.file_name, li.line, li.column });507 relocated_address,
517 } else {508 symbol_name,
518 try out_stream.print("???:?:?", .{});509 obj_basename,
519 }510 tty_color,
520 setTtyColor(TtyColor.Reset);511 printLineFromFileAnyOs,
521 try out_stream.print(": ", .{});512 );
522 setTtyColor(TtyColor.Dim);
523 try out_stream.print("0x{x} in {} ({})", .{ relocated_address, symbol_name, obj_basename });
524 setTtyColor(TtyColor.Reset);
525
526 if (opt_line_info) |line_info| {
527 try out_stream.print("\n", .{});
528 if (printLineFromFileAnyOs(out_stream, line_info)) {
529 if (line_info.column == 0) {
530 try out_stream.write("\n");
531 } else {
532 {
533 var col_i: usize = 1;
534 while (col_i < line_info.column) : (col_i += 1) {
535 try out_stream.writeByte(' ');
536 }
537 }
538 setTtyColor(TtyColor.Green);
539 try out_stream.write("^");
540 setTtyColor(TtyColor.Reset);
541 try out_stream.write("\n");
542 }
543 } else |err| switch (err) {
544 error.EndOfFile => {},
545 error.FileNotFound => {
546 setTtyColor(TtyColor.Dim);
547 try out_stream.write("file not found\n\n");
548 setTtyColor(TtyColor.White);
549 },
550 else => return err,
551 }
552 } else {
553 try out_stream.print("\n\n\n", .{});
554 }
555 } else {
556 if (opt_line_info) |li| {
557 try out_stream.print("{}:{}:{}: 0x{x} in {} ({})\n\n\n", .{
558 li.file_name,
559 li.line,
560 li.column,
561 relocated_address,
562 symbol_name,
563 obj_basename,
564 });
565 } else {
566 try out_stream.print("???:?:?: 0x{x} in {} ({})\n\n\n", .{
567 relocated_address,
568 symbol_name,
569 obj_basename,
570 });
571 }
572 }
573}513}
574514
575const TtyColor = enum {515const TtyColor = enum {
...@@ -605,7 +545,11 @@ fn setTtyColor(tty_color: TtyColor) void {...@@ -605,7 +545,11 @@ fn setTtyColor(tty_color: TtyColor) void {
605 stderr_file.write(RESET) catch return;545 stderr_file.write(RESET) catch return;
606 },546 },
607 }547 }
608 } else {548
549 return;
550 }
551
552 if (builtin.os == .windows) {
609 const S = struct {553 const S = struct {
610 var attrs: windows.WORD = undefined;554 var attrs: windows.WORD = undefined;
611 var init_attrs = false;555 var init_attrs = false;
...@@ -711,12 +655,7 @@ fn printSourceAtAddressMacOs(di: *DebugInfo, out_stream: var, address: usize, tt...@@ -711,12 +655,7 @@ fn printSourceAtAddressMacOs(di: *DebugInfo, out_stream: var, address: usize, tt
711 const adjusted_addr = 0x100000000 + (address - base_addr);655 const adjusted_addr = 0x100000000 + (address - base_addr);
712656
713 const symbol = machoSearchSymbols(di.symbols, adjusted_addr) orelse {657 const symbol = machoSearchSymbols(di.symbols, adjusted_addr) orelse {
714 if (tty_color) {658 return printLineInfo(out_stream, null, address, "???", "???", tty_color, printLineFromFileAnyOs);
715 try out_stream.print("???:?:?: " ++ DIM ++ "0x{x} in ??? (???)" ++ RESET ++ "\n\n\n", .{address});
716 } else {
717 try out_stream.print("???:?:?: 0x{x} in ??? (???)\n\n\n", .{address});
718 }
719 return;
720 };659 };
721660
722 const symbol_name = mem.toSliceConst(u8, @ptrCast([*:0]const u8, di.strings.ptr + symbol.nlist.n_strx));661 const symbol_name = mem.toSliceConst(u8, @ptrCast([*:0]const u8, di.strings.ptr + symbol.nlist.n_strx));
...@@ -724,29 +663,22 @@ fn printSourceAtAddressMacOs(di: *DebugInfo, out_stream: var, address: usize, tt...@@ -724,29 +663,22 @@ fn printSourceAtAddressMacOs(di: *DebugInfo, out_stream: var, address: usize, tt
724 const ofile_path = mem.toSliceConst(u8, @ptrCast([*:0]const u8, di.strings.ptr + ofile.n_strx));663 const ofile_path = mem.toSliceConst(u8, @ptrCast([*:0]const u8, di.strings.ptr + ofile.n_strx));
725 break :blk fs.path.basename(ofile_path);664 break :blk fs.path.basename(ofile_path);
726 } else "???";665 } else "???";
727 if (getLineNumberInfoMacOs(di, symbol.*, adjusted_addr)) |line_info| {666
728 defer line_info.deinit();667 const line_info = getLineNumberInfoMacOs(di, symbol.*, adjusted_addr) catch |err| switch (err) {
729 try printLineInfo(668 error.MissingDebugInfo, error.InvalidDebugInfo => null,
730 out_stream,
731 line_info,
732 address,
733 symbol_name,
734 compile_unit_name,
735 tty_color,
736 printLineFromFileAnyOs,
737 );
738 } else |err| switch (err) {
739 error.MissingDebugInfo, error.InvalidDebugInfo => {
740 if (tty_color) {
741 try out_stream.print("???:?:?: " ++ DIM ++ "0x{x} in {} ({})" ++ RESET ++ "\n\n\n", .{
742 address, symbol_name, compile_unit_name,
743 });
744 } else {
745 try out_stream.print("???:?:?: 0x{x} in {} ({})\n\n\n", .{ address, symbol_name, compile_unit_name });
746 }
747 },
748 else => return err,669 else => return err,
749 }670 };
671 defer if (line_info) |li| li.deinit();
672
673 try printLineInfo(
674 out_stream,
675 line_info,
676 address,
677 symbol_name,
678 compile_unit_name,
679 tty_color,
680 printLineFromFileAnyOs,
681 );
750}682}
751683
752pub fn printSourceAtAddressPosix(debug_info: *DebugInfo, out_stream: var, address: usize, tty_color: bool) !void {684pub fn printSourceAtAddressPosix(debug_info: *DebugInfo, out_stream: var, address: usize, tty_color: bool) !void {
...@@ -755,47 +687,46 @@ pub fn printSourceAtAddressPosix(debug_info: *DebugInfo, out_stream: var, addres...@@ -755,47 +687,46 @@ pub fn printSourceAtAddressPosix(debug_info: *DebugInfo, out_stream: var, addres
755687
756fn printLineInfo(688fn printLineInfo(
757 out_stream: var,689 out_stream: var,
758 line_info: LineInfo,690 line_info: ?LineInfo,
759 address: usize,691 address: usize,
760 symbol_name: []const u8,692 symbol_name: []const u8,
761 compile_unit_name: []const u8,693 compile_unit_name: []const u8,
762 tty_color: bool,694 tty_color: bool,
763 comptime printLineFromFile: var,695 comptime printLineFromFile: var,
764) !void {696) !void {
765 if (tty_color) {697 if (tty_color) setTtyColor(.White);
766 try out_stream.print(WHITE ++ "{}:{}:{}" ++ RESET ++ ": " ++ DIM ++ "0x{x} in {} ({})" ++ RESET ++ "\n", .{698
767 line_info.file_name,699 if (line_info) |*li| {
768 line_info.line,700 try out_stream.print("{}:{}:{}", .{ li.file_name, li.line, li.column });
769 line_info.column,701 } else {
770 address,702 try out_stream.print("???:?:?", .{});
771 symbol_name,703 }
772 compile_unit_name,704
773 });705 if (tty_color) setTtyColor(.Reset);
774 if (printLineFromFile(out_stream, line_info)) {706 try out_stream.write(": ");
775 if (line_info.column == 0) {707 if (tty_color) setTtyColor(.Dim);
776 try out_stream.write("\n");708 try out_stream.print("0x{x} in {} ({})", .{ address, symbol_name, compile_unit_name });
777 } else {709 if (tty_color) setTtyColor(.Reset);
778 {710 try out_stream.write("\n");
779 var col_i: usize = 1;711
780 while (col_i < line_info.column) : (col_i += 1) {712 // Show the matching source code line if possible
781 try out_stream.writeByte(' ');713 if (line_info) |li| {
782 }714 if (noasync printLineFromFile(out_stream, li)) {
783 }715 if (li.column > 0) {
784 try out_stream.write(GREEN ++ "^" ++ RESET ++ "\n");716 // The caret already takes one char
717 const space_needed = @intCast(usize, li.column - 1);
718
719 try out_stream.writeByteNTimes(' ', space_needed);
720 if (tty_color) setTtyColor(.Green);
721 try out_stream.write("^");
722 if (tty_color) setTtyColor(.Reset);
785 }723 }
724 try out_stream.write("\n");
786 } else |err| switch (err) {725 } else |err| switch (err) {
787 error.EndOfFile, error.FileNotFound => {},726 error.EndOfFile, error.FileNotFound => {},
727 error.BadPathName => {},
788 else => return err,728 else => return err,
789 }729 }
790 } else {
791 try out_stream.print("{}:{}:{}: 0x{x} in {} ({})\n", .{
792 line_info.file_name,
793 line_info.line,
794 line_info.column,
795 address,
796 symbol_name,
797 compile_unit_name,
798 });
799 }730 }
800}731}
801732
...@@ -1240,38 +1171,26 @@ pub const DwarfInfo = struct {...@@ -1240,38 +1171,26 @@ pub const DwarfInfo = struct {
1240 comptime printLineFromFile: var,1171 comptime printLineFromFile: var,
1241 ) !void {1172 ) !void {
1242 const compile_unit = self.findCompileUnit(address) catch {1173 const compile_unit = self.findCompileUnit(address) catch {
1243 if (tty_color) {1174 return printLineInfo(out_stream, null, address, "???", "???", tty_color, printLineFromFile);
1244 try out_stream.print("???:?:?: " ++ DIM ++ "0x{x} in ??? (???)" ++ RESET ++ "\n\n\n", .{address});
1245 } else {
1246 try out_stream.print("???:?:?: 0x{x} in ??? (???)\n\n\n", .{address});
1247 }
1248 return;
1249 };1175 };
1176
1250 const compile_unit_name = try compile_unit.die.getAttrString(self, DW.AT_name);1177 const compile_unit_name = try compile_unit.die.getAttrString(self, DW.AT_name);
1251 if (self.getLineNumberInfo(compile_unit.*, address)) |line_info| {1178 const symbol_name = self.getSymbolName(address) orelse "???";
1252 defer line_info.deinit();1179 const line_info = self.getLineNumberInfo(compile_unit.*, address) catch |err| switch (err) {
1253 const symbol_name = self.getSymbolName(address) orelse "???";1180 error.MissingDebugInfo, error.InvalidDebugInfo => null,
1254 try printLineInfo(
1255 out_stream,
1256 line_info,
1257 address,
1258 symbol_name,
1259 compile_unit_name,
1260 tty_color,
1261 printLineFromFile,
1262 );
1263 } else |err| switch (err) {
1264 error.MissingDebugInfo, error.InvalidDebugInfo => {
1265 if (tty_color) {
1266 try out_stream.print("???:?:?: " ++ DIM ++ "0x{x} in ??? ({})" ++ RESET ++ "\n\n\n", .{
1267 address, compile_unit_name,
1268 });
1269 } else {
1270 try out_stream.print("???:?:?: 0x{x} in ??? ({})\n\n\n", .{ address, compile_unit_name });
1271 }
1272 },
1273 else => return err,1181 else => return err,
1274 }1182 };
1183 defer if (line_info) |li| li.deinit();
1184
1185 try printLineInfo(
1186 out_stream,
1187 line_info,
1188 address,
1189 symbol_name,
1190 compile_unit_name,
1191 tty_color,
1192 printLineFromFile,
1193 );
1275 }1194 }
12761195
1277 fn getSymbolName(di: *DwarfInfo, address: u64) ?[]const u8 {1196 fn getSymbolName(di: *DwarfInfo, address: u64) ?[]const u8 {
lib/std/io/out_stream.zig+8-4
...@@ -45,10 +45,14 @@ pub fn OutStream(comptime WriteError: type) type {...@@ -45,10 +45,14 @@ pub fn OutStream(comptime WriteError: type) type {
45 }45 }
4646
47 pub fn writeByteNTimes(self: *Self, byte: u8, n: usize) Error!void {47 pub fn writeByteNTimes(self: *Self, byte: u8, n: usize) Error!void {
48 const slice = @as(*const [1]u8, &byte)[0..];48 var bytes: [256]u8 = undefined;
49 var i: usize = 0;49 mem.set(u8, bytes[0..], byte);
50 while (i < n) : (i += 1) {50
51 try self.writeFn(self, slice);51 var remaining: usize = n;
52 while (remaining > 0) {
53 const to_write = std.math.min(remaining, bytes.len);
54 try self.writeFn(self, bytes[0..to_write]);
55 remaining -= to_write;
52 }56 }
53 }57 }
5458
test/stack_traces.zig+98
...@@ -51,11 +51,15 @@ pub fn addCases(cases: *tests.StackTracesContext) void {...@@ -51,11 +51,15 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
51 // debug51 // debug
52 \\error: TheSkyIsFalling52 \\error: TheSkyIsFalling
53 \\source.zig:4:5: [address] in main (test)53 \\source.zig:4:5: [address] in main (test)
54 \\ return error.TheSkyIsFalling;
55 \\ ^
54 \\56 \\
55 ,57 ,
56 // release-safe58 // release-safe
57 \\error: TheSkyIsFalling59 \\error: TheSkyIsFalling
58 \\source.zig:4:5: [address] in std.start.main (test)60 \\source.zig:4:5: [address] in std.start.main (test)
61 \\ return error.TheSkyIsFalling;
62 \\ ^
59 \\63 \\
60 ,64 ,
61 // release-fast65 // release-fast
...@@ -74,13 +78,21 @@ pub fn addCases(cases: *tests.StackTracesContext) void {...@@ -74,13 +78,21 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
74 // debug78 // debug
75 \\error: TheSkyIsFalling79 \\error: TheSkyIsFalling
76 \\source.zig:4:5: [address] in foo (test)80 \\source.zig:4:5: [address] in foo (test)
81 \\ return error.TheSkyIsFalling;
82 \\ ^
77 \\source.zig:8:5: [address] in main (test)83 \\source.zig:8:5: [address] in main (test)
84 \\ try foo();
85 \\ ^
78 \\86 \\
79 ,87 ,
80 // release-safe88 // release-safe
81 \\error: TheSkyIsFalling89 \\error: TheSkyIsFalling
82 \\source.zig:4:5: [address] in std.start.main (test)90 \\source.zig:4:5: [address] in std.start.main (test)
91 \\ return error.TheSkyIsFalling;
92 \\ ^
83 \\source.zig:8:5: [address] in std.start.main (test)93 \\source.zig:8:5: [address] in std.start.main (test)
94 \\ try foo();
95 \\ ^
84 \\96 \\
85 ,97 ,
86 // release-fast98 // release-fast
...@@ -99,17 +111,33 @@ pub fn addCases(cases: *tests.StackTracesContext) void {...@@ -99,17 +111,33 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
99 // debug111 // debug
100 \\error: TheSkyIsFalling112 \\error: TheSkyIsFalling
101 \\source.zig:12:5: [address] in make_error (test)113 \\source.zig:12:5: [address] in make_error (test)
114 \\ return error.TheSkyIsFalling;
115 \\ ^
102 \\source.zig:8:5: [address] in bar (test)116 \\source.zig:8:5: [address] in bar (test)
117 \\ return make_error();
118 \\ ^
103 \\source.zig:4:5: [address] in foo (test)119 \\source.zig:4:5: [address] in foo (test)
120 \\ try bar();
121 \\ ^
104 \\source.zig:16:5: [address] in main (test)122 \\source.zig:16:5: [address] in main (test)
123 \\ try foo();
124 \\ ^
105 \\125 \\
106 ,126 ,
107 // release-safe127 // release-safe
108 \\error: TheSkyIsFalling128 \\error: TheSkyIsFalling
109 \\source.zig:12:5: [address] in std.start.main (test)129 \\source.zig:12:5: [address] in std.start.main (test)
130 \\ return error.TheSkyIsFalling;
131 \\ ^
110 \\source.zig:8:5: [address] in std.start.main (test)132 \\source.zig:8:5: [address] in std.start.main (test)
133 \\ return make_error();
134 \\ ^
111 \\source.zig:4:5: [address] in std.start.main (test)135 \\source.zig:4:5: [address] in std.start.main (test)
136 \\ try bar();
137 \\ ^
112 \\source.zig:16:5: [address] in std.start.main (test)138 \\source.zig:16:5: [address] in std.start.main (test)
139 \\ try foo();
140 \\ ^
113 \\141 \\
114 ,142 ,
115 // release-fast143 // release-fast
...@@ -130,11 +158,15 @@ pub fn addCases(cases: *tests.StackTracesContext) void {...@@ -130,11 +158,15 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
130 // debug158 // debug
131 \\error: TheSkyIsFalling159 \\error: TheSkyIsFalling
132 \\source.zig:4:5: [address] in main (test)160 \\source.zig:4:5: [address] in main (test)
161 \\ return error.TheSkyIsFalling;
162 \\ ^
133 \\163 \\
134 ,164 ,
135 // release-safe165 // release-safe
136 \\error: TheSkyIsFalling166 \\error: TheSkyIsFalling
137 \\source.zig:4:5: [address] in std.start.posixCallMainAndExit (test)167 \\source.zig:4:5: [address] in std.start.posixCallMainAndExit (test)
168 \\ return error.TheSkyIsFalling;
169 \\ ^
138 \\170 \\
139 ,171 ,
140 // release-fast172 // release-fast
...@@ -153,13 +185,21 @@ pub fn addCases(cases: *tests.StackTracesContext) void {...@@ -153,13 +185,21 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
153 // debug185 // debug
154 \\error: TheSkyIsFalling186 \\error: TheSkyIsFalling
155 \\source.zig:4:5: [address] in foo (test)187 \\source.zig:4:5: [address] in foo (test)
188 \\ return error.TheSkyIsFalling;
189 \\ ^
156 \\source.zig:8:5: [address] in main (test)190 \\source.zig:8:5: [address] in main (test)
191 \\ try foo();
192 \\ ^
157 \\193 \\
158 ,194 ,
159 // release-safe195 // release-safe
160 \\error: TheSkyIsFalling196 \\error: TheSkyIsFalling
161 \\source.zig:4:5: [address] in std.start.posixCallMainAndExit (test)197 \\source.zig:4:5: [address] in std.start.posixCallMainAndExit (test)
198 \\ return error.TheSkyIsFalling;
199 \\ ^
162 \\source.zig:8:5: [address] in std.start.posixCallMainAndExit (test)200 \\source.zig:8:5: [address] in std.start.posixCallMainAndExit (test)
201 \\ try foo();
202 \\ ^
163 \\203 \\
164 ,204 ,
165 // release-fast205 // release-fast
...@@ -178,17 +218,33 @@ pub fn addCases(cases: *tests.StackTracesContext) void {...@@ -178,17 +218,33 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
178 // debug218 // debug
179 \\error: TheSkyIsFalling219 \\error: TheSkyIsFalling
180 \\source.zig:12:5: [address] in make_error (test)220 \\source.zig:12:5: [address] in make_error (test)
221 \\ return error.TheSkyIsFalling;
222 \\ ^
181 \\source.zig:8:5: [address] in bar (test)223 \\source.zig:8:5: [address] in bar (test)
224 \\ return make_error();
225 \\ ^
182 \\source.zig:4:5: [address] in foo (test)226 \\source.zig:4:5: [address] in foo (test)
227 \\ try bar();
228 \\ ^
183 \\source.zig:16:5: [address] in main (test)229 \\source.zig:16:5: [address] in main (test)
230 \\ try foo();
231 \\ ^
184 \\232 \\
185 ,233 ,
186 // release-safe234 // release-safe
187 \\error: TheSkyIsFalling235 \\error: TheSkyIsFalling
188 \\source.zig:12:5: [address] in std.start.posixCallMainAndExit (test)236 \\source.zig:12:5: [address] in std.start.posixCallMainAndExit (test)
237 \\ return error.TheSkyIsFalling;
238 \\ ^
189 \\source.zig:8:5: [address] in std.start.posixCallMainAndExit (test)239 \\source.zig:8:5: [address] in std.start.posixCallMainAndExit (test)
240 \\ return make_error();
241 \\ ^
190 \\source.zig:4:5: [address] in std.start.posixCallMainAndExit (test)242 \\source.zig:4:5: [address] in std.start.posixCallMainAndExit (test)
243 \\ try bar();
244 \\ ^
191 \\source.zig:16:5: [address] in std.start.posixCallMainAndExit (test)245 \\source.zig:16:5: [address] in std.start.posixCallMainAndExit (test)
246 \\ try foo();
247 \\ ^
192 \\248 \\
193 ,249 ,
194 // release-fast250 // release-fast
...@@ -209,11 +265,15 @@ pub fn addCases(cases: *tests.StackTracesContext) void {...@@ -209,11 +265,15 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
209 // debug265 // debug
210 \\error: TheSkyIsFalling266 \\error: TheSkyIsFalling
211 \\source.zig:4:5: [address] in _main.0 (test.o)267 \\source.zig:4:5: [address] in _main.0 (test.o)
268 \\ return error.TheSkyIsFalling;
269 \\ ^
212 \\270 \\
213 ,271 ,
214 // release-safe272 // release-safe
215 \\error: TheSkyIsFalling273 \\error: TheSkyIsFalling
216 \\source.zig:4:5: [address] in _main (test.o)274 \\source.zig:4:5: [address] in _main (test.o)
275 \\ return error.TheSkyIsFalling;
276 \\ ^
217 \\277 \\
218 ,278 ,
219 // release-fast279 // release-fast
...@@ -232,13 +292,21 @@ pub fn addCases(cases: *tests.StackTracesContext) void {...@@ -232,13 +292,21 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
232 // debug292 // debug
233 \\error: TheSkyIsFalling293 \\error: TheSkyIsFalling
234 \\source.zig:4:5: [address] in _foo (test.o)294 \\source.zig:4:5: [address] in _foo (test.o)
295 \\ return error.TheSkyIsFalling;
296 \\ ^
235 \\source.zig:8:5: [address] in _main.0 (test.o)297 \\source.zig:8:5: [address] in _main.0 (test.o)
298 \\ try foo();
299 \\ ^
236 \\300 \\
237 ,301 ,
238 // release-safe302 // release-safe
239 \\error: TheSkyIsFalling303 \\error: TheSkyIsFalling
240 \\source.zig:4:5: [address] in _main (test.o)304 \\source.zig:4:5: [address] in _main (test.o)
305 \\ return error.TheSkyIsFalling;
306 \\ ^
241 \\source.zig:8:5: [address] in _main (test.o)307 \\source.zig:8:5: [address] in _main (test.o)
308 \\ try foo();
309 \\ ^
242 \\310 \\
243 ,311 ,
244 // release-fast312 // release-fast
...@@ -257,17 +325,33 @@ pub fn addCases(cases: *tests.StackTracesContext) void {...@@ -257,17 +325,33 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
257 // debug325 // debug
258 \\error: TheSkyIsFalling326 \\error: TheSkyIsFalling
259 \\source.zig:12:5: [address] in _make_error (test.o)327 \\source.zig:12:5: [address] in _make_error (test.o)
328 \\ return error.TheSkyIsFalling;
329 \\ ^
260 \\source.zig:8:5: [address] in _bar (test.o)330 \\source.zig:8:5: [address] in _bar (test.o)
331 \\ return make_error();
332 \\ ^
261 \\source.zig:4:5: [address] in _foo (test.o)333 \\source.zig:4:5: [address] in _foo (test.o)
334 \\ try bar();
335 \\ ^
262 \\source.zig:16:5: [address] in _main.0 (test.o)336 \\source.zig:16:5: [address] in _main.0 (test.o)
337 \\ try foo();
338 \\ ^
263 \\339 \\
264 ,340 ,
265 // release-safe341 // release-safe
266 \\error: TheSkyIsFalling342 \\error: TheSkyIsFalling
267 \\source.zig:12:5: [address] in _main (test.o)343 \\source.zig:12:5: [address] in _main (test.o)
344 \\ return error.TheSkyIsFalling;
345 \\ ^
268 \\source.zig:8:5: [address] in _main (test.o)346 \\source.zig:8:5: [address] in _main (test.o)
347 \\ return make_error();
348 \\ ^
269 \\source.zig:4:5: [address] in _main (test.o)349 \\source.zig:4:5: [address] in _main (test.o)
350 \\ try bar();
351 \\ ^
270 \\source.zig:16:5: [address] in _main (test.o)352 \\source.zig:16:5: [address] in _main (test.o)
353 \\ try foo();
354 \\ ^
271 \\355 \\
272 ,356 ,
273 // release-fast357 // release-fast
...@@ -288,6 +372,8 @@ pub fn addCases(cases: *tests.StackTracesContext) void {...@@ -288,6 +372,8 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
288 // debug372 // debug
289 \\error: TheSkyIsFalling373 \\error: TheSkyIsFalling
290 \\source.zig:4:5: [address] in main (test.obj)374 \\source.zig:4:5: [address] in main (test.obj)
375 \\ return error.TheSkyIsFalling;
376 \\ ^
291 \\377 \\
292 ,378 ,
293 // release-safe379 // release-safe
...@@ -309,7 +395,11 @@ pub fn addCases(cases: *tests.StackTracesContext) void {...@@ -309,7 +395,11 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
309 // debug395 // debug
310 \\error: TheSkyIsFalling396 \\error: TheSkyIsFalling
311 \\source.zig:4:5: [address] in foo (test.obj)397 \\source.zig:4:5: [address] in foo (test.obj)
398 \\ return error.TheSkyIsFalling;
399 \\ ^
312 \\source.zig:8:5: [address] in main (test.obj)400 \\source.zig:8:5: [address] in main (test.obj)
401 \\ try foo();
402 \\ ^
313 \\403 \\
314 ,404 ,
315 // release-safe405 // release-safe
...@@ -331,9 +421,17 @@ pub fn addCases(cases: *tests.StackTracesContext) void {...@@ -331,9 +421,17 @@ pub fn addCases(cases: *tests.StackTracesContext) void {
331 // debug421 // debug
332 \\error: TheSkyIsFalling422 \\error: TheSkyIsFalling
333 \\source.zig:12:5: [address] in make_error (test.obj)423 \\source.zig:12:5: [address] in make_error (test.obj)
424 \\ return error.TheSkyIsFalling;
425 \\ ^
334 \\source.zig:8:5: [address] in bar (test.obj)426 \\source.zig:8:5: [address] in bar (test.obj)
427 \\ return make_error();
428 \\ ^
335 \\source.zig:4:5: [address] in foo (test.obj)429 \\source.zig:4:5: [address] in foo (test.obj)
430 \\ try bar();
431 \\ ^
336 \\source.zig:16:5: [address] in main (test.obj)432 \\source.zig:16:5: [address] in main (test.obj)
433 \\ try foo();
434 \\ ^
337 \\435 \\
338 ,436 ,
339 // release-safe437 // release-safe