| ... | ... | @@ -113,6 +113,13 @@ pub fn detectTTYConfig() TTY.Config { |
| 113 | 113 | /// TODO multithreaded awareness |
| 114 | 114 | pub fn dumpCurrentStackTrace(start_addr: ?usize) void { |
| 115 | 115 | nosuspend { |
| 116 | if (comptime builtin.target.isWasm()) { |
| 117 | if (native_os == .wasi) { |
| 118 | const stderr = io.getStdErr().writer(); |
| 119 | stderr.print("Unable to dump stack trace: not implemented for Wasm\n", .{}) catch return; |
| 120 | } |
| 121 | return; |
| 122 | } |
| 116 | 123 | const stderr = io.getStdErr().writer(); |
| 117 | 124 | if (builtin.strip_debug_info) { |
| 118 | 125 | stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return; |
| ... | ... | @@ -134,6 +141,13 @@ pub fn dumpCurrentStackTrace(start_addr: ?usize) void { |
| 134 | 141 | /// TODO multithreaded awareness |
| 135 | 142 | pub fn dumpStackTraceFromBase(bp: usize, ip: usize) void { |
| 136 | 143 | nosuspend { |
| 144 | if (comptime builtin.target.isWasm()) { |
| 145 | if (native_os == .wasi) { |
| 146 | const stderr = io.getStdErr().writer(); |
| 147 | stderr.print("Unable to dump stack trace: not implemented for Wasm\n", .{}) catch return; |
| 148 | } |
| 149 | return; |
| 150 | } |
| 137 | 151 | const stderr = io.getStdErr().writer(); |
| 138 | 152 | if (builtin.strip_debug_info) { |
| 139 | 153 | stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return; |
| ... | ... | @@ -204,6 +218,13 @@ pub fn captureStackTrace(first_address: ?usize, stack_trace: *std.builtin.StackT |
| 204 | 218 | /// TODO multithreaded awareness |
| 205 | 219 | pub fn dumpStackTrace(stack_trace: std.builtin.StackTrace) void { |
| 206 | 220 | nosuspend { |
| 221 | if (comptime builtin.target.isWasm()) { |
| 222 | if (native_os == .wasi) { |
| 223 | const stderr = io.getStdErr().writer(); |
| 224 | stderr.print("Unable to dump stack trace: not implemented for Wasm\n", .{}) catch return; |
| 225 | } |
| 226 | return; |
| 227 | } |
| 207 | 228 | const stderr = io.getStdErr().writer(); |
| 208 | 229 | if (builtin.strip_debug_info) { |
| 209 | 230 | stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return; |
| ... | ... | @@ -1134,6 +1155,8 @@ pub const DebugInfo = struct { |
| 1134 | 1155 | return self.lookupModuleWin32(address); |
| 1135 | 1156 | } else if (native_os == .haiku) { |
| 1136 | 1157 | return self.lookupModuleHaiku(address); |
| 1158 | } else if (comptime builtin.target.isWasm()) { |
| 1159 | return self.lookupModuleWasm(address); |
| 1137 | 1160 | } else { |
| 1138 | 1161 | return self.lookupModuleDl(address); |
| 1139 | 1162 | } |
| ... | ... | @@ -1349,6 +1372,12 @@ pub const DebugInfo = struct { |
| 1349 | 1372 | _ = address; |
| 1350 | 1373 | @panic("TODO implement lookup module for Haiku"); |
| 1351 | 1374 | } |
| 1375 | |
| 1376 | fn lookupModuleWasm(self: *DebugInfo, address: usize) !*ModuleDebugInfo { |
| 1377 | _ = self; |
| 1378 | _ = address; |
| 1379 | @panic("TODO implement lookup module for Wasm"); |
| 1380 | } |
| 1352 | 1381 | }; |
| 1353 | 1382 | |
| 1354 | 1383 | pub const ModuleDebugInfo = switch (native_os) { |
| ... | ... | @@ -1628,6 +1657,13 @@ pub const ModuleDebugInfo = switch (native_os) { |
| 1628 | 1657 | return getSymbolFromDwarf(relocated_address, &self.dwarf); |
| 1629 | 1658 | } |
| 1630 | 1659 | }, |
| 1660 | .wasi => struct { |
| 1661 | pub fn getSymbolAtAddress(self: *@This(), address: usize) !SymbolInfo { |
| 1662 | _ = self; |
| 1663 | _ = address; |
| 1664 | return SymbolInfo{}; |
| 1665 | } |
| 1666 | }, |
| 1631 | 1667 | else => DW.DwarfInfo, |
| 1632 | 1668 | }; |
| 1633 | 1669 | |