Call glibc/program functions in GDB
In GDB, we can use "call" command to execute functions, for example:
call close(1)
This can be used to close the target program's stdout. Similiarily, we can call program's own functions by call command.
By executing functions in GDB, we can hack the program to modify some behaviors of the program.
Just as the example above, we can use "call close(1)", "call newfd=open("aaa", O_APPEND | O_WRONLY), "call dup(newfd)" to redirect the program's stdout to a file.
This is very useful for program hacking.