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 {...@@ -171,8 +171,10 @@ pub fn relocateContext(context: *ThreadContext) void {
171171
172pub const have_getcontext = @hasDecl(os.system, "getcontext") and172pub 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});
177179
178/// Capture the current context. The register values in the context will reflect the180/// 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
661663 // 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 the665 // 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 }