How to do it...

Let's perform the following steps:

  1. In the running Terminal session, type the following and examine the output:
$ gdb --help
  1. Open a new Terminal tab by pressing Ctrl + Shift + T and type the following in the new tab:
$ man gdb
  1. 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
  1. Next, type the following in the available Terminal session:
$ gdb --tui -q ch05-example
  1. Once GDB is loaded, type the following:
(gdb) layout asm
(gdb) layout regs
(gdb) set args rot13 TheBrownFoxJumpsThroughTheForest
(gdb) break main
(gdb) run
  1. Next, run the following command in GDB and examine the result:
(gdb) help
  1. Press the Enter key on the keyboard to quit the help menu. Type the following command and examine the results:
(gdb) help x
  1. 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
  1. Next, type the following command:
(gdb) help info
  1. 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.
  2. Next, type the following command:
(gdb) info all-registers
  1. Type the following command and examine the output. Press the Enter key on your keyboard to continue examining the output:
(gdb) info sources
  1. Press the q key and then press the Enter key on your keyboard to return to the GDB prompt:
(gdb) help display
  1. 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
  1. Finally, type the following in the GDB prompt:
$ continue
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset