authorgravatar for i@mgxm.meMarcio Giaxa <i@mgxm.me> 2018-12-18 16:34:51-02:00
committergravatar for i@mgxm.meMarcio Giaxa <i@mgxm.me> 2018-12-19 18:42:00-02:00
loge5b4748101ca40f5dc4082ce2cb46df0c8607417
tree82938c220f56033f111d9748fb831118b5e67e2f
parent9900f94afe5556db048b4b147bbf75ff0e0c9974

freebsd: initial stack trace

Stack trace is partially working, with only a few symbols missing. Uses the same functions that we use in Linux to get the necessary debug info.

1 files changed, 3 insertions(+), 4 deletions(-)

std/debug/index.zig+3-4
......@@ -264,7 +264,7 @@ pub fn writeCurrentStackTraceWindows(
264264pub fn printSourceAtAddress(debug_info: *DebugInfo, out_stream: var, address: usize, tty_color: bool) !void {
265265 switch (builtin.os) {
266266 builtin.Os.macosx => return printSourceAtAddressMacOs(debug_info, out_stream, address, tty_color),
267 builtin.Os.linux => return printSourceAtAddressLinux(debug_info, out_stream, address, tty_color),
267 builtin.Os.linux, builtin.Os.freebsd => return printSourceAtAddressLinux(debug_info, out_stream, address, tty_color),
268268 builtin.Os.windows => return printSourceAtAddressWindows(debug_info, out_stream, address, tty_color),
269269 else => return error.UnsupportedOperatingSystem,
270270 }
......@@ -717,7 +717,7 @@ pub const OpenSelfDebugInfoError = error{
717717
718718pub fn openSelfDebugInfo(allocator: *mem.Allocator) !DebugInfo {
719719 switch (builtin.os) {
720 builtin.Os.linux => return openSelfDebugInfoLinux(allocator),
720 builtin.Os.linux, builtin.Os.freebsd => return openSelfDebugInfoLinux(allocator),
721721 builtin.Os.macosx, builtin.Os.ios => return openSelfDebugInfoMacOs(allocator),
722722 builtin.Os.windows => return openSelfDebugInfoWindows(allocator),
723723 else => return error.UnsupportedOperatingSystem,
......@@ -1141,8 +1141,7 @@ pub const DebugInfo = switch (builtin.os) {
11411141 sect_contribs: []pdb.SectionContribEntry,
11421142 modules: []Module,
11431143 },
1144 builtin.Os.linux => DwarfInfo,
1145 builtin.Os.freebsd => struct {},
1144 builtin.Os.linux, builtin.Os.freebsd => DwarfInfo,
11461145 else => @compileError("Unsupported OS"),
11471146};
11481147