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