fix debug builds of WASI

This commit is contained in:
Andrew Kelley 2019-05-27 02:16:05 -04:00
parent fda7e0bb01
commit abf959a0c9
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
2 changed files with 9 additions and 1 deletions

View File

@ -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#}

View File

@ -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;