| ... | ... | @@ -57,14 +57,10 @@ var stderr_mutex = std.Mutex.init(); |
| 57 | 57 | pub fn warn(comptime fmt: []const u8, args: var) void { |
| 58 | 58 | const held = stderr_mutex.acquire(); |
| 59 | 59 | defer held.release(); |
| 60 | | const stderr = getStderrStream(); |
| 60 | const stderr = io.getStdErr().writer(); |
| 61 | 61 | nosuspend stderr.print(fmt, args) catch return; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | | pub fn getStderrStream() File.OutStream { |
| 65 | | return io.getStdErr().outStream(); |
| 66 | | } |
| 67 | | |
| 68 | 64 | pub fn getStderrMutex() *std.Mutex { |
| 69 | 65 | return &stderr_mutex; |
| 70 | 66 | } |
| ... | ... | @@ -102,7 +98,7 @@ pub fn detectTTYConfig() TTY.Config { |
| 102 | 98 | /// TODO multithreaded awareness |
| 103 | 99 | pub fn dumpCurrentStackTrace(start_addr: ?usize) void { |
| 104 | 100 | nosuspend { |
| 105 | | const stderr = getStderrStream(); |
| 101 | const stderr = io.getStdErr().writer(); |
| 106 | 102 | if (builtin.strip_debug_info) { |
| 107 | 103 | stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return; |
| 108 | 104 | return; |
| ... | ... | @@ -123,7 +119,7 @@ pub fn dumpCurrentStackTrace(start_addr: ?usize) void { |
| 123 | 119 | /// TODO multithreaded awareness |
| 124 | 120 | pub fn dumpStackTraceFromBase(bp: usize, ip: usize) void { |
| 125 | 121 | nosuspend { |
| 126 | | const stderr = getStderrStream(); |
| 122 | const stderr = io.getStdErr().writer(); |
| 127 | 123 | if (builtin.strip_debug_info) { |
| 128 | 124 | stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return; |
| 129 | 125 | return; |
| ... | ... | @@ -193,7 +189,7 @@ pub fn captureStackTrace(first_address: ?usize, stack_trace: *builtin.StackTrace |
| 193 | 189 | /// TODO multithreaded awareness |
| 194 | 190 | pub fn dumpStackTrace(stack_trace: builtin.StackTrace) void { |
| 195 | 191 | nosuspend { |
| 196 | | const stderr = getStderrStream(); |
| 192 | const stderr = io.getStdErr().writer(); |
| 197 | 193 | if (builtin.strip_debug_info) { |
| 198 | 194 | stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return; |
| 199 | 195 | return; |
| ... | ... | @@ -261,7 +257,7 @@ pub fn panicExtra(trace: ?*const builtin.StackTrace, first_trace_addr: ?usize, c |
| 261 | 257 | const held = panic_mutex.acquire(); |
| 262 | 258 | defer held.release(); |
| 263 | 259 | |
| 264 | | const stderr = getStderrStream(); |
| 260 | const stderr = io.getStdErr().writer(); |
| 265 | 261 | stderr.print(format ++ "\n", args) catch os.abort(); |
| 266 | 262 | if (trace) |t| { |
| 267 | 263 | dumpStackTrace(t.*); |
| ... | ... | @@ -286,7 +282,7 @@ pub fn panicExtra(trace: ?*const builtin.StackTrace, first_trace_addr: ?usize, c |
| 286 | 282 | // A panic happened while trying to print a previous panic message, |
| 287 | 283 | // we're still holding the mutex but that's fine as we're going to |
| 288 | 284 | // call abort() |
| 289 | | const stderr = getStderrStream(); |
| 285 | const stderr = io.getStdErr().writer(); |
| 290 | 286 | stderr.print("Panicked during a panic. Aborting.\n", .{}) catch os.abort(); |
| 291 | 287 | }, |
| 292 | 288 | else => { |