gawk: Debugger Invocation
1
1 14.2.1 How to Start the Debugger
1 --------------------------------
1
1 Starting the debugger is almost exactly like running 'gawk' normally,
1 except you have to pass an additional option, '--debug', or the
1 corresponding short option, '-D'. The file(s) containing the program
1 and any supporting code are given on the command line as arguments to
1 one or more '-f' options. ('gawk' is not designed to debug command-line
1 programs, only programs contained in files.) In our case, we invoke the
1 debugger like this:
1
1 $ gawk -D -f getopt.awk -f join.awk -f uniq.awk -1 inputfile
1
1 where both 'getopt.awk' and 'uniq.awk' are in '$AWKPATH'. (Experienced
1 users of GDB or similar debuggers should note that this syntax is
1 slightly different from what you are used to. With the 'gawk' debugger,
1 you give the arguments for running the program in the command line to
1 the debugger rather than as part of the 'run' command at the debugger
1 prompt.) The '-1' is an option to 'uniq.awk'.
1
1 Instead of immediately running the program on 'inputfile', as 'gawk'
1 would ordinarily do, the debugger merely loads all the program source
1 files, compiles them internally, and then gives us a prompt:
1
1 gawk>
1
1 from which we can issue commands to the debugger. At this point, no
1 code has been executed.
1