aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug.zig
diff options
context:
space:
mode:
authorkcbanner <kcbanner@gmail.com>2023-07-06 22:02:47 -0400
committerkcbanner <kcbanner@gmail.com>2023-07-20 22:58:15 -0400
commit5f72c6508d78291d8f0358d06d407a8d6b4a28c9 (patch)
treea5f2b6043ee8ef90a64679cc5299e7d55981d384 /lib/std/debug.zig
parent8547c42ba542f77c55ce50253446fd2bf4f3592b (diff)
downloadzig-5f72c6508d78291d8f0358d06d407a8d6b4a28c9.tar.gz
zig-5f72c6508d78291d8f0358d06d407a8d6b4a28c9.zip
debug: rename StackTraceContext to ThreadContext
dwarf: use ThreadContext instead of os.ucontext_t dwarf: add regBytes impl for windows dwarf: fixup expression types for non-native
Diffstat (limited to 'lib/std/debug.zig')
-rw-r--r--lib/std/debug.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig
index 38b2cfc59b..7fac160855 100644
--- a/lib/std/debug.zig
+++ b/lib/std/debug.zig
@@ -133,7 +133,7 @@ pub fn dumpCurrentStackTrace(start_addr: ?usize) void {
}
}
-pub const StackTraceContext = blk: {
+pub const ThreadContext = blk: {
if (native_os == .windows) {
break :blk std.os.windows.CONTEXT;
} else if (have_ucontext) {
@@ -146,7 +146,7 @@ pub const StackTraceContext = blk: {
/// Tries to print the stack trace starting from the supplied base pointer to stderr,
/// unbuffered, and ignores any error returned.
/// TODO multithreaded awareness
-pub fn dumpStackTraceFromBase(context: *const StackTraceContext) void {
+pub fn dumpStackTraceFromBase(context: *const ThreadContext) void {
nosuspend {
if (comptime builtin.target.isWasm()) {
if (native_os == .wasi) {
@@ -437,7 +437,7 @@ pub const have_ucontext = @hasDecl(os.system, "ucontext_t") and
else => true,
});
-pub inline fn getContext(context: *StackTraceContext) bool {
+pub inline fn getContext(context: *ThreadContext) bool {
if (native_os == .windows) {
context.* = std.mem.zeroes(windows.CONTEXT);
windows.ntdll.RtlCaptureContext(context);
@@ -606,8 +606,8 @@ pub const StackIterator = struct {
fn next_dwarf(self: *StackIterator) !usize {
const module = try self.debug_info.?.getModuleForAddress(self.dwarf_context.pc);
if (try module.getDwarfInfoForAddress(self.debug_info.?.allocator, self.dwarf_context.pc)) |di| {
- self.dwarf_context.reg_ctx.eh_frame = true;
- self.dwarf_context.reg_ctx.is_macho = di.is_macho;
+ self.dwarf_context.reg_context.eh_frame = true;
+ self.dwarf_context.reg_context.is_macho = di.is_macho;
return di.unwindFrame(&self.dwarf_context, module.base_address);
} else return error.MissingDebugInfo;
}
@@ -663,7 +663,7 @@ pub fn writeCurrentStackTrace(
tty_config: io.tty.Config,
start_addr: ?usize,
) !void {
- var context: StackTraceContext = undefined;
+ var context: ThreadContext = undefined;
const has_context = getContext(&context);
if (native_os == .windows) {
return writeStackTraceWindows(out_stream, debug_info, tty_config, &context, start_addr);