How To Install eclipse-cdt-valgrind on Ubuntu 18.04

In this tutorial we learn how to install eclipse-cdt-valgrind on Ubuntu 18.04. eclipse-cdt-valgrind is Valgrind integration for Eclipse CDT

Introduction

In this tutorial we learn how to install eclipse-cdt-valgrind on Ubuntu 18.04.

What is eclipse-cdt-valgrind

eclipse-cdt-valgrind is:

The Linux Tools Project Valgrind plugin aims to provide simple and effective profiling for the C/C++ Development Tools.

Integration of these tools from Valgrind suite is provided:

  • Memcheck *

Memcheck is a tool that detects memory management problems. It is Valgrind’s most popular tool and seemingly the most mature. Memcheck’s output is rather straight forward - it is a series of errors along with stack trace information.

The Valgrind View presents this output using a TreeViewer with the errors as top-level elements.

The stack trace is presented underneath the error and when a frame is double-clicked an editor will open and go to the line in question.

Markers represent memcheck errors inside the editor and are linked to the Problems View.

Includes an editor for Valgrind suppressions files featuring syntax highlighting, folding and code completion.

  • Massif *

Massif is a heap profiling tool. It takes several “snapshots” during execution of your program detailing the various heap allocations throughout. It’s output for each snapshot primarily consists the time of the snapshot, how many bytes were allocated that can be used, and how much extra was allocated than was asked. The unit of time can be configured to be instructions, milliseconds or bytes. At specified intervals, “detailed” snapshots are produced. These detailed snapshots contain a tree of heap allocations that comprise that snapshot. Unlike Memcheck, Massif does not yet support XML output. Massif’s output is complex and as such requires creative ways of displaying it. Valgrind includes the ms_print program that is used to display Massif’s output in a visually appealing manner. ms_print was used as a template for how to display this output.

The default view of the output is with a TableViewer. Snapshots are displayed as tabular data, just as ms_print does.

For detailed snapshots, an icon indicates the snapshot can be double-clicked and the View will display a TreeViewer of the detailed snapshots’ heap allocation trees.

ms_print also provides a bar chart of bytes allocated throughout execution. In perhaps a more appropriate style, there is an option to display a detailed line chart of this data.

  • Cachegrind *

Cachegrind performs cache and branching profiling. A Cachegrind profile run measures the number of cache misses and branch mispredictions performed by an application. The results of a Cachegrind profile run are displayed in the Valgrind view. These results show Cachegrind’s cache/branch data in different levels of granularity.

Double-clicking on any file, function, or line will open the corresponding source file and place the cursor on the appropriate location (if the source can be resolved).

Integration with the CDT’s parsed code model provides a user interface that resembles what you see in the Outline view.

There are three methods to install eclipse-cdt-valgrind on Ubuntu 18.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 eclipse-cdt-valgrind Using apt-get

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

sudo apt-get update

After updating apt database, We can install eclipse-cdt-valgrind using apt-get by running the following command:

sudo apt-get -y install eclipse-cdt-valgrind

Install eclipse-cdt-valgrind Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install eclipse-cdt-valgrind using apt by running the following command:

sudo apt -y install eclipse-cdt-valgrind

Install eclipse-cdt-valgrind 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 eclipse-cdt-valgrind using aptitude by running the following command:

sudo aptitude -y install eclipse-cdt-valgrind

How To Uninstall eclipse-cdt-valgrind on Ubuntu 18.04

To uninstall only the eclipse-cdt-valgrind package we can use the following command:

sudo apt-get remove eclipse-cdt-valgrind

Uninstall eclipse-cdt-valgrind And Its Dependencies

To uninstall eclipse-cdt-valgrind and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove eclipse-cdt-valgrind

Remove eclipse-cdt-valgrind Configurations and Data

To remove eclipse-cdt-valgrind configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge eclipse-cdt-valgrind

Remove eclipse-cdt-valgrind configuration, data, and all of its dependencies

We can use the following command to remove eclipse-cdt-valgrind configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge eclipse-cdt-valgrind

References

Summary

In this tutorial we learn how to install eclipse-cdt-valgrind package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.