authorgravatar for kcbanner@gmail.comCasey Banner <kcbanner@gmail.com> 2023-05-25 09:52:58-04:00
committergravatar for kcbanner@gmail.comCasey Banner <kcbanner@gmail.com> 2023-07-20 22:58:13-04:00
logd1a9bb1fea6491fb9ad4ad7552d8edf816c59aef
tree3de3c6899cf5a157bd1284d02aec54fd9b007d42
parenta325d7f6d197f7ec1bb6b658075feb8b9e30a264

debug: fixup context detection for wasi


1 files changed, 3 insertions(+), 2 deletions(-)

lib/std/debug.zig+3-2
...@@ -411,7 +411,8 @@ pub const StackIterator = struct {...@@ -411,7 +411,8 @@ pub const StackIterator = struct {
411 // When DebugInfo and a register context is available, this iterator can unwind411 // When DebugInfo and a register context is available, this iterator can unwind
412 // stacks with frames that don't use a frame pointer (ie. -fomit-frame-pointer).412 // stacks with frames that don't use a frame pointer (ie. -fomit-frame-pointer).
413 debug_info: ?*DebugInfo,413 debug_info: ?*DebugInfo,
414 dwarf_context: if (@hasDecl(os, "ucontext_t")) DW.UnwindContext else void = undefined,414 dwarf_context: if (supports_context) DW.UnwindContext else void = undefined,
415 const supports_context = @hasDecl(os.system, "ucontext_t");
415416
416 pub fn init(first_address: ?usize, fp: ?usize) StackIterator {417 pub fn init(first_address: ?usize, fp: ?usize) StackIterator {
417 if (native_arch == .sparc64) {418 if (native_arch == .sparc64) {
...@@ -526,7 +527,7 @@ pub const StackIterator = struct {...@@ -526,7 +527,7 @@ pub const StackIterator = struct {
526 }527 }
527528
528 fn next_internal(self: *StackIterator) ?usize {529 fn next_internal(self: *StackIterator) ?usize {
529 if (self.debug_info != null) {530 if (supports_context and self.debug_info != null) {
530 if (self.next_dwarf()) |_| {531 if (self.next_dwarf()) |_| {
531 return self.dwarf_context.pc;532 return self.dwarf_context.pc;
532 } else |err| {533 } else |err| {