| ... | @@ -171,8 +171,10 @@ pub fn relocateContext(context: *ThreadContext) void { | ... | @@ -171,8 +171,10 @@ pub fn relocateContext(context: *ThreadContext) void { |
| 171 | | 171 | |
| 172 | pub const have_getcontext = @hasDecl(os.system, "getcontext") and | 172 | pub const have_getcontext = @hasDecl(os.system, "getcontext") and |
| 173 | (builtin.os.tag != .linux or switch (builtin.cpu.arch) { | 173 | (builtin.os.tag != .linux or switch (builtin.cpu.arch) { |
| 174 | .x86, .x86_64 => true, | 174 | .x86, |
| 175 | else => false, | 175 | .x86_64, |
| | 176 | => true, |
| | 177 | else => builtin.link_libc and !builtin.target.isMusl(), |
| 176 | }); | 178 | }); |
| 177 | | 179 | |
| 178 | /// Capture the current context. The register values in the context will reflect the | 180 | /// Capture the current context. The register values in the context will reflect the |
| ... | @@ -652,18 +654,16 @@ pub const StackIterator = struct { | ... | @@ -652,18 +654,16 @@ pub const StackIterator = struct { |
| 652 | if (self.unwind_state) |*unwind_state| { | 654 | if (self.unwind_state) |*unwind_state| { |
| 653 | if (!unwind_state.failed) { | 655 | if (!unwind_state.failed) { |
| 654 | if (unwind_state.dwarf_context.pc == 0) return null; | 656 | if (unwind_state.dwarf_context.pc == 0) return null; |
| 655 | if (unwind_state.last_error == null) { | 657 | if (self.next_unwind()) |return_address| { |
| 656 | if (self.next_unwind()) |return_address| { | 658 | return return_address; |
| 657 | return return_address; | 659 | } else |err| { |
| 658 | } else |err| { | 660 | unwind_state.last_error = err; |
| 659 | unwind_state.last_error = err; | 661 | unwind_state.failed = true; |
| 660 | unwind_state.failed = true; | 662 | |
| 661 | | 663 | // Fall back to fp-based unwinding on the first failure. |
| 662 | // Fall back to fp-based unwinding on the first failure. | 664 | // We can't attempt it for other modules later in the |
| 663 | // We can't attempt it for other modules later in the | 665 | // stack because the full register state won't be unwound. |
| 664 | // stack because the full register state won't be unwound. | 666 | self.fp = unwind_state.dwarf_context.getFp() catch 0; |
| 665 | self.fp = unwind_state.dwarf_context.getFp() catch 0; | | |
| 666 | } | | |
| 667 | } | 667 | } |
| 668 | } | 668 | } |
| 669 | } | 669 | } |