gawk: Execution Stack

 
 14.3.4 Working with the Stack
 -----------------------------
 
 Whenever you run a program that contains any function calls, 'gawk'
 maintains a stack of all of the function calls leading up to where the
 program is right now.  You can see how you got to where you are, and
 also move around in the stack to see what the state of things was in the
 functions that called the one you are in.  The commands for doing this
 are:
 
 'backtrace' [COUNT]
 'bt' [COUNT]
 'where' [COUNT]
      Print a backtrace of all function calls (stack frames), or
      innermost COUNT frames if COUNT > 0.  Print the outermost COUNT
      frames if COUNT < 0.  The backtrace displays the name and arguments
      to each function, the source file name, and the line number.  The
      alias 'where' for 'backtrace' is provided for longtime GDB users
      who may be used to that command.
 
 'down' [COUNT]
      Move COUNT (default 1) frames down the stack toward the innermost
      frame.  Then select and print the frame.
 
 'frame' [N]
 'f' [N]
      Select and print stack frame N.  Frame 0 is the currently
      executing, or "innermost", frame (function call); frame 1 is the
      frame that called the innermost one.  The highest-numbered frame is
      the one for the main program.  The printed information consists of
      the frame number, function and argument names, source file, and the
      source line.
 
 'up' [COUNT]
      Move COUNT (default 1) frames up the stack toward the outermost
      frame.  Then select and print the frame.