aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-12-01 09:56:01 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-12-01 09:56:01 -0500
commitb36c07a95a6cf9b2cc120133b44cbd0673e6823a (patch)
tree2c2bf8ff9137d51b80ae56dc70ef9375b8c13583 /lib/std/debug.zig
parentb220be7a33a9835a1ec7a033e472830290332d57 (diff)
parent4b6740e19d57454f3c4eac0c2e9a92ce08e7ec04 (diff)
downloadzig-b36c07a95a6cf9b2cc120133b44cbd0673e6823a.tar.gz
zig-b36c07a95a6cf9b2cc120133b44cbd0673e6823a.zip
Merge remote-tracking branch 'origin/master' into remove-array-type-coercion
Diffstat (limited to 'lib/std/debug.zig')
-rw-r--r--lib/std/debug.zig10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig
index ecd3ebaef1..711f728fa6 100644
--- a/lib/std/debug.zig
+++ b/lib/std/debug.zig
@@ -1131,7 +1131,7 @@ fn openSelfDebugInfoMacOs(allocator: *mem.Allocator) !DebugInfo {
}
fn printLineFromFileAnyOs(out_stream: var, line_info: LineInfo) !void {
- var f = try File.openRead(line_info.file_name);
+ var f = try fs.cwd().openFile(line_info.file_name, .{});
defer f.close();
// TODO fstat and make sure that the file has the correct size
@@ -2089,7 +2089,7 @@ fn getLineNumberInfoMacOs(di: *DebugInfo, symbol: MachoSymbol, target_address: u
const ofile_path = mem.toSliceConst(u8, @ptrCast([*:0]const u8, di.strings.ptr + ofile.n_strx));
gop.kv.value = MachOFile{
- .bytes = try std.fs.Dir.cwd().readFileAllocAligned(
+ .bytes = try std.fs.cwd().readFileAllocAligned(
di.ofiles.allocator,
ofile_path,
maxInt(usize),
@@ -2417,6 +2417,12 @@ extern fn handleSegfaultLinux(sig: i32, info: *const os.siginfo_t, ctx_ptr: *con
std.debug.warn("Segmentation fault at address 0x{x}\n", addr);
switch (builtin.arch) {
+ .i386 => {
+ const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr));
+ const ip = @intCast(usize, ctx.mcontext.gregs[os.REG_EIP]);
+ const bp = @intCast(usize, ctx.mcontext.gregs[os.REG_EBP]);
+ dumpStackTraceFromBase(bp, ip);
+ },
.x86_64 => {
const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr));
const ip = @intCast(usize, ctx.mcontext.gregs[os.REG_RIP]);