Previous: , Up: Debugging   [Contents][Index]


14.1.3 awk Debugging

Debugging an awk program has some specific aspects that are not shared with programs written in other languages.

First of all, the fact that awk programs usually take input line by line from a file or files and operate on those lines using specific rules makes it especially useful to organize viewing the execution of the program in terms of these rules. As we will see, each awk rule is treated almost like a function call, with its own specific block of instructions.

In addition, because awk is by design a very concise language, it is easy to lose sight of everything that is going on “inside” each line of awk code. The debugger provides the opportunity to look at the individual primitive instructions carried out by the higher-level awk commands.96


Footnotes

(96)

The “primitive instructions” are defined by gawk itself; the debugger does not work at the level of machine instructions.