aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug
AgeCommit message (Collapse)Author
2025-08-30rework std.Io.Writer.Allocating to support runtime-known alignmentAndrew Kelley
Also, breaking API changes to: * std.fs.Dir.readFileAlloc * std.fs.Dir.readFileAllocOptions
2025-08-29std.Io: delete GenericReaderAndrew Kelley
and delete deprecated alias std.io
2025-08-28std.debug.Pdb: migrate more towards new Reader APIAndrew Kelley
There was some bug in this branch, and rather than diagnosing it, I fully finished porting over to new Reader API. Did it fix the bug?
2025-08-28fix not discarding delimiterAndrew Kelley
perhaps these APIs have the defaults backwards, eh?
2025-08-28update GenericWriter usage found by test-casesAndrew Kelley
2025-08-28std: delete most remaining uses of GenericWriterAndrew Kelley
2025-08-25start adding big endian RISC-V supportAlex Rønne Petersen
The big endian RISC-V effort is mostly driven by MIPS (the company) which is pivoting to RISC-V, and presumably needs a big endian variant to fill the niche that big endian MIPS (the ISA) did. GCC already supports these targets, but LLVM support will only appear in 22; this commit just adds the necessary target knowledge and checks on our end.
2025-08-25delete std.debug.FixedBufferReaderAndrew Kelley
now that std.Io.Reader has sufficient debug performance
2025-08-23std.debug: delete MemoryAccessorAndrew Kelley
This API is based around the unsound idea that a process can perform checked virtual memory loads to prevent crashing. This depends on OS-specific APIs that may be unavailable, disabled, or impossible due to virtualization. It also makes collecting stack traces ridiculously slow, which is a problem for users of DebugAllocator - in other words, everybody, all the time. It also makes strace go from being superbly clean to being awful.
2025-08-15std.compress.zstd.Decompress fixesAndrew Kelley
* std.Io.Reader: appendRemaining no longer supports alignment and has different rules about how exceeding limit. Fixed bug where it would return success instead of error.StreamTooLong like it was supposed to. * std.Io.Reader: simplify appendRemaining and appendRemainingUnlimited to be implemented based on std.Io.Writer.Allocating * std.Io.Writer: introduce unreachableRebase * std.Io.Writer: remove minimum_unused_capacity from Allocating. maybe that flexibility could have been handy, but let's see if anyone actually needs it. The field is redundant with the superlinear growth of ArrayList capacity. * std.Io.Writer: growingRebase also ensures total capacity on the preserve parameter, making it no longer necessary to do ensureTotalCapacity at the usage site of decompression streams. * std.compress.flate.Decompress: fix rebase not taking into account seek * std.compress.zstd.Decompress: split into "direct" and "indirect" usage patterns depending on whether a buffer is provided to init, matching how flate works. Remove some overzealous asserts that prevented buffer expansion from within rebase implementation. * std.zig: fix readSourceFileToAlloc returning an overaligned slice which was difficult to free correctly. fixes #24608
2025-08-11std.ArrayList: make unmanaged the defaultAndrew Kelley
2025-08-03zig fmt: apply new cast builtin orderJustus Klausecker
2025-07-31std.debug.Dwarf: work around API deficiencyAndrew Kelley
need to supply a big enough buffer when working with decompression
2025-07-31std.compress: rework flate to new I/O APIAndrew Kelley
2025-07-16zig fmtAndrew Kelley
2025-07-07std.fmt: breaking API changesAndrew Kelley
added adapter to AnyWriter and GenericWriter to help bridge the gap between old and new API make std.testing.expectFmt work at compile-time std.fmt no longer has a dependency on std.unicode. Formatted printing was never properly unicode-aware. Now it no longer pretends to be. Breakage/deprecations: * std.fs.File.reader -> std.fs.File.deprecatedReader * std.fs.File.writer -> std.fs.File.deprecatedWriter * std.io.GenericReader -> std.io.Reader * std.io.GenericWriter -> std.io.Writer * std.io.AnyReader -> std.io.Reader * std.io.AnyWriter -> std.io.Writer * std.fmt.format -> std.fmt.deprecatedFormat * std.fmt.fmtSliceEscapeLower -> std.ascii.hexEscape * std.fmt.fmtSliceEscapeUpper -> std.ascii.hexEscape * std.fmt.fmtSliceHexLower -> {x} * std.fmt.fmtSliceHexUpper -> {X} * std.fmt.fmtIntSizeDec -> {B} * std.fmt.fmtIntSizeBin -> {Bi} * std.fmt.fmtDuration -> {D} * std.fmt.fmtDurationSigned -> {D} * {} -> {f} when there is a format method * format method signature - anytype -> *std.io.Writer - inferred error set -> error{WriteFailed} - options -> (deleted) * std.fmt.Formatted - now takes context type explicitly - no fmt string
2025-07-07std.io: move getStdIn, getStdOut, getStdErr functions to fs.FileAndrew Kelley
preparing to rearrange std.io namespace into an interface how to upgrade: std.io.getStdIn() -> std.fs.File.stdin() std.io.getStdOut() -> std.fs.File.stdout() std.io.getStdErr() -> std.fs.File.stderr()
2025-07-07std.io: deprecated Reader/Writer; introduce new APIAndrew Kelley
2025-06-23remove `spirv` cpu archAli Cheraghi
2025-06-19Target: pass and use locals by pointer instead of by valueJacob Young
This struct is larger than 256 bytes and code that copies it consistently shows up in profiles of the compiler.
2025-06-01std: remove old panic handlers after zig1.wasm updatemlugg
2025-06-01compiler: combine `@intCast` safety checksmlugg
`castTruncatedData` was a poorly worded error (all shrinking casts "truncate bits", it's just that we assume those bits to be zext/sext of the other bits!), and `negativeToUnsigned` was a pointless distinction which forced the compiler to emit worse code (since two separate safety checks were required for casting e.g. 'i32' to 'u16') and wasn't even implemented correctly. This commit combines those safety panics into one function, `integerOutOfBounds`. The name maybe isn't perfect, but that's not hugely important; what matters is the new default message, which is clearer than the old ones: "integer does not fit in destination type".
2025-05-17debug: correctly detect missing entries in `.eh_frame_hdr`Jacob Young
2025-04-27make `@memcpy` and `@memmove` share panic handlersAndrew Kelley
2025-04-26compiler: add @memmove builtindweiller
2025-02-24stdlib: handle EEXIST in mmap with FIXED_NOREPLACE. Fixes #21475Alec Fessler
2025-02-23Sema: allow `@ptrCast` of slices changing the lengthmlugg
Also, refactor `Sema.ptrCastFull` to not be a horrifying hellscape.
2025-02-22zig build fmtAndrew Kelley
2025-02-17std.Target: Remove functions that just wrap component functions.Alex Rønne Petersen
Functions like isMinGW() and isGnuLibC() have a good reason to exist: They look at multiple components of the target. But functions like isWasm(), isDarwin(), isGnu(), etc only exist to save 4-8 characters. I don't think this is a good enough reason to keep them, especially given that: * It's not immediately obvious to a reader whether target.isDarwin() means the same thing as target.os.tag.isDarwin() precisely because isMinGW() and similar functions *do* look at multiple components. * It's not clear where we would draw the line. The logical conclusion before this commit would be to also wrap Arch.isX86(), Os.Tag.isSolarish(), Abi.isOpenHarmony(), etc... this obviously quickly gets out of hand. * It's nice to just have a single correct way of doing something.
2025-02-17std.Target: Remove Cpu.Arch.spu_2.Alex Rønne Petersen
This was for a hobby project that appears to be dormant for now. This can be added back if the project is resumed in the future.
2025-02-10std.ArrayList: popOrNull() -> pop() [v2] (#22720)Meghan Denny
2025-02-06adjust runtime page size APIsAndrew Kelley
* fix merge conflicts * rename the declarations * reword documentation * extract FixedBufferAllocator to separate file * take advantage of locals * remove the assertion about max alignment in Allocator API, leaving it Allocator implementation defined * fix non-inline function call in start logic The GeneralPurposeAllocator implementation is totally broken because it uses global state but I didn't address that in this commit.
2025-02-06runtime page size detectionArchbirdplus
heap.zig: define new default page sizes heap.zig: add min/max_page_size and their options lib/std/c: add miscellaneous declarations heap.zig: add pageSize() and its options switch to new page sizes, especially in GPA/stdlib mem.zig: remove page_size
2025-02-01debug: fix MemoryAccessor file leakMichael Dusan
- patch authored by Jacob Young - tested on alpine-aarch64, 3.21.0, qemu-system 9.2.0 - issue manifested on Alpine Linux aarch64 under qemu-system where zig2 fails during bootstrap: error.ProcessFdQuotaExceeded
2025-01-24std: remove old declarations now a zig1 update has happenedmlugg
2025-01-24all: update for `panic.unwrapError` and `panic.call` signature changesmlugg
2025-01-24compiler: yet more panic handler changesmlugg
* `std.builtin.Panic` -> `std.builtin.panic`, because it is a namespace. * `root.Panic` -> `root.panic` for the same reason. There are type checks so that we still allow the legacy `pub fn panic` strategy in the 0.14.0 release. * `std.debug.SimplePanic` -> `std.debug.simple_panic`, same reason. * `std.debug.NoPanic` -> `std.debug.no_panic`, same reason. * `std.debug.FormattedPanic` is now a function `std.debug.FullPanic` which takes as input a `panicFn` and returns a namespace with all the panic functions. This handles the incredibly common case of just wanting to override how the message is printed, whilst keeping nice formatted panics. * Remove `std.builtin.panic.messages`; now, every safety panic has its own function. This reduces binary bloat, as calls to these functions no longer need to prepare any arguments (aside from the error return trace). * Remove some legacy declarations, since a zig1.wasm update has happened. Most of these were related to the panic handler, but a quick grep for "zig1" brought up a couple more results too. Also, add some missing type checks to Sema. Resolves: #22584 formatted -> full
2025-01-23std.debug: Fall back to .eh_frame/.debug_frame if .eh_frame_hdr is incomplete.Alex Rønne Petersen
When using the self-hosted backends, especially in incremental mode, the .eh_frame_hdr section may be incomplete, so we can't treat it as authoritative. Instead, if we started out intending to use .eh_frame_hdr but find that it's incomplete, load .eh_frame/.debug_frame on demand and use that info going forward.
2025-01-18debug: fix `std.debug.NoPanic` compile errorsJacob Young
2025-01-16x86_64: implement union accessJacob Young
2025-01-16x86_64: implement switch jump tablesJacob Young
2024-11-29defaultPanic: @trap on 'other' targetPat Tullmann
The freestanding and other OS targets by default need to just @trap in the default Panic implementation. And `isValidMemory` won't work with freestanding or other targets. Update the unwind_freestanding.zig test case to also run on the 'other' OS target, too. This should keep the Zig's stacktrace generation from regressing on the standalone targets.
2024-11-20std.debug: Gracefully handle process_vm_readv() EPERM in MemoryAccessor.read().Alex Rønne Petersen
Closes #21815.
2024-11-04std.debug: Add handling for armeb, thumb, thumbeb, and aarch64_be.Alex Rønne Petersen
2024-10-29std.debug: watchOS: fixes for ilp32 ABI (#21765)Mario Nachbaur
Xcode requires target arm64_32 (aarch64-watchos-ilp32) in order to build code for Apple Watches. This commit fixes compilation errors that appear when compiling with that target.
2024-10-21watchOS: add os to aarch64 architectureMario Nachbaur
Needed for creating libraries that run both on physical Apple Watches and the watchOS simulator.
2024-09-26update safety test cases to new panic APIAndrew Kelley
although they would also pass simply reverted to master branch because I made the deprecated API still work for now (to be removed after 0.14.0 is tagged)
2024-09-26embrace panic helpersAndrew Kelley
Introduces `std.builtin.Panic` which is a complete interface for panicking. Provide `std.debug.FormattedPanic` and `std.debug.SimplePanic` and let the user choose, or make their own.
2024-09-16std: Restore conventional `compareFn` behavior for `binarySearch`Jay Petacat
PR #20927 made some improvements to the `binarySearch` API, but one change I found surprising was the relationship between the left-hand and right-hand parameters of `compareFn` was inverted. This is different from how comparison functions typically behave, both in other parts of Zig (e.g. `std.math.order`) and in other languages (e.g. C's `bsearch`). Unless a strong reason can be identified and documented for doing otherwise, I think it'll be better to stick with convention. While writing this patch and changing things back to the way they were, the predicates of `lowerBound` and `upperBound` seemed to be the only areas that benefited from the inversion. I don't think that benefit is worth the cost, personally. Calling `Order.invert()` in the predicates accomplishes the same goal.
2024-09-12Replace deprecated default initializations with decl literalsLinus Groh