Recording calls that remain active
When A calls B and B calls C, the earlier calls can remain active while awaiting continuation. A call stack retains these relationships and the state needed to resume after the current call ends.
A layer is commonly represented by a frame, whose exact parameters, local state, and return information depend on implementation conventions. Dynamic call nesting is distinct from the lexical organization of scopes.
Backtraces describe an active path
Glibc backtrace returns addresses associated with currently active calls, which can be symbolized for diagnosis. Python inspect exposes interpreter frames and outer-call information within its own runtime model.
Keeping frame objects can retain reachable data. Python warns that frame references may create cycles and extend lifetimes, so diagnostic state itself has resource costs rather than being an entirely inert record.
Source calls need not each retain a physical frame
An inlined function can lack its own frame, and tail-call optimization can replace one frame with another. Frame-pointer omission and unavailable symbols also affect a particular backtrace interface.
Displayed depth should therefore not be equated unconditionally with source-level call count. Recursion, tail calls, exception unwinding, and diagnostics must be interpreted under the actual runtime rather than inferred solely from the stack metaphor.