std.debug.assert
pub fn assert(ok: bool) void
Invokes detectable illegal behavior when `ok` is `false`.
- Kind
- function
- Module
std.debug
Source: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
The entries of std.debug in the Zig reference. This page has 100 cards.
pub fn assert(ok: bool) void
Invokes detectable illegal behavior when `ok` is `false`.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn assertAligned(ptr: anytype, comptime alignment: std.mem.Alignment) void
Invokes detectable illegal behavior when the provided array is not aligned to the provided amount.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn assertReadable(slice: []const volatile u8) void
Invokes detectable illegal behavior when the provided slice is not mapped or lacks read permissions.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn attachSegfaultHandler() void
Attaches a global handler for several signals which, when triggered, prints output to stderr similar to the default panic handler, with a message containing the type of signal and a stack trace if possible.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn captureCurrentStackTrace(options: StackUnwindOptions, addr_buf: []usize) StackTrace
Capture and return the current stack trace.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize, comptime is_enabled: bool) type
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn addAddr(t: *@This(), addr: usize, note: []const u8) void
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn addNoInline(t: *@This(), note: []const u8) void
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn addNoOp(t: *@This(), note: []const u8) void
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn dump(t: @This()) void
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn format(t: @This(), comptime fmt: []const u8, options: std.fmt.Options, writer: *Writer) !void
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
The pointer through which a `cpu_context.Native` is received from callers of stack tracing logic.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn defaultHandleSegfault(addr: ?usize, name: []const u8, opt_ctx: ?CpuContextPtr) noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn defaultPanic(msg: []const u8, first_trace_addr: ?usize) noreturn
Dumps a stack trace to standard error, then aborts.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn dumpCurrentStackTrace(options: StackUnwindOptions) void
A thin wrapper around `writeCurrentStackTrace` which writes to stderr and ignores write errors.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn dumpErrorReturnTrace(et: *const std.builtin.StackTrace) void
A thin wrapper around `writeErrorReturnTrace` which writes to stderr and ignores write errors.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn dumpHex(bytes: []const u8) void
Tries to print a hexadecimal view of the bytes, unbuffered, and ignores any error returned.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn dumpHexFallible(t: Io.Terminal, bytes: []const u8) !void
Prints a hexadecimal view of the bytes, returning any error that occurs.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn dumpStackPointerAddr(prefix: []const u8) void
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn dumpStackTrace(st: *const StackTrace) void
A thin wrapper around `writeStackTrace` which writes to stderr and ignores write errors.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn format(fst: FormatStackTrace, writer: *Writer) Writer.Error!void
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn FullPanic(comptime panicFn: fn ([]const u8, ?usize) noreturn) type
A fully-featured panic handler namespace which lowers all panics to calls to `panicFn`.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn castToNull() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn copyLenMismatch() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn corruptSwitch() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn divideByZero() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn exactDivisionRemainder() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn forLenMismatch() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn inactiveUnionField(active: anytype, accessed: @TypeOf(active)) noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn incorrectAlignment() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn integerOutOfBounds() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn integerOverflow() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn integerPartOutOfBounds() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn invalidEnumValue() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn invalidErrorCode() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn loadUninstantiableType() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn memcpyAlias() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn noreturnReturned() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn outOfBounds(index: usize, len: usize) noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn reachedUnreachable() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn sentinelMismatch(expected: anytype, found: @TypeOf(expected)) noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn shiftRhsTooBig() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn shlOverflow() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn shrOverflow() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn sliceCastLenRemainder(src_len: usize) noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn startGreaterThanEnd(start: usize, end: usize) noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn unexpectedErrorCode(err: anyerror) noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn unwrapError(err: anyerror) noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn unwrapNull() noreturn
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn getDebugInfoAllocator() Allocator
The returned allocator should be thread-safe if the compilation is multi-threaded, because multiple threads could capture and/or print stack traces simultaneously.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn getSelfDebugInfo() !*SelfInfo
Marked `inline` to propagate a comptime-known error to callers.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
Whether or not the current target can print useful debug information when a segfault occurs.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn inValgrind() bool
Detect whether the program is being executed in the Valgrind virtual machine.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn lockStderr(buffer: []u8) Io.LockedStderr
Allows the caller to freely write to stderr until `unlockStderr` is called.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn maybeEnableSegfaultHandler() void
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn panic(comptime format: []const u8, args: anytype) noreturn
Equivalent to `@panic` but with a formatted message.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn panicExtra(ret_addr: ?usize, comptime format: []const u8, args: anytype) noreturn
Equivalent to `@panic` but with a formatted message and an explicitly provided return address which will be the first address in the stack trace.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn print(comptime fmt: []const u8, args: anytype) void
Writes to stderr, ignoring errors.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn assertLocked(l: SafetyLock) void
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn assertLockedShared(l: SafetyLock) void
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn assertUnlocked(l: SafetyLock) void
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn lock(l: *SafetyLock) void
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn lockShared(l: *SafetyLock) void
Use when consuming data in a read-only manner.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn unlock(l: *SafetyLock) void
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn unlockShared(l: *SafetyLock) void
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
Indicates how many addresses were skipped in a trace.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
Unresolved source locations can be represented with a single `usize` that corresponds to a virtual memory address of the program counter.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn stripInstructionPtrAuthCode(ptr: usize) usize
Some platforms use pointer authentication: the upper bits of instruction pointers contain a signature.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
Whether we can unwind the stack on this target, allowing capturing and/or printing the current stack trace.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn TargetInfo(os: std.Target.Os.Tag, arch: std.Target.Cpu.Arch) type
Returns the default `SelfInfo` for the given `os` and `arch`.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
This API helps you track where a value originated and where it was mutated, or any other points of interest.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn unlockStderr() void
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn updateSegfaultHandler(act: ?*const posix.Sigaction) void
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn writeCurrentStackTrace(options: StackUnwindOptions, t: Io.Terminal) Writer.Error!void
Write the current stack trace to `writer`, annotated with source locations.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn writeErrorReturnTrace(et: *const std.builtin.StackTrace, t: Io.Terminal) Writer.Error!void
Write a previously captured error return trace to `writer`, annotated with source locations.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn writeStackTrace(st: *const StackTrace, t: Io.Terminal) Writer.Error!void
Write a previously captured stack trace to `writer`, annotated with source locations.
std.debugSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.