| ... | ... | @@ -308,6 +308,9 @@ pub fn unlockStderr() void { |
| 308 | 308 | /// Alternatively, use the higher-level `std.log` or `Io.lockStderr` to |
| 309 | 309 | /// integrate with the application's chosen `Io` implementation. |
| 310 | 310 | pub fn print(comptime fmt: []const u8, args: anytype) void { |
| 311 | const io = std.Options.debug_io; |
| 312 | const prev = io.swapCancelProtection(.blocked); |
| 313 | defer _ = io.swapCancelProtection(prev); |
| 311 | 314 | var buffer: [64]u8 = undefined; |
| 312 | 315 | const stderr = lockStderr(&buffer); |
| 313 | 316 | defer unlockStderr(); |
| ... | ... | @@ -326,6 +329,9 @@ pub inline fn getSelfDebugInfo() !*SelfInfo { |
| 326 | 329 | /// Tries to print a hexadecimal view of the bytes, unbuffered, and ignores any error returned. |
| 327 | 330 | /// Obtains the stderr mutex while dumping. |
| 328 | 331 | pub fn dumpHex(bytes: []const u8) void { |
| 332 | const io = std.Options.debug_io; |
| 333 | const prev = io.swapCancelProtection(.blocked); |
| 334 | defer _ = io.swapCancelProtection(prev); |
| 329 | 335 | const stderr = lockStderr(&.{}).terminal(); |
| 330 | 336 | defer unlockStderr(); |
| 331 | 337 | dumpHexFallible(stderr, bytes) catch {}; |
| ... | ... | @@ -789,6 +795,9 @@ pub noinline fn writeCurrentStackTrace(options: StackUnwindOptions, t: Io.Termin |
| 789 | 795 | } |
| 790 | 796 | /// A thin wrapper around `writeCurrentStackTrace` which writes to stderr and ignores write errors. |
| 791 | 797 | pub fn dumpCurrentStackTrace(options: StackUnwindOptions) void { |
| 798 | const io = std.Options.debug_io; |
| 799 | const prev = io.swapCancelProtection(.blocked); |
| 800 | defer _ = io.swapCancelProtection(prev); |
| 792 | 801 | const stderr = lockStderr(&.{}).terminal(); |
| 793 | 802 | defer unlockStderr(); |
| 794 | 803 | writeCurrentStackTrace(.{ |
| ... | ... | @@ -879,6 +888,9 @@ fn writeTrace( |
| 879 | 888 | } |
| 880 | 889 | /// A thin wrapper around `writeStackTrace` which writes to stderr and ignores write errors. |
| 881 | 890 | pub fn dumpStackTrace(st: *const StackTrace) void { |
| 891 | const io = std.Options.debug_io; |
| 892 | const prev = io.swapCancelProtection(.blocked); |
| 893 | defer _ = io.swapCancelProtection(prev); |
| 882 | 894 | const stderr = lockStderr(&.{}).terminal(); |
| 883 | 895 | defer unlockStderr(); |
| 884 | 896 | writeStackTrace(st, stderr) catch |err| switch (err) { |
| ... | ... | @@ -888,6 +900,9 @@ pub fn dumpStackTrace(st: *const StackTrace) void { |
| 888 | 900 | |
| 889 | 901 | /// A thin wrapper around `writeErrorReturnTrace` which writes to stderr and ignores write errors. |
| 890 | 902 | pub fn dumpErrorReturnTrace(et: *const std.builtin.StackTrace) void { |
| 903 | const io = std.Options.debug_io; |
| 904 | const prev = io.swapCancelProtection(.blocked); |
| 905 | defer _ = io.swapCancelProtection(prev); |
| 891 | 906 | const stderr = lockStderr(&.{}).terminal(); |
| 892 | 907 | defer unlockStderr(); |
| 893 | 908 | writeErrorReturnTrace(et, stderr) catch |err| switch (err) { |