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