GDB tips
Start GDB from the command line
user@computer:~$ gdb ./mybinary
To start the the binary mybinary that lives in the current directory.
Set disassemble-flavor
(gdb) set disassembly-flavor intel
if you wan’t to change to intel flavor of assembly
Get adress of specific function
(gdb) x main
0x001122 <main>: 0x83e58955
(gdb) p main
$1 = {int (int, char **)} 0x001122 <main>
The adress is 0x001122 and as you notice both the x command and the p command gives it to us.
Run current program from inside GDB with input to stdin
(gdb) run < "AAAAAA"
Run current program from inside GDB with input from a command
(gdb) run < $(echo "this output from echo will be input to the debugged program")
Show current register values
(gdb) info registers
Read other posts