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(...@@ -264,7 +264,7 @@ pub fn writeCurrentStackTraceWindows(
264pub fn printSourceAtAddress(debug_info: *DebugInfo, out_stream: var, address: usize, tty_color: bool) !void {264pub fn printSourceAtAddress(debug_info: *DebugInfo, out_stream: var, address: usize, tty_color: bool) !void {
265 switch (builtin.os) {265 switch (builtin.os) {
266 builtin.Os.macosx => return printSourceAtAddressMacOs(debug_info, out_stream, address, tty_color),266 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),
268 builtin.Os.windows => return printSourceAtAddressWindows(debug_info, out_stream, address, tty_color),268 builtin.Os.windows => return printSourceAtAddressWindows(debug_info, out_stream, address, tty_color),
269 else => return error.UnsupportedOperatingSystem,269 else => return error.UnsupportedOperatingSystem,
270 }270 }
...@@ -717,7 +717,7 @@ pub const OpenSelfDebugInfoError = error{...@@ -717,7 +717,7 @@ pub const OpenSelfDebugInfoError = error{
717717
718pub fn openSelfDebugInfo(allocator: *mem.Allocator) !DebugInfo {718pub fn openSelfDebugInfo(allocator: *mem.Allocator) !DebugInfo {
719 switch (builtin.os) {719 switch (builtin.os) {
720 builtin.Os.linux => return openSelfDebugInfoLinux(allocator),720 builtin.Os.linux, builtin.Os.freebsd => return openSelfDebugInfoLinux(allocator),
721 builtin.Os.macosx, builtin.Os.ios => return openSelfDebugInfoMacOs(allocator),721 builtin.Os.macosx, builtin.Os.ios => return openSelfDebugInfoMacOs(allocator),
722 builtin.Os.windows => return openSelfDebugInfoWindows(allocator),722 builtin.Os.windows => return openSelfDebugInfoWindows(allocator),
723 else => return error.UnsupportedOperatingSystem,723 else => return error.UnsupportedOperatingSystem,
...@@ -1141,8 +1141,7 @@ pub const DebugInfo = switch (builtin.os) {...@@ -1141,8 +1141,7 @@ pub const DebugInfo = switch (builtin.os) {
1141 sect_contribs: []pdb.SectionContribEntry,1141 sect_contribs: []pdb.SectionContribEntry,
1142 modules: []Module,1142 modules: []Module,
1143 },1143 },
1144 builtin.Os.linux => DwarfInfo,1144 builtin.Os.linux, builtin.Os.freebsd => DwarfInfo,
1145 builtin.Os.freebsd => struct {},
1146 else => @compileError("Unsupported OS"),1145 else => @compileError("Unsupported OS"),
1147};1146};
11481147