| 1 | #exe { |
| 2 | -Mroot=main.zig |
| 3 | #} |
| 4 | |
| 5 | #write main.zig { |
| 6 | pub fn main() !u8 { |
| 7 | var a: u8 = undefined; |
| 8 | a = 255; |
| 9 | _ = a + 1; |
| 10 | return 1; |
| 11 | } |
| 12 | pub const panic = std.debug.FullPanic(myPanic); |
| 13 | fn myPanic(msg: []const u8, _: ?usize) noreturn { |
| 14 | var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); |
| 15 | stdout_writer.interface.print("panic message: {s}\n", .{msg}) catch {}; |
| 16 | std.process.exit(0); |
| 17 | } |
| 18 | const std = @import("std"); |
| 19 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 20 | #} |
| 21 | #update |
| 22 | #check stdout { |
| 23 | panic message: integer overflow |
| 24 | #} |
| 25 | |
| 26 | #write main.zig { |
| 27 | pub fn main() !u8 { |
| 28 | var a: u8 = undefined; |
| 29 | a = 255; |
| 30 | _ = a + 1; |
| 31 | return 1; |
| 32 | } |
| 33 | pub const panic = std.debug.FullPanic(myPanic); |
| 34 | fn myPanic(msg: []const u8, _: ?usize) noreturn { |
| 35 | var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); |
| 36 | stdout_writer.interface.print("new panic message: {s}\n", .{msg}) catch {}; |
| 37 | std.process.exit(0); |
| 38 | } |
| 39 | const std = @import("std"); |
| 40 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 41 | #} |
| 42 | #update "change the panic handler body" |
| 43 | #check stdout { |
| 44 | new panic message: integer overflow |
| 45 | #} |
| 46 | |
| 47 | #write main.zig { |
| 48 | pub fn main() !u8 { |
| 49 | var a: u8 = undefined; |
| 50 | a = 255; |
| 51 | _ = a + 1; |
| 52 | return 1; |
| 53 | } |
| 54 | pub const panic = std.debug.FullPanic(myPanicNew); |
| 55 | fn myPanicNew(msg: []const u8, _: ?usize) noreturn { |
| 56 | var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{}); |
| 57 | stdout_writer.interface.print("third panic message: {s}\n", .{msg}) catch {}; |
| 58 | std.process.exit(0); |
| 59 | } |
| 60 | const std = @import("std"); |
| 61 | const io = std.Io.Threaded.global_single_threaded.io(); |
| 62 | #} |
| 63 | #update "change the panic handler function value" |
| 64 | #check stdout { |
| 65 | third panic message: integer overflow |
| 66 | #} |