Commit abf959a0c9

Andrew Kelley <andrew@ziglang.org>
2019-05-27 08:16:05
fix debug builds of WASI
1 parent fda7e0b
Changed files (2)
doc/langref.html.in
@@ -4531,7 +4531,7 @@ const mem = std.mem;
 test "cast *[1][*]const u8 to [*]const ?[*]const u8" {
     const window_name = [1][*]const u8{c"window name"};
     const x: [*]const ?[*]const u8 = &window_name;
-    assert(mem.eql(u8, std.cstr.toSliceConst(x[0].?), "window name"));
+    assert(mem.eql(u8, std.mem.toSliceConst(u8, x[0].?), "window name"));
 }
       {#code_end#}
       {#header_close#}
std/debug.zig
@@ -85,6 +85,10 @@ fn wantTtyColor() bool {
 /// TODO multithreaded awareness
 pub fn dumpCurrentStackTrace(start_addr: ?usize) void {
     const stderr = getStderrStream() catch return;
+    if (os.wasi.is_the_target) {
+        stderr.print("Unable to dump stack trace: unimplemented on WASI\n") catch return;
+        return;
+    }
     const debug_info = getSelfDebugInfo() catch |err| {
         stderr.print("Unable to dump stack trace: Unable to open debug info: {}\n", @errorName(err)) catch return;
         return;
@@ -147,6 +151,10 @@ pub fn captureStackTrace(first_address: ?usize, stack_trace: *builtin.StackTrace
 /// TODO multithreaded awareness
 pub fn dumpStackTrace(stack_trace: builtin.StackTrace) void {
     const stderr = getStderrStream() catch return;
+    if (os.wasi.is_the_target) {
+        stderr.print("Unable to dump stack trace: unimplemented on WASI\n") catch return;
+        return;
+    }
     const debug_info = getSelfDebugInfo() catch |err| {
         stderr.print("Unable to dump stack trace: Unable to open debug info: {}\n", @errorName(err)) catch return;
         return;