319 Commits

Author SHA1 Message Date
Alex Rønne Petersen 2681d4abc3 std.debug.Dwarf.expression: fix a couple of failing tests on x32/n32
The upper half of the register was left undefined on these ABIs, causing an
@intCast inside the stack machine to fail.
2026-06-18 03:59:15 +02:00
Alex Rønne Petersen 038698738f std.debug.SelfInfo.Elf: enable unwind support on x32/n32
closes https://codeberg.org/ziglang/zig/issues/32056
2026-06-16 12:13:04 +02:00
Alex Rønne Petersen 4261825766 std.debug.Dwarf: fix unwinding when address size is smaller than register size 2026-06-16 12:12:05 +02:00
Alex Rønne Petersen cf13ecab29 std.debug.cpu_context: always declare a Gpr type on Native 2026-06-16 12:09:31 +02:00
David Senoner c91727108e Replace usages of ArrayHashMapUnmanaged with array_hash_map.Custom 2026-06-10 16:14:58 +02:00
David Senoner 37651eea89 Replace usages of AutoArrayHashMapUnmanaged with array_hash_map.Auto 2026-06-10 16:14:58 +02:00
David Senoner d23e22c416 Replace usages of StringArrayHashMapUnmanaged with array_hash_map.String 2026-06-10 16:14:53 +02:00
Alex Rønne Petersen 9cc9779ba0 std.debug.cpu_context: fix compile errors on alpha 2026-05-31 06:17:58 +02:00
Alex Rønne Petersen a4058856a4 std.debug.cpu_context: fix compile error on arc 2026-05-30 18:45:44 +02:00
Alex Rønne Petersen 64958c2b17 std.debug.SelfInfo.Elf: xtensa does not support DWARF CFI 2026-05-29 07:26:21 +02:00
Matthew Lugg 89f86e46d2 std: don't use dyld functions on non-macOS Darwin
65922a2d4 started using some (deprecated but still available) dyld
functions for stack unwinding and debug information on Darwin targets,
because they are significantly faster than `dladdr` (which is the
"correct" thing to use). However, these functions are unavailable on
Darwin targets other than macOS, for instance on iOS. Therefore, on
those targets, we must fall back to the slow `dladdr` path.
2026-05-28 08:54:23 +01:00
mlugg 3f1dead2fc Merge pull request 'Use struct-of-arrays style for std.lang.Type' (#35234) from Der_Teufel/zig:soa-builtin-type into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35234
2026-05-28 09:45:54 +02:00
Alex Rønne Petersen 7ee6e7d61e std.debug.Dwarf.Unwind.VM: deal with negative offsets in unsigned CFI insns
The DWARF spec has CFI instructions that take signed offsets, but at least LLVM
always emits the unsigned variants, even for e.g. `.cfi_def_cfa_offset -4`.
2026-05-28 04:03:47 +02:00
Krzysztof Wolicki 9e80795623 all: update to use new std.lang.Type definitions 2026-05-27 10:03:51 +01:00
Alex Rønne Petersen 197ba11787 std.debug.SelfInfo.Elf: update lists of supported architectures 2026-05-27 00:28:15 +02:00
Alex Rønne Petersen 5c64311fab std.debug.cpu_context: add mcontext_t for x86-freebsd 2026-05-27 00:28:00 +02:00
Alex Rønne Petersen 833c6d9792 std.debug.cpu_context: add missing align(16) on x86_64-freebsd mcontext_t 2026-05-27 00:28:00 +02:00
Alex Rønne Petersen 6aa6a07955 std.debug.cpu_context: add mcontext_t for hppa-linux and hppa64-linux 2026-05-27 00:28:00 +02:00
Alex Rønne Petersen 12790e69a7 std.debug.cpu_context: add mcontext_t for hppa-netbsd 2026-05-27 00:27:06 +02:00
Alex Rønne Petersen 7d5e400911 std.debug.cpu_context: sheb-openbsd doesn't exist 2026-05-26 23:30:48 +02:00
Alex Rønne Petersen f3a7a4c5e2 Merge pull request 'NetBSD 11.0 cross libc support' (#35464) from alexrp/zig:netbsd-11 into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35464
2026-05-26 20:55:53 +02:00
Carl Åstholm fc3406a961 std.debug.Pdb: deduplicate inline source locations
Previously, if the same inline function was called multiple times
by the same caller, the inline function's frame would be repeated
multiple times, once for each prior call.
2026-05-26 20:37:09 +02:00
Alex Rønne Petersen 6ed30064d3 std.debug.cpu_context: add mcontext_t for riscv32-netbsd and riscv64-netbsd 2026-05-26 15:40:42 +02:00
Alex Rønne Petersen 79e87e5753 std.debug: add m88k-openbsd support
closes https://codeberg.org/ziglang/zig/issues/31817
2026-05-23 11:02:56 +02:00
Alex Rønne Petersen a439978f05 std.debug.cpu_context: fix alpha-openbsd ucontext_t
These fields need to be wrapped in an mcontext field so the common code in
fromPosixSignalContext() can work with it.
2026-05-23 11:02:38 +02:00
Mai-Lapyst 7534ac7367 Adding more support for DEC Alpha to std
This adds support to std, primarily for linux, to support the Alpha architecture.

closes #30940
closes #30926
2026-05-23 06:15:24 +02:00
Alex Rønne Petersen 3b3833acf7 remove remnants of {m68k,powerpc,sparc64}-haiku support
These ports of Haiku have been nonfunctional/incomplete for years. We do not
generally treat such ports as "real" targets.

https://codeberg.org/ziglang/ziglang.org/commit/1efffd83ffd4078cea456c80ae806259207530ad
2026-05-21 06:38:51 +02:00
Matthew Lugg fdac89d6cd remove uses of array multiplication
In preparation for its removal as accepted in
https://github.com/ziglang/zig/issues/24738.
2026-04-30 08:57:51 +01:00
andrew.kraevskii bbab366b78 Audit usages of toOwnedSlice (#32001)
Followup to #30769

I grepped for `try .*toOwnedSlice` and checked all of them by hand.

Fixes a bunch of memory leaks removes usages or `errdefer` and `vars` in some places. I also switched array_list.Managed to ArrayList where it was convenient.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32001
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-22 19:35:46 +02:00
Ryan Liptak 3252a05531 Prefer <err> => |e| return e over <err> => return <err>
Avoids the potential for a typo on the `return <err>` side of the prong
2026-04-20 18:03:14 -07:00
Mason Remaley 6707a5efee Arena allocates text 2026-04-13 01:30:14 -07:00
Mason Remaley 4ad665d3c8 Writes symbols to array list argument 2026-04-12 23:50:24 -07:00
Mason Remaley e968e6d004 Fixes typos/out of date comments, switches to unstable sort 2026-04-12 14:09:22 -07:00
Mason Remaley df2413cf69 Removes dead code, updates some tests, fixes typos in comments, formats 2026-04-12 04:01:30 -07:00
Mason Remaley 312ef9558b Mitigation for bug that results in reuse of inlinee IDs when functions share names 2026-04-12 04:01:30 -07:00
Mason Remaley cbd7f54f06 Use readers to simplify PDB parsing 2026-04-12 04:01:30 -07:00
Mason Remaley 334f40576e Cleans up some PDB parsing logic 2026-04-12 04:01:30 -07:00
Mason Remaley 4efbb27aa2 Don't bother resolving symbol names that won't be used
Also fixes some memory management issues
2026-04-12 04:01:30 -07:00
Mason Remaley f6a3a0ca72 Replaces the inline symbol iterator with an array of symbols
The intention behind the iterator was to avoid needing to allocate the
symbols, but in practice we need to allocate them anyway since we need
to reverse their order and don't have random access. The alternative
would be an N^2 algorithm.

In practice this isn't that bad, because even if the allocation fails,
we'll still end up printing the address, so the user still ends up with
the necessary information to reconstruct the crash. I don't think it's
worth it to try to set up some kind of ring buffer or return partial
results on failure, but may revisit this.
2026-04-12 04:01:30 -07:00
Mason Remaley 5a4b5c8b94 Uses dwarf iterator if dwarf symbols found for windows executable 2026-04-12 04:01:30 -07:00
Mason Remaley dcdb562c15 Adds support for running the trace tests through darling, fixes compilation errors in MachO due to interface change 2026-04-12 04:01:30 -07:00
Mason Remaley 492efd4c06 Adds support for running stack and error trace tests through Wine
Also fixes minor bug that was preventing existing tests from passing on
32 bit Windows
2026-04-12 04:01:30 -07:00
Mason Remaley cc15c8ae7e Cleans up binary annotation opcodes that we don't handle 2026-04-12 04:01:29 -07:00
Mason Remaley fa26ab6fa3 Cleans up handling of signed line deltas 2026-04-12 04:01:29 -07:00
Mason Remaley 7ec2f2b27d Cleans up, implements handling for the change file binary annotation 2026-04-12 04:01:29 -07:00
Mason Remaley a1a8dd1b40 Filters out duplicate sites, outputs compile unit name 2026-04-12 04:01:29 -07:00
Mason Remaley 781bab193b Iterates inline sites in the correct order 2026-04-12 04:01:29 -07:00
Mason Remaley 5c6885be53 Fixes bug that would stop iterating inline site syms early
This fix reveals another bug--we need to display the inline site syms in
the reverse of the encoded order. The parent/child relationships are
actually encoded on the inline sites, but it's likely a bit fragile to
try to trace those, and also more complex. As long as there aren't
multiple matches this is fine, and if there are, tracing the parent/child
chain won't work anyway.
2026-04-12 04:01:29 -07:00
Mason Remaley 22f9592dc7 First pass at reading inline info from PDBs 2026-04-12 04:01:29 -07:00
Corentin Kerisit 07f05426fc Support ld64.ldd STABS layout in MachOFile.load
Apple's ld emit N_BNSYM and N_ENSYM to mark the start and end of
functions, while ld64.lld doesn't.

This resulted in MachOFile.load bailing out on unsupported STABS
layout when the linker used is ld64.lld.

This commit supports both layouts.
2026-04-12 01:23:17 +02:00