aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug.zig
diff options
context:
space:
mode:
authorkcbanner <kcbanner@gmail.com>2023-05-25 09:52:58 -0400
committerkcbanner <kcbanner@gmail.com>2023-07-20 22:58:13 -0400
commitd1a9bb1fea6491fb9ad4ad7552d8edf816c59aef (patch)
tree3de3c6899cf5a157bd1284d02aec54fd9b007d42 /lib/std/debug.zig
parenta325d7f6d197f7ec1bb6b658075feb8b9e30a264 (diff)
downloadzig-d1a9bb1fea6491fb9ad4ad7552d8edf816c59aef.tar.gz
zig-d1a9bb1fea6491fb9ad4ad7552d8edf816c59aef.zip
debug: fixup context detection for wasi
Diffstat (limited to 'lib/std/debug.zig')
-rw-r--r--lib/std/debug.zig5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig
index af2fe20b76..2652ad57a8 100644
--- a/lib/std/debug.zig
+++ b/lib/std/debug.zig
@@ -411,7 +411,8 @@ pub const StackIterator = struct {
// When DebugInfo and a register context is available, this iterator can unwind
// stacks with frames that don't use a frame pointer (ie. -fomit-frame-pointer).
debug_info: ?*DebugInfo,
- dwarf_context: if (@hasDecl(os, "ucontext_t")) DW.UnwindContext else void = undefined,
+ dwarf_context: if (supports_context) DW.UnwindContext else void = undefined,
+ const supports_context = @hasDecl(os.system, "ucontext_t");
pub fn init(first_address: ?usize, fp: ?usize) StackIterator {
if (native_arch == .sparc64) {
@@ -526,7 +527,7 @@ pub const StackIterator = struct {
}
fn next_internal(self: *StackIterator) ?usize {
- if (self.debug_info != null) {
+ if (supports_context and self.debug_info != null) {
if (self.next_dwarf()) |_| {
return self.dwarf_context.pc;
} else |err| {