authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-05-27 02:16:05-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-05-27 02:16:05-04:00
logabf959a0c90418c383cc4f10242dbcc2a2e974fd
treef436ae15908f279a0c8f25fdca3c2d6b3529286f
parentfda7e0bb01fc2fd5c9da55244bc509b6e36c50a9
signature Commit is signed but in an unrecognized format.

fix debug builds of WASI


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

doc/langref.html.in+1-1
...@@ -4531,7 +4531,7 @@ const mem = std.mem;...@@ -4531,7 +4531,7 @@ const mem = std.mem;
4531test "cast *[1][*]const u8 to [*]const ?[*]const u8" {4531test "cast *[1][*]const u8 to [*]const ?[*]const u8" {
4532 const window_name = [1][*]const u8{c"window name"};4532 const window_name = [1][*]const u8{c"window name"};
4533 const x: [*]const ?[*]const u8 = &window_name;4533 const x: [*]const ?[*]const u8 = &window_name;
4534 assert(mem.eql(u8, std.cstr.toSliceConst(x[0].?), "window name"));4534 assert(mem.eql(u8, std.mem.toSliceConst(u8, x[0].?), "window name"));
4535}4535}
4536 {#code_end#}4536 {#code_end#}
4537 {#header_close#}4537 {#header_close#}
std/debug.zig+8
...@@ -85,6 +85,10 @@ fn wantTtyColor() bool {...@@ -85,6 +85,10 @@ fn wantTtyColor() bool {
85/// TODO multithreaded awareness85/// TODO multithreaded awareness
86pub fn dumpCurrentStackTrace(start_addr: ?usize) void {86pub fn dumpCurrentStackTrace(start_addr: ?usize) void {
87 const stderr = getStderrStream() catch return;87 const stderr = getStderrStream() catch return;
88 if (os.wasi.is_the_target) {
89 stderr.print("Unable to dump stack trace: unimplemented on WASI\n") catch return;
90 return;
91 }
88 const debug_info = getSelfDebugInfo() catch |err| {92 const debug_info = getSelfDebugInfo() catch |err| {
89 stderr.print("Unable to dump stack trace: Unable to open debug info: {}\n", @errorName(err)) catch return;93 stderr.print("Unable to dump stack trace: Unable to open debug info: {}\n", @errorName(err)) catch return;
90 return;94 return;
...@@ -147,6 +151,10 @@ pub fn captureStackTrace(first_address: ?usize, stack_trace: *builtin.StackTrace...@@ -147,6 +151,10 @@ pub fn captureStackTrace(first_address: ?usize, stack_trace: *builtin.StackTrace
147/// TODO multithreaded awareness151/// TODO multithreaded awareness
148pub fn dumpStackTrace(stack_trace: builtin.StackTrace) void {152pub fn dumpStackTrace(stack_trace: builtin.StackTrace) void {
149 const stderr = getStderrStream() catch return;153 const stderr = getStderrStream() catch return;
154 if (os.wasi.is_the_target) {
155 stderr.print("Unable to dump stack trace: unimplemented on WASI\n") catch return;
156 return;
157 }
150 const debug_info = getSelfDebugInfo() catch |err| {158 const debug_info = getSelfDebugInfo() catch |err| {
151 stderr.print("Unable to dump stack trace: Unable to open debug info: {}\n", @errorName(err)) catch return;159 stderr.print("Unable to dump stack trace: Unable to open debug info: {}\n", @errorName(err)) catch return;
152 return;160 return;