Eclipse CDT



The C/C++ IDE for Everyone

Doug Schaefer (BlackBerry/QNX) and Marc Khouzam (Ericsson)

Agenda

  • What is the CDT?
  • C/C++ Projects
  • Getting to Know Your Code
  • Refactoring
  • Debug
  • Unit Testing
  • Future Plans

What is the CDT?

  • C/C++ Development Tooling (CDT)
  • Tools for building applications in C/C++ using Eclipse
  • Platform used to create C/C++ IDEs
  • The Eclipse C/C++ IDE Package
  • A community of passionate tools developers

Uses

  • Embedded Systems
  • Desktop Apps
  • Mobile Apps
  • Server-side

History

  • Started in 2001 as QNX Momentics
  • Opened source in 2002 at Eclipse
  • Rational joined shortly after
  • followed by TI, Intel, Symbian, Nokia, ...
  • then Ericsson, Google, individual contributors

The Committers

  • Andrew Gvozdev
  • Anton Leherbauer
  • Chris Recoskie
  • Doug Schaefer
  • Elena Laskavaia
  • John Cortell
  • Jeff Johnston
  • Mikhail Khodjaiants
  • Marc Khouzam
  • Marc-Andre Laperle
  • Markus Schorn
  • Patrick Chuong
  • Pawel Piech
  • Randy Rohrbach
  • Sergey Prigogin
  • Teodor Madan
  • Vivian Kong
  • William Swanson
  • Thomas Corbat

Contributors

Sibling Eclipse Communities

  • Linux Tools Project
  • Parallel Tools Project
  • Mylyn
  • Automotive Working Group
  • M2M WG, Internet of Things

Commercial Adopters

  • QNX Momentics & BlackBerry NDK
  • Wind River Workbench
  • Red Hat Enterprise Linux
  • IBM Rational Software Architect
  • Intel C++ Compiler for Linux
  • Freescale CodeWarrior
  • TI Code Composer Studio
  • Pretty much every silicon vendor
  • Pretty much every RTOS vendor

Open Source Users

Eclipse C/C++ IDE Downloads

  • Helios CDT 7.0.1 - 625,162 downlaods
  • Indigo CDT 8.0.1 - 812,430 downloads
  • Juno CDT 8.1.1?
Juno SR1 Stats

CDT Features

  • Project and Build
  • Full featured editor
  • Source code navigation
  • Refactoring
  • Static code analysis
  • Debugging
  • Unit Test

Project and Build

New Project Wizard

Build Systems

  • Managed and not Managed
  • Extensible for new toolchains
  • Built-in Toolchain support: gcc, msvc, clang
  • Major capability provided by RTOS and silicon vendors

The Editor

Highlighting

Syntax Highlighting

Content Assist

Content Assist

Hover Help

Hover Help

Block Selection

Block Selection

Formatting

Formatter

Outline View

Outline View

Parser and Indexer

  • Full C and C++ parser producing AST
  • C++ parser progressing on C++11 support
  • Indexer captures symbols, definitions and references
  • Parser uses index for speed, e.g. content assist
  • Available as API for advanced tooling

Refactoring and other cool tricks

  • Rename Refactoring
  • Extract Constant
  • Extract Local Variable
  • Extract Function
  • Toggle Function Definition
  • Hide Method
  • Implement Method
  • Generate Getters and Setters
  • Organize Imports

Code Analysis - Codan

  • Framework for static analysis
  • Out-of-the-box static analysis rules and checkers

Codan Customizations

Customizing Rules
  • Ability to enable or disable existing rules
  • Ability to modify properties of existing rules
  • Ability to modify severity of rules

Codan Triggers

Running Rules
  • Run upon user request
  • Run when project is built
  • Run as you type!
Rules Triggers

Codan Reporting

  • Entries in Problems view
    Problems view
  • Problem markers in Editor
    Quick Fix
  • Some checkers support Quick Fix!

Discovering Parser Configuration

  • Required for parser to find header files
  • Include Paths
  • Macro Definitions
  • Other advanced build options that impact parsing
  • Detects compiler built-ins
  • Scans build output
  • Extensible mechanism to plug in other methods

Debug

Debug View

Variables View

Pretty-Printing

Pretty Printing

Registers View

Expressions View

Enhanced Expressions

  • Glob-pattern matching with '=' prefix
    =var*
    =myArray[20-30]
    =$e?x
  • Sorted matches
    =* or *
    =$* or $*
  • Grouping using ';' separator
    myVar;=myArray[20,24]
    myVar;$eax

Enhanced Expressions

Enhanced Expressions

Project-less Debugging

Project-less Debugging

Reverse Debugging

  • Step or Resume forwards AND backwards
  • Go back in time, change data and re-write history
  • Use breakpoints to enable/disable recording

Reverse Debugging

Reverse Debugging

Multi-Process Debugging

Multi-Process Debugging

OS Resources view

OS Resources
  • All Processes
  • All Threads
  • Semaphores
  • Sockets
  • Kernel Modules
  • File Descriptors
  • Message queues
  • Memory Segments

Multicore Visualizer

Multicore Visualizer
  • Monitor entire system at a glance
  • Control program execution from Visualizer

Multicore Visualizer CPU Load Meters

Multicore Visualizer CPU Load
  • Optionally monitor your target

Multicore Visualizer Filtering

Multicore Visualizer Full Multicore Visualizer Selection Multicore Visualizer Filtered
  • Focus on interesting parts
  • Allow for more information to be displayed

Dynamic-Printf

Dynamic Printf Type
  • No re-compiling
  • No re-deploying
  • Debugger can disconnect
Dynamic Printf Properties

Step Into Selection

void compute(int a, float b) {
	subtract(multiply(add(a, b), 3));
}						

How many operations to step into subtract()?

Step-into:

int add(int arg1, int arg2) {
	return arg1 + arg2;
}						

Return and Step-into again:

int multiply(int arg1, int arg2) {
	return arg1 * arg2;
}						

Return and Step-into yet again to finally get to:

int subtract(int arg1, int arg2) {
	return arg1 - arg2;
}						 

Five stepping operations!

Step Into Selection

void compute(int a, float b) {
	subtract(multiply(add(a, b), 3));
}						

Select the "subtract" method call in the Editor

Choose the Step-Into-Selection operation:

int subtract(int arg1, int arg2) {
	return arg1 - arg2;
}						

All other method calls are stepped-over automatically


Just one stepping operation!

C/C++ Unit Testing


Support for different testing frameworks directly in CDT


C/C++ Unit Testing

  • Compile tests into executable binary Launching Unit Tests
  • Launch in Run or Debug mode

C/C++ Unit Testing

Viewing Unit Tests Results
  • Hierarchical results browsing
  • Error message display
  • Source Lookup from error
  • Result count and timing
  • Error filtering by severity
  • Re-run selected tests

Qt Support

  • New project template for qmake
  • Slots and Signals content assist and search
  • "Syntax" highlighting
  • Templates for Qt classes and methods
  • Project file editor

Future Plans

  • Multicore Visualizer
    • Memory Usage Monitoring
    • Automatic display of important information
  • Global Breakpoints
  • Per-target Breakpoints
  • Grouping of Debug view elements
  • Improve Qt support to first class
  • Advanced Makefile projects for cmake, qmake
  • LLVM for code analysis

Q&A