| author | |
| committer | |
| log | 2193f7c4a2b56f67bf07d27c3f715cf3969c392f |
| tree | 94ccfd7887dc5ac6d5d213eb34c4f6553b2b9938 |
| parent | f8d2b87fa122a948e2c8e1056e2ec4cfd4cf01bf |
| signature |
This implements basic DWARF output when building for the wasm target.
Stacktraces, however, are currently not supported.4 files changed, 10 insertions(+), 2 deletions(-)
lib/std/debug.zig+4| ... | @@ -114,6 +114,10 @@ pub fn detectTTYConfig() TTY.Config { | ... | @@ -114,6 +114,10 @@ pub fn detectTTYConfig() TTY.Config { |
| 114 | pub fn dumpCurrentStackTrace(start_addr: ?usize) void { | 114 | pub fn dumpCurrentStackTrace(start_addr: ?usize) void { |
| 115 | nosuspend { | 115 | nosuspend { |
| 116 | const stderr = io.getStdErr().writer(); | 116 | const stderr = io.getStdErr().writer(); |
| 117 | if (comptime builtin.target.isWasm()) { | ||
| 118 | stderr.print("Unable to dump stack trace: not implemented for Wasm\n", .{}) catch return; | ||
| 119 | return; | ||
| 120 | } | ||
| 117 | if (builtin.strip_debug_info) { | 121 | if (builtin.strip_debug_info) { |
| 118 | stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return; | 122 | stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return; |
| 119 | return; | 123 | return; |
src/stage1/codegen.cpp+3| ... | @@ -2645,6 +2645,9 @@ static LLVMValueRef ir_render_save_err_ret_addr(CodeGen *g, Stage1Air *executabl | ... | @@ -2645,6 +2645,9 @@ static LLVMValueRef ir_render_save_err_ret_addr(CodeGen *g, Stage1Air *executabl |
| 2645 | Stage1AirInstSaveErrRetAddr *save_err_ret_addr_instruction) | 2645 | Stage1AirInstSaveErrRetAddr *save_err_ret_addr_instruction) |
| 2646 | { | 2646 | { |
| 2647 | assert(g->have_err_ret_tracing); | 2647 | assert(g->have_err_ret_tracing); |
| 2648 | if ((target_is_wasm(g->zig_target) && g->zig_target->os != OsEmscripten) || target_is_bpf(g->zig_target)) { | ||
| 2649 | return nullptr; | ||
| 2650 | } | ||
| 2648 | 2651 | ||
| 2649 | LLVMValueRef return_err_fn = get_return_err_fn(g); | 2652 | LLVMValueRef return_err_fn = get_return_err_fn(g); |
| 2650 | bool is_llvm_alloca; | 2653 | bool is_llvm_alloca; |
src/stage1/target.cpp+1-1| ... | @@ -1000,7 +1000,7 @@ ZigLLVM_EnvironmentType target_default_abi(ZigLLVM_ArchType arch, Os os) { | ... | @@ -1000,7 +1000,7 @@ ZigLLVM_EnvironmentType target_default_abi(ZigLLVM_ArchType arch, Os os) { |
| 1000 | } | 1000 | } |
| 1001 | 1001 | ||
| 1002 | bool target_has_debug_info(const ZigTarget *target) { | 1002 | bool target_has_debug_info(const ZigTarget *target) { |
| 1003 | return !target_is_wasm(target); | 1003 | return true; |
| 1004 | } | 1004 | } |
| 1005 | 1005 | ||
| 1006 | bool target_long_double_is_f128(const ZigTarget *target) { | 1006 | bool target_long_double_is_f128(const ZigTarget *target) { |
src/target.zig+2-1| ... | @@ -455,7 +455,8 @@ pub fn classifyCompilerRtLibName(target: std.Target, name: []const u8) CompilerR | ... | @@ -455,7 +455,8 @@ pub fn classifyCompilerRtLibName(target: std.Target, name: []const u8) CompilerR |
| 455 | } | 455 | } |
| 456 | 456 | ||
| 457 | pub fn hasDebugInfo(target: std.Target) bool { | 457 | pub fn hasDebugInfo(target: std.Target) bool { |
| 458 | return !target.cpu.arch.isWasm(); | 458 | _ = target; |
| 459 | return true; | ||
| 459 | } | 460 | } |
| 460 | 461 | ||
| 461 | pub fn defaultCompilerRtOptimizeMode(target: std.Target) std.builtin.Mode { | 462 | pub fn defaultCompilerRtOptimizeMode(target: std.Target) std.builtin.Mode { |