How do I determine the current stack frame depth?
fn print_depths() {
println!("stack frame depth {}", stack_frame_depth());
fn print_depth2() {
println!("stack frame depth {}", stack_frame_depth());
}
print_depth2();
}
pub fn main() {
print_depths();
}
would print
stack frame depth 1
stack frame depth 2
I know main
has callers so the particular numbers might be different.
I have tried stacker::remaining_stack
. However, that prints a count of bytes. Since the arguments passed to a function affect the "stack byte height" then it is not possible to derive a simple "function call height". I want a count of the current function call height.