From 95bdb0c1c65c128923ffac3f4be6b4619eb4a54b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Fri, 3 Oct 2025 03:45:52 +0200 Subject: [PATCH] std.debug.Dwarf.SelfUnwinder: default some s390x registers to the same-value rule --- lib/std/debug/Dwarf/SelfUnwinder.zig | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/std/debug/Dwarf/SelfUnwinder.zig b/lib/std/debug/Dwarf/SelfUnwinder.zig index c0a44b6a09..3a7b70b037 100644 --- a/lib/std/debug/Dwarf/SelfUnwinder.zig +++ b/lib/std/debug/Dwarf/SelfUnwinder.zig @@ -197,9 +197,13 @@ fn nextInner(unwinder: *SelfUnwinder, gpa: Allocator, cache_entry: *const CacheE // If unspecified, we'll use the default rule for the return address register, which is // typically equivalent to `.undefined` (meaning there is no return address), but may be // overriden by ABIs. - var has_return_address: bool = builtin.cpu.arch.isAARCH64() and - return_address_register >= 19 and - return_address_register <= 28; + var has_return_address: bool = switch (builtin.cpu.arch) { + // DWARF for the Arm 64-bit Architecture (AArch64) §4.3, p1 + .aarch64, .aarch64_be => return_address_register >= 19 and return_address_register <= 28, + // ELF ABI s390x Supplement §1.6.4 + .s390x => return_address_register >= 6 and return_address_register <= 15, + else => false, + }; // Create a copy of the CPU state, to which we will apply the new rules. var new_cpu_state = unwinder.cpu_state;