10

How to upgrade my GDB debugger from the current version which is 7.7 to the next version which is 7.8, Also I'm working on Ubuntu 14.04.1?

3 Answers 3

14

gdb 7.8 is currently not available in trusty repo. But you can install it from the source.

Open terminal and type following commands

wget http://ftp.gnu.org/gnu/gdb/gdb-7.8.tar.xz
tar -xf gdb-7.8.tar.xz     
cd gdb-7.8/     
./configure
make
sudo cp gdb/gdb /usr/local/bin/gdb

It will install gdb in /usr/local/bin/ directory. As /usr/local/bin/ is searched before /usr/bin/ whenever a command is executed, running gdb will execute gdb 7.8.

Once installed, you can check gdb version using

gdb --version

It should output

GNU gdb (GDB) 7.8
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".


If you want to uninstall it simply remove gdb from /usr/local/bin/ by executing

sudo rm /usr/local/bin/gdb
6
  • Actually gdb is available in the repositories. What makes you say it is not?
    – Thomas Ward
    Sep 28, 2014 at 21:16
  • (note the gdb in the repositories is NOT 7.8. You may want to add the clarification for that in your answer here)
    – Thomas Ward
    Sep 28, 2014 at 23:15
  • Ok. It have added it. It was a typo.
    – g_p
    Sep 29, 2014 at 3:00
  • 1
    The answer didn't address the conflicts between the original and newly installed versions of gdb. Also, gdb doesn't provide means for make uninstall. So one should use sudo checkinstall to keep track of everything. A blunt make install will render a major pain if you decide to uninstall the package sometime in the future.
    – Naitree
    Jan 23, 2015 at 2:31
  • 2
    Copying to /usr/local/bin/gdb did not do the job for me. When I copied to /usr/bin, it worked, but I get the following error: Python Exception <type 'exceptions.NameError'> Installation error: gdb.execute_unwinders function is missing: Nov 11, 2015 at 18:11
2

Updating GDB from 7.7.1 to 8.2 on Ubuntu 14.04:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get -y --force-yes install gdb
gdb -v
sudo add-apt-repository --remove ppa:ubuntu-toolchain-r/test
sudo apt-get update
1

The top answer didn't work for me. For some reason I also needed this package to complete the make:

sudo apt-get install texinfo

Then I highly recommend to install this the correct way. I installed the checkinstall utility (which will create a debian package to auto-track all your files generated by make):

sudo apt-get update && sudo apt-get install checkinstall

Now call these commands:

wget http://ftp.gnu.org/gnu/gdb/gdb-7.8.tar.xz
tar -xf gdb-7.8.tar.xz     
cd gdb-7.8/     
./configure
sudo checkinstall

Verify that this crated a *.deb file in the current directory (mine was gdb_7.8-1_amd64.deb). So now let's install it the correct way, go ahead and:

  1. uninstall gdb quick
  2. set the install path of the *.deb
  3. then install it using apt-get

using these respective commands:

sudo dpkg -r gdb
sudo dpkg -i ~/gdb-7.8/gdb_7.8-1_amd64.deb
sudo apt-get install -f

Now you have a properly installed package, and you can remove it using sudo apt-get remove gdb OR sudo dpkg -r gdb. Note that I tested this with gdb 8.0.1, but I assume it should work for any version.

1
  • Uninstalling the old gdb with sudo dpkg -r gdb already made the difference: now I was able to install gdb 11 as in the README that comes with the sources. I haven't tested the checkinstall approach (yet), although it looks most reasonable.
    – V-R
    Dec 9, 2021 at 14:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .