There are a few more commands that do not fit into the previous categories, as follows:
Dump byte code of the program to standard output or to the file
named in filename. This prints a representation of the internal
gawk executes to implement the
commands in a program. This can be very enlightening, as the following
partial dump of Davide Brini’s obfuscated code
(see And Now for Something Completely Different) demonstrates:
gawk> dump -| # BEGIN -| -| [ 1:0xfcd340] Op_rule : [in_rule = BEGIN] [source_file = brini.awk]
-| [ 1:0xfcc240] Op_push_i : "~" [MALLOC|STRING|STRCUR] -| [ 1:0xfcc2a0] Op_push_i : "~" [MALLOC|STRING|STRCUR] -| [ 1:0xfcc280] Op_match : -| [ 1:0xfcc1e0] Op_store_var : O -| [ 1:0xfcc2e0] Op_push_i : "==" [MALLOC|STRING|STRCUR] -| [ 1:0xfcc340] Op_push_i : "==" [MALLOC|STRING|STRCUR] -| [ 1:0xfcc320] Op_equal : -| [ 1:0xfcc200] Op_store_var : o -| [ 1:0xfcc380] Op_push : o -| [ 1:0xfcc360] Op_plus_i : 0 [MALLOC|NUMCUR|NUMBER] -| [ 1:0xfcc220] Op_push_lhs : o [do_reference = true] -| [ 1:0xfcc300] Op_assign_plus : -| [ :0xfcc2c0] Op_pop : -| [ 1:0xfcc400] Op_push : O -| [ 1:0xfcc420] Op_push_i : "" [MALLOC|STRING|STRCUR] -| [ :0xfcc4a0] Op_no_op : -| [ 1:0xfcc480] Op_push : O -| [ :0xfcc4c0] Op_concat : [expr_count = 3] [concat_flag = 0] -| [ 1:0xfcc3c0] Op_store_var : x -| [ 1:0xfcc440] Op_push_lhs : X [do_reference = true] -| [ 1:0xfcc3a0] Op_postincrement : -| [ 1:0xfcc4e0] Op_push : x -| [ 1:0xfcc540] Op_push : o -| [ 1:0xfcc500] Op_plus : -| [ 1:0xfcc580] Op_push : o -| [ 1:0xfcc560] Op_plus : -| [ 1:0xfcc460] Op_leq : -| [ :0xfcc5c0] Op_jmp_false : [target_jmp = 0xfcc5e0] -| [ 1:0xfcc600] Op_push_i : "%c" [MALLOC|STRING|STRCUR] -| [ :0xfcc660] Op_no_op : -| [ 1:0xfcc520] Op_assign_concat : c -| [ :0xfcc620] Op_jmp : [target_jmp = 0xfcc440] … -| [ 2:0xfcc5a0] Op_K_printf : [expr_count = 17] [redir_type = ""] -| [ :0xfcc140] Op_no_op : -| [ :0xfcc1c0] Op_atexit : -| [ :0xfcc640] Op_stop : -| [ :0xfcc180] Op_no_op : -| [ :0xfcd150] Op_after_beginfile :
-| [ :0xfcc160] Op_no_op : -| [ :0xfcc1a0] Op_after_endfile : gawk>
Exit the debugger. See the entry for ‘quit’, later in this list.
Print a list of all of the
gawk debugger commands with a short
summary of their usage. ‘help command’ prints the information
about the command command.
+| n | filename
:n | n–m | function]
+| n | filename
:n | n–m | function]
Print the specified lines (default 15) from the current source file
or the file named filename. The possible arguments to
are as follows:
Print lines before the lines last printed.
Print lines after the lines last printed.
list without any argument does the same thing.
Print lines centered around line number n.
Print lines from n to m.
Print lines centered around line number n in source file filename. This command may change the current source file.
Print lines centered around the beginning of the function function. This command may change the current source file.
Exit the debugger. Debugging is great fun, but sometimes we all have to tend to other obligations in life, and sometimes we find the bug and are free to go on to the next one! As we saw earlier, if you are running a program, the debugger warns you when you type ‘q’ or ‘quit’, to make sure you really want to quit.
Turn on or off continuous printing of the instructions that are about to
be executed, along with the
awk lines they
implement. The default is
It is to be hoped that most of the “opcodes” in these instructions are
fairly self-explanatory, and using
trace is on will make them into familiar friends.