| author | |
| committer | |
| log | dbda011ae67982949d59258a6ebd8f36080334fa |
| tree | 103b35ea05814ef3de34543e46e31264974b452c |
| parent | 950a9d2a10d4a2430e1c26eb49f60bfc92adff77 |
| signature |
We need to parse the `.ARM.exidx` section to be able to reliably unwind
the stack on ARM.2 files changed, 9 insertions(+), 3 deletions(-)
lib/std/debug/SelfInfo/ElfModule.zig+3-1| ... | @@ -266,8 +266,10 @@ pub fn unwindFrame(module: *const ElfModule, gpa: Allocator, di: *DebugInfo, con | ... | @@ -266,8 +266,10 @@ pub fn unwindFrame(module: *const ElfModule, gpa: Allocator, di: *DebugInfo, con |
| 266 | } | 266 | } |
| 267 | pub const UnwindContext = std.debug.SelfInfo.DwarfUnwindContext; | 267 | pub const UnwindContext = std.debug.SelfInfo.DwarfUnwindContext; |
| 268 | pub const supports_unwinding: bool = s: { | 268 | pub const supports_unwinding: bool = s: { |
| 269 | // Notably, we are yet to support unwinding on ARM. There, unwinding is not done through | ||
| 270 | // `.eh_frame`, but instead with the `.ARM.exidx` section, which has a different format. | ||
| 269 | const archs: []const std.Target.Cpu.Arch = switch (builtin.target.os.tag) { | 271 | const archs: []const std.Target.Cpu.Arch = switch (builtin.target.os.tag) { |
| 270 | .linux => &.{ .x86, .x86_64, .arm, .armeb, .thumb, .thumbeb, .aarch64, .aarch64_be }, | 272 | .linux => &.{ .x86, .x86_64, .aarch64, .aarch64_be }, |
| 271 | .netbsd => &.{ .x86, .x86_64, .aarch64, .aarch64_be }, | 273 | .netbsd => &.{ .x86, .x86_64, .aarch64, .aarch64_be }, |
| 272 | .freebsd => &.{ .x86_64, .aarch64, .aarch64_be }, | 274 | .freebsd => &.{ .x86_64, .aarch64, .aarch64_be }, |
| 273 | .openbsd => &.{.x86_64}, | 275 | .openbsd => &.{.x86_64}, |
test/src/StackTrace.zig+6-2| ... | @@ -62,8 +62,12 @@ fn addCaseTarget( | ... | @@ -62,8 +62,12 @@ fn addCaseTarget( |
| 62 | 62 | ||
| 63 | // On aarch64-macos, FP unwinding is blessed by Apple to always be reliable, and std.debug knows this. | 63 | // On aarch64-macos, FP unwinding is blessed by Apple to always be reliable, and std.debug knows this. |
| 64 | const fp_unwind_is_safe = target.result.cpu.arch == .aarch64 and target.result.os.tag.isDarwin(); | 64 | const fp_unwind_is_safe = target.result.cpu.arch == .aarch64 and target.result.os.tag.isDarwin(); |
| 65 | // On x86-windows, only FP unwinding is available. | 65 | const supports_unwind_tables = switch (target.result.os.tag) { |
| 66 | const supports_unwind_tables = target.result.os.tag != .windows or target.result.cpu.arch != .x86; | 66 | // x86-windows just has no way to do stack unwinding other then using frame pointers. |
| 67 | .windows => target.result.cpu.arch != .x86, | ||
| 68 | // We do not yet implement support for the AArch32 exception table section `.ARM.exidx`. | ||
| 69 | else => !target.result.cpu.arch.isArm(), | ||
| 70 | }; | ||
| 67 | 71 | ||
| 68 | const use_llvm_vals: []const bool = if (both_backends) &.{ true, false } else &.{true}; | 72 | const use_llvm_vals: []const bool = if (both_backends) &.{ true, false } else &.{true}; |
| 69 | const pie_vals: []const ?bool = if (both_pie) &.{ true, false } else &.{null}; | 73 | const pie_vals: []const ?bool = if (both_pie) &.{ true, false } else &.{null}; |