How To Install gdb-source on Ubuntu 20.04

In this tutorial we learn how to install gdb-source on Ubuntu 20.04. gdb-source is GNU Debugger (source) GNU Debugger (source)

Introduction

In this tutorial we learn how to install gdb-source on Ubuntu 20.04.

What is gdb-source

gdb-source is:

GDB is a source-level debugger, capable of breaking programs at any specific line, displaying variable values, and determining where errors occurred. Currently, gdb supports C, C++, D, Objective-C, Fortran, Java, OpenCL C, Pascal, assembly, Modula-2, Go, and Ada. A must-have for any serious programmer.

This package contains the sources and patches which are needed to build GDB.

Package: gdb-source Architecture: all Version: 9.1-0ubuntu1 Priority: optional Section: universe/devel Source: gdb Origin: Ubuntu Maintainer: Ubuntu Developers [email protected] Original-Maintainer: Héctor Orón Martínez [email protected] Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 30149 Filename: pool/universe/g/gdb/gdb-source_9.1-0ubuntu1_all.deb Size: 30589364 MD5sum: 0c213c1cceae4528d1d0601d37413665 SHA1: d443d28d479f1a06717c91da34a75b21a4076ddd SHA256: c7c04fc22696ff4ba6ed2f7eeedeece3fad15e4ac755f4f94b87c8507a877368 Homepage: http://www.gnu.org/s/gdb/ Description-en: GNU Debugger (source) GDB is a source-level debugger, capable of breaking programs at any specific line, displaying variable values, and determining where errors occurred. Currently, gdb supports C, C++, D, Objective-C, Fortran, Java, OpenCL C, Pascal, assembly, Modula-2, Go, and Ada. A must-have for any serious programmer.

This package contains the sources and patches which are needed to build GDB.

There are three methods to install gdb-source on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install gdb-source Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install gdb-source using apt-get by running the following command:

sudo apt-get -y install gdb-source

Install gdb-source Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install gdb-source using apt by running the following command:

sudo apt -y install gdb-source

Install gdb-source Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install gdb-source using aptitude by running the following command:

sudo aptitude -y install gdb-source

How To Uninstall gdb-source on Ubuntu 20.04

To uninstall only the gdb-source package we can use the following command:

sudo apt-get remove gdb-source

Uninstall gdb-source And Its Dependencies

To uninstall gdb-source and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove gdb-source

Remove gdb-source Configurations and Data

To remove gdb-source configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge gdb-source

Remove gdb-source configuration, data, and all of its dependencies

We can use the following command to remove gdb-source configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge gdb-source

References

Summary

In this tutorial we learn how to install gdb-source package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.