Commit dbda011ae6

mlugg <mlugg@mlugg.co.uk>
2025-09-22 16:39:16
std.debug.SelfInfo: mark ARM unwinding as unsupported
We need to parse the `.ARM.exidx` section to be able to reliably unwind the stack on ARM.
1 parent 950a9d2
Changed files (2)
lib
std
debug
SelfInfo
test
lib/std/debug/SelfInfo/ElfModule.zig
@@ -266,8 +266,10 @@ pub fn unwindFrame(module: *const ElfModule, gpa: Allocator, di: *DebugInfo, con
 }
 pub const UnwindContext = std.debug.SelfInfo.DwarfUnwindContext;
 pub const supports_unwinding: bool = s: {
+    // Notably, we are yet to support unwinding on ARM. There, unwinding is not done through
+    // `.eh_frame`, but instead with the `.ARM.exidx` section, which has a different format.
     const archs: []const std.Target.Cpu.Arch = switch (builtin.target.os.tag) {
-        .linux => &.{ .x86, .x86_64, .arm, .armeb, .thumb, .thumbeb, .aarch64, .aarch64_be },
+        .linux => &.{ .x86, .x86_64, .aarch64, .aarch64_be },
         .netbsd => &.{ .x86, .x86_64, .aarch64, .aarch64_be },
         .freebsd => &.{ .x86_64, .aarch64, .aarch64_be },
         .openbsd => &.{.x86_64},
test/src/StackTrace.zig
@@ -62,8 +62,12 @@ fn addCaseTarget(
 
     // On aarch64-macos, FP unwinding is blessed by Apple to always be reliable, and std.debug knows this.
     const fp_unwind_is_safe = target.result.cpu.arch == .aarch64 and target.result.os.tag.isDarwin();
-    // On x86-windows, only FP unwinding is available.
-    const supports_unwind_tables = target.result.os.tag != .windows or target.result.cpu.arch != .x86;
+    const supports_unwind_tables = switch (target.result.os.tag) {
+        // x86-windows just has no way to do stack unwinding other then using frame pointers.
+        .windows => target.result.cpu.arch != .x86,
+        // We do not yet implement support for the AArch32 exception table section `.ARM.exidx`.
+        else => !target.result.cpu.arch.isArm(),
+    };
 
     const use_llvm_vals: []const bool = if (both_backends) &.{ true, false } else &.{true};
     const pie_vals: []const ?bool = if (both_pie) &.{ true, false } else &.{null};