diff options
Diffstat (limited to '9proc/src/linux/debug.zig')
| -rw-r--r-- | 9proc/src/linux/debug.zig | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/9proc/src/linux/debug.zig b/9proc/src/linux/debug.zig index a344380..8bbee52 100644 --- a/9proc/src/linux/debug.zig +++ b/9proc/src/linux/debug.zig @@ -163,7 +163,7 @@ pub const Debug = struct { max_paused: u8, capture: CaptureSlot = .{}, - paused: [max_paused_cap]PauseSlot = [_]PauseSlot{.{}} ** max_paused_cap, + paused: [max_paused_cap]PauseSlot = @splat(.{}), old_capture_action: linux.Sigaction = undefined, old_trap_action: linux.Sigaction = undefined, @@ -187,7 +187,7 @@ pub const Debug = struct { d.* = .{ .io = opts.io, .text_buf = opts.text_buf, - .capture_signal = @enumFromInt(opts.capture_signal), + .capture_signal = @fromBackingInt(@intCast(opts.capture_signal)), .capture_timeout_ns = opts.capture_timeout_ns, .max_paused = opts.max_paused, }; @@ -249,7 +249,7 @@ pub const Debug = struct { pub fn threadExists(d: *Debug, tid: u32) bool { _ = d; var path_buf: [64]u8 = undefined; - const path = std.fmt.bufPrintZ(&path_buf, "/proc/self/task/{d}/comm", .{tid}) catch return false; + const path = std.fmt.bufPrintSentinel(&path_buf, "/proc/self/task/{d}/comm", .{tid}, 0) catch return false; var buf: [32]u8 = undefined; _ = readFile(path, &buf) catch return false; return true; @@ -259,7 +259,7 @@ pub const Debug = struct { pub fn threadName(d: *Debug, tid: u32, w: *Writer) Error!void { _ = d; var path_buf: [64]u8 = undefined; - const path = std.fmt.bufPrintZ(&path_buf, "/proc/self/task/{d}/comm", .{tid}) catch return error.Unexpected; + const path = std.fmt.bufPrintSentinel(&path_buf, "/proc/self/task/{d}/comm", .{tid}, 0) catch return error.Unexpected; var buf: [64]u8 = undefined; const text = readFile(path, &buf) catch |err| switch (err) { error.NotFound => return error.NoThread, @@ -273,7 +273,7 @@ pub const Debug = struct { pub fn threadStat(d: *Debug, tid: u32, w: *Writer) Error!void { _ = d; var path_buf: [64]u8 = undefined; - const path = std.fmt.bufPrintZ(&path_buf, "/proc/self/task/{d}/stat", .{tid}) catch return error.Unexpected; + const path = std.fmt.bufPrintSentinel(&path_buf, "/proc/self/task/{d}/stat", .{tid}, 0) catch return error.Unexpected; var buf: [1024]u8 = undefined; const text = readFile(path, &buf) catch |err| switch (err) { error.NotFound => return error.NoThread, @@ -924,8 +924,8 @@ fn writeHexLines(base: usize, bytes: []const u8, w: *Writer) Error!void { fn writeRegs(ctx: *const Native, w: *Writer) Error!void { if (comptime arch == .x86_64) { - inline for (@typeInfo(Native.Gpr).@"enum".fields) |f| { - w.print("{s} 0x{x}\n", .{ f.name, ctx.gprs.get(@field(Native.Gpr, f.name)) }) catch return error.WriteFailed; + inline for (@typeInfo(Native.GprName).@"enum".field_names) |name| { + w.print("{s} 0x{x}\n", .{ name, ctx.gprs.get(@field(Native.GprName, name)) }) catch return error.WriteFailed; } w.print("pc 0x{x}\nsp 0x{x}\nfp 0x{x}\n", .{ ctx.gprs.get(.rip), ctx.gprs.get(.rsp), ctx.gprs.get(.rbp), @@ -1369,7 +1369,7 @@ test "panic record path" { // A long message is truncated, not overflowed. resetPanicRecord(); - const long = [_]u8{'x'} ** (panic_msg_cap + 100); + const long: [panic_msg_cap + 100]u8 = @splat('x'); try testing.expect(recordPanic(&long, null)); out.clearRetainingCapacity(); try d.panicMessage(&out.writer); |
