It would be nice if computer programs worked perfectly the first time
they were run, but in real life, this rarely happens for programs of any
complexity. Thus, most programming languages have facilities available
for “debugging” programs, and now
gawk debugger is purposely
modeled after the GNU Debugger
(GDB) command-line debugger. If you are familiar with GDB, learning how to use
gawk for debugging your program is easy.
This section introduces debugging in general and begins
the discussion of debugging in
(If you have used debuggers in other languages, you may want to skip ahead to awk Debugging.)
Of course, a debugging program cannot remove bugs for you, because it has no way of knowing what you or your users consider a “bug” versus a “feature.” (Sometimes, we humans have a hard time with this ourselves.) In that case, what can you expect from such a tool? The answer to that depends on the language being debugged, but in general, you can expect at least the following:
The ability to watch a program execute its instructions one by one, giving you, the programmer, the opportunity to think about what is happening on a time scale of seconds, minutes, or hours, rather than the nanosecond time scale at which the code usually runs.
The opportunity to not only passively observe the operation of your program, but to control it and try different paths of execution, without having ...