GDB - Installation


Before you go for installation, check if you already have gdb installed on your Unix system by issuing the following command:

$gdb -help 

If GDB is installed, then it will display all the available options within your GDB. If GDB is not installed, then proceed for a fresh installation.

You can install GDB on your system by following the simple steps discussed below.

step 1: Make sure you have the prerequisites for installing gdb:

  • An ANSI-compliant C compiler (gcc is recommended - note that gdb can debug codes generated by other compilers)

  • 115 MB of free disk space is required on the partition on which you're going to build gdb.

  • 20 MB of free disk space is required on the partition on which you're going to install gdb.

  • GNU's decompression program, gzip

  • The make utility - the GNU version is known to work without a problem, others probably do as well.

step 2: Download the gdb source distribution from (We used gdb-6.6.tar.gz for these instructions.) Place the distribution files in your build directory.

step 3: In your build directory, decompress gdb-6.6.tar.gz and extract the source files from the archive. Once the files have finished extracting, change your working directory to the gdb-6.6 directory that was automatically created in your build directory.

$ build> gzip -d gdb-6.6.tar.gz 
$ build> tar xfv gdb-6.6.tar 
$ build> cd gdb-6.6 

step 4: Run the configure script to configure the source tree for your platform.

$ gdb-6.6> .⁄configure 

step 5: Build gdb using the make utility.

$ gdb-6.6> make 

step 6: Login as root and install gdb using the following command.

$ gdb-6.6> make install 

step 7: If required, disk space can be reclaimed by deleting the gdb build directory and the archive file after the installation is complete.

$ gdb-6.6> cd .. 
$ build> rm -r gdb-6.6 
$ build> rm gdb-6.6.tar 

You now have gdb installed on your system and it is ready to use.