Next: , Previous: Viewing And Changing Data, Up: List of Debugger Commands

14.3.4 Dealing With The Stack

Whenever you run a program which 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 which called the one you are in. The commands for doing this are:

backtrace [count]
bt [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.

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 (frame number, function and argument names, source file, and the source line) 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.

up [count]
Move count (default 1) frames up the stack toward the outermost frame. Then select and print the frame.