Ubuntu uses quite an old version of GDB. When I need to use an updated version of GDB, here is what I do:
- Obtain the newer version of GDB by downloading its
.tar.gzfrom here. Unzip it.
- Configure and build it:
$ ./configure $ make
- The newly built GDB executable can be found at
gdb/gdbin your current directory. You can copy it or invoke it directly to use it.
Tried with: GDB 8.1 and Ubuntu 16.04