gawk: Debugging Concepts

1 
1 14.1.1 Debugging in General
1 ---------------------------
1 
1 (If you have used debuggers in other languages, you may want to skip
1 ahead to ⇒Awk Debugging.)
1 
1    Of course, a debugging program cannot remove bugs for you, because it
1 has no way of knowing what you or your users consider a "bug" versus a
1 "feature."  (Sometimes, we humans have a hard time with this ourselves.)
1 In that case, what can you expect from such a tool?  The answer to that
1 depends on the language being debugged, but in general, you can expect
1 at least the following:
1 
1    * The ability to watch a program execute its instructions one by one,
1      giving you, the programmer, the opportunity to think about what is
1      happening on a time scale of seconds, minutes, or hours, rather
1      than the nanosecond time scale at which the code usually runs.
1 
1    * The opportunity to not only passively observe the operation of your
1      program, but to control it and try different paths of execution,
1      without having to change your source files.
1 
1    * The chance to see the values of data in the program at any point in
1      execution, and also to change that data on the fly, to see how that
1      affects what happens afterward.  (This often includes the ability
1      to look at internal data structures besides the variables you
1      actually defined in your code.)
1 
1    * The ability to obtain additional information about your program's
1      state or even its internal structure.
1 
1    All of these tools provide a great amount of help in using your own
1 skills and understanding of the goals of your program to find where it
1 is going wrong (or, for that matter, to better comprehend a perfectly
1 functional program that you or someone else wrote).
1