Posts

GDB - A quick reference

GDB - A quick reference gdb program-name gdb program-name core-file gdb program-name process-id - GDB gets attached to the running process with its id equal to given process-id; Note that the running process pauses. Now some variable value can be set and process can be detached. (gdb prompt) attach process-id - Attaches GDB to given process ID (gdb prompt) detach - detaches the process attached. gdb -q -q stands for quite; No copyright printed b(break) main - Put a breakpoint at the beginning of the program b(break) - Put a breakpoint at the next line ( current line makes no sense) b(break) N - Put a breakpoint at line N b(break) filename:N - Put a breakpoint at line N in file filename b(break) class::func - To put a break point in C++ function b(break) +N - Put a breakpoint N lines down from the current line b(break) -N - Put a breakpoint N lines up from the current line b(break) fn - Put a breakpoint at the beginning of function "fn" b(break) if (exprsn) - Any for...

AWK - quick reference

AWK awk is an extremely versatile pattern matching and processing language. Although "awk scripts" can be written simply on the command line, more sophisticated use involves script files. Where the shell language is geared to running various utilities, the awk language is geared to extracting information from files according to rules and patterns. As a programming language (which looks much like C in some respects), awk has the usual selection, loop, and condition constructs, and has variables. Awk variables are not referenced with a leading $ as in the shell, except for the variables representing fields in the input line: $1, $2, ... . See below. As with the shell, comments come after the # character. To invoke an awk script is similar to the first method for shell scripts (an awk script cannot be made executable, however, an executable shell script with a here-document for awk could be used): awk -f script-file input-files If is missing, awk looks for input from stdin. Th...