From 099a95041054e456ebefbd75f6a4f9f6961002be Mon Sep 17 00:00:00 2001 From: mlugg Date: Fri, 19 Sep 2025 13:35:12 +0100 Subject: std.debug.SelfInfo: thread safety This has been a TODO for ages, but in the past it didn't really matter because stack traces are typically printed to stderr for which a mutex is held so in practice there was a mutex guarding usage of `SelfInfo`. However, now that `SelfInfo` is also used for simply capturing traces, thread safety is needed. Instead of just a single mutex, though, there are a couple of different mutexes involved; this helps make critical sections smaller, particularly when unwinding the stack as `unwindFrame` doesn't typically need to hold any lock at all. --- lib/std/debug/Dwarf.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/std/debug/Dwarf.zig') diff --git a/lib/std/debug/Dwarf.zig b/lib/std/debug/Dwarf.zig index 655a65b709..3934777ea5 100644 --- a/lib/std/debug/Dwarf.zig +++ b/lib/std/debug/Dwarf.zig @@ -346,7 +346,7 @@ pub fn deinit(di: *Dwarf, gpa: Allocator) void { di.* = undefined; } -pub fn getSymbolName(di: *Dwarf, address: u64) ?[]const u8 { +pub fn getSymbolName(di: *const Dwarf, address: u64) ?[]const u8 { // Iterate the function list backwards so that we see child DIEs before their parents. This is // important because `DW_TAG_inlined_subroutine` DIEs will have a range which is a sub-range of // their caller, and we want to return the callee's name, not the caller's. -- cgit v1.2.3