Let's perform the following steps:
- In the running Terminal session, type the following and examine the output:
$ gdb --help
- Open a new Terminal tab by pressing Ctrl + Shift + T and type the following in the new tab:
$ man gdb
- Open another new Terminal tab by pressing Ctrl + Shift + T and type the following:
$ sudo su
# echo "set disassembly-flavor intel" >> /etc/gdb/gdbinit
# exit
- Next, type the following in the available Terminal session:
$ gdb --tui -q ch05-example
- Once GDB is loaded, type the following:
(gdb) layout asm
(gdb) layout regs
(gdb) set args rot13 TheBrownFoxJumpsThroughTheForest
(gdb) break main
(gdb) run
- Next, run the following command in GDB and examine the result:
(gdb) help
- Press the Enter key on the keyboard to quit the help menu. Type the following command and examine the results:
(gdb) help x
- When you have reviewed the help menu, press the Enter key on your keyboard to quit, then type the following commands:
(gdb) x/x $eip
(gdb) x/wx $eip
(gdb) x/xw $eip
(gdb) x/gx $eip
(gdb) x/ws $eip
(gdb) x/4x $eip
(gdb) x 0xb7f65dbc
- Next, type the following command:
(gdb) help info
- Press the Enter key on your keyboard to continue reviewing the help menu. Press q and then press the Enter key on the keyboard to quit the help menu.
- Next, type the following command:
(gdb) info all-registers
- Type the following command and examine the output. Press the Enter key on your keyboard to continue examining the output:
(gdb) info sources
- Press the q key and then press the Enter key on your keyboard to return to the GDB prompt:
(gdb) help display
- Press the q key and the Enter key on the keyboard to quit the help menu. Then, type the following and review the top Register group window:
(gdb) nexti
- Finally, type the following in the GDB prompt:
$ continue