You can use
std.debug.dumpCurrentStackTrace(null);
e.g.:
const std = @import("std");
fn test1() void {
test2();
}
fn test2() void {
test3();
}
fn test3() void {
std.debug.dumpCurrentStackTrace(null);
}
pub fn main() void {
test1();
}