Eclipse Kepler in DTS
One of the new features for the Developer Toolset (DTS) 2.0 is Eclipse 4.3.0 (Kepler). Aside from various performance improvements to the base platform since Eclipse 4.2 (Juno) a lot of other plugins are being shipped to make life easier for development. The C/C++ Developer Tooling (CDT) is a plugin used to develop, build, run, and debug C/C++ applications in Eclipse. It has support for various toolchains, Makefile/Autotools projects, static analysis, and easy navigation of a code-base thanks to a powerful indexer. There’s also support for EGit (Git Integration), Mylyn (Task Management) , and a variety of different profiling tools provided by the Linux Tools Project, such as an environment for developing SystemTap scripts.
Assuming Eclipse Kepler is installed from DTS 2.0, it will be available from the “Applications” menu, under the “Programming” category as “DTS Eclipse”. It can also be started from a shell with the command :
scl enable devtoolset-2 eclipse
In addition to shipping the CDT there’s a variety of Eclipse plugins provided that allow us to profile our C/C++ applications and look for potential issues. Integrations exist for OProfile, Perf, Valgrind, Gprof and Gcov. A set of categories (Coverage, Memory, Timing) have also been created to allow for grouping profiling tools, and defining a sane default to improve the user experience. More advanced users can always use a specific tool by its name, or configure the categories as they wish.
In this particular case I’ve created a launch configuration that uses the “Helgrind” plugin to profile potential synchronization errors arising from the use of the POSIX pthreads library.
Our application simply reads some files in parallel and outputs some data. When run under the Helgrind plugin, the Valgrind view shows us some problems as well as highlighting the relevant lines of code.
It’s clear to see that a value is being accessed/modified from various threads without the use of any locking. This can produce some non-deterministic behavior.
For Git integration one can use the EGit plugin for Eclipse.
Simply selecting “Projects from Git” from the Project Import menu and specify the repository location (local, or remote).
Once cloning has completed, one can configure the project as needed. Since this is not an Eclipse project there is an additional step needed to define it as a C++ GNU Autotools project. To create an existing project we simply provide its location (hence the warning) and specify a GNU Autotools Empty Project to be used as the template.
We have now successfully imported a project and configured it as C++ GNU Autotools Project with Git integration.
From here, the Autotools functionality makes it pretty simple to configure, build, and run the project.
Lastly we can profile the project and review the results. In this case the Perf Plugin is being used to do so.
With these different integrations, it becomes easier to manage all aspects of a project.