Installing GDB -PEDA in Ubuntu

After facing many difficulties i installed GBD – PEDA, it’s is really awesome. It makes a lot of difference, if you have used older GDB.

First, install lib:
$sudo apt-get install libncurses5-dev

Than download it using GIT:

$git clone https://github.com/longld/peda.git ~/peda

After than you type the following command:

$echo “source ~/peda/peda.py” >> ~/.gdbinit

After following the above steps, Now type gdb. If you still get the older version than follow the below steps.

First remove the gdb version with:

 sudo apt-get remove gdb

Next download the old package from:

i386: http://security.ubuntu.com/ubuntu/pool/main/g/gdb/gdb_7.4-2012.02-0ubuntu2_i386.deb

amd64: http://security.ubuntu.com/ubuntu/pool/main/g/gdb/gdb_7.4-2012.02-0ubuntu2_amd64.deb

Install the package with any package manager you like e.g the ubuntu software center

Now gdb-peda works.

CPU Registers and their functionality

Registers are the internal memory locations which are used as variables.  Using registers instead of memory to store values makes the process faster. Very broadly there are four types of Registers they are General purpose registers, index registers, segment registers, pointer registers, and indicator register.

General purpose registers:

EAX, EBX, ECX, EDX.

Index registers:

ESI, EDI.

Segment registers:

CS, DS, ES, FS, GS, SS.

Pointer registers:

EIP, ESP, EBP.

Indicator register:

EFLAGS.

Functions of some Registers:

Register             Function

EAX                 Stores the return value.

EBX                  Base pointer for memory access.

ECX                  Counter for loop counter and strings.

EDX                 io pointer and arithmetic.

ESI                   source pointer for string operations

EDI                   Destination pointer for string operations

EIP                   Points to next instruction address to be executed.

ESP                  Stack pointer

EBP                 Base pointer and holds the base address of the stack.