Programs rarely work correctly the first time. Finding bugs is called debugging, and a program that helps you find bugs is a debugger. gawk has a built-in debugger that works very similarly to the GNU Debugger, GDB.
Debuggers let you step through your program one statement at a time, examine and change variable and array values, and do a number of other things that let you understand what your program is actually doing (as opposed to what it is supposed to do).
Like most debuggers, the gawk debugger works in terms of stack frames, and lets you set both breakpoints (stop at a point in the code) and watchpoints (stop when a data value changes).
The debugger command set is fairly complete, providing control over breakpoints, execution, viewing and changing data, working with the stack, getting information, and other tasks.
If the GNU Readline library is available when gawk is compiled, it is used by the debugger to provide command-line history and editing.
Usually, the debugger does not not affect the program being debugged, but occasionally it can.