authorgravatar for kcbanner@gmail.comCasey Banner <kcbanner@gmail.com> 2023-07-11 01:06:41-04:00
committergravatar for kcbanner@gmail.comCasey Banner <kcbanner@gmail.com> 2023-07-20 22:58:15-04:00
log9b25bee42c9c86d47ff21580a0ee58e8e14d3989
tree1a282aced5207b095f0db5986cf3e76ac4b3c0dc
parente5aa2bb2246e79f47c39c281d51cc9b5a6d89d04

debug: fixup have_getcontext


1 files changed, 14 insertions(+), 14 deletions(-)

lib/std/debug.zig+14-14
......@@ -171,8 +171,10 @@ pub fn relocateContext(context: *ThreadContext) void {
171171
172172pub const have_getcontext = @hasDecl(os.system, "getcontext") and
173173 (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(),
176178});
177179
178180/// Capture the current context. The register values in the context will reflect the
......@@ -652,18 +654,16 @@ pub const StackIterator = struct {
652654 if (self.unwind_state) |*unwind_state| {
653655 if (!unwind_state.failed) {
654656 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;
667667 }
668668 }
669669 }