📜 ⬆️ ⬇️

CLion 2016.2 release: remote debugging, Doxygen format support, new code generation features and much more

Hi, Habr!

Just over a year has passed since the first release of our cross-platform IDE for C and C ++ development. During this time, we had tens of thousands of users, organizations such as NASA and AirBnB are among the clients, and the most popular query in the tracker has gained more than 500 votes. And by the way, it’s not for nothing that we ask you to vote for those requests that are most interesting or relevant to you. Our line of development tasks depends on your opinion and your votes in the first place. That is why the release of 2016.2 includes so many long-awaited features!


')
And now about everything in order.


Debugger: performance, correctness and new supported versions


Our users often complained about various spaces with a debugger in CLion - then command timeout happens during program debugging, variable values ​​in the Variables window are not updated, then debugger does not correctly exit. To all this was added the performance problem when using the debugger on programs with large data structures became difficult.

Having collected all the logs and reports from our users (by the way, thank you so much for them!), We were finally able to significantly rework the drivers for the GDB / LLDB debuggers used in CLion. A lot of problems were solved (in particular, the one with command timeout), and most importantly, the performance of the debugger has improved significantly (in some places, 600 times!). So, for example, in our tests, the speed of step-by-step debugging of programs with viewing arrays improved 600 times for GDB and 1-2 times for LLDB; with the expanded contents of classes - 160 times; and many tests (for example, debugging with viewing strings or STL collections) that were previously timed out began to end in a reasonable time.


At the same time, we updated the supported versions: GDB to 7.11 , LLDB to 3.8 , and with them MinGW-w64 to 5. * and Cygwin to 2. * .

LLDB in CLion is now available not only to our users on macOS, but also on Linux.

Debugger: remote debugging with GDB


I'm sure many of you have been waiting for this opportunity. Immediately make a reservation that so far this is the very first implementation of how we see remote debugging in the IDE. So, if you know about useful use cases that we have not considered, be sure to tell us about them.

So, the current implementation involves debugging with GDB and GDB-server . The latter runs on the target host, and all you have to do is to properly configure the Remote GDB Configuration settings in the CLion for the remote connection. When the connection is successfully established, you can debug a remotely running program, setting breakpoints in the IDE, looking at the values ​​of variables or even changing them on the fly, and calculating the values ​​of expressions.


The configuration interface is quite simple and includes the parameters you would use when manually configuring GDB / gdbserver:


Remote debugging is currently not available on Windows. Also on macOS, you need to use a special version of GDB compiled with the --target=x86_64-linux-gnu flag ( see here for more details).

Documentation: Doxygen support


As you know, a good degree of documentation of the code is a guarantee that the code will be easier to maintain in the future. In developing in C ++ (and not only), one of the most popular formats for documentation code is Doxygen . Therefore, we decided to add his support to this version. What is it?

First, for the code documented using Doxygen comments, the Quick Documentation window ( Ctrl+Q on Linux / Windows, F1 on macOS) in addition to the information on the type of element shows a preview of the documentation. Of the convenient features, it should be noted that if the function parameters in the code are documented separately, then Quick Documentation for the function will be able to combine all the comments and show a general description of the signature:


In addition, if you call the Quick Documentation window when the cursor is on a parameter name in a Doxygen comment, information about the type of this parameter will be displayed:


Second, when refactoring a function, if, for example, you decide to rename its parameter , Doxygen comments will be automatically updated:


Finally, if you decide to add new Doxygen comments to the project code, use autocompletion for Doxygen commands and function parameters. Or simply generate a documentation template to fill it in (works when using “/ **”, “/ *!”, “///” and “//!”, Provided that the function being documented has parameters, it returns the value or throws an exception):


Appearance settings of the generated templates are in Editor | Code Style | C / C ++.

Complete statement


Although the feature is not new, in version 2016.2 it has been significantly reworked and improved. The bottom line is that CLion completes the code constructs for you, placing the necessary brackets, semicolons, quotes, and moving the cursor to a position where you can start typing the next construct. This works for namespaces, classes, structures, control structures, etc:


Read more in our blog .

Code generation


CLion saves time on printing code by providing various code generation options: from generation of class constructors / destructors to various live templates. In version 2016.2, we added the ability to generate comparison, equality, and printing (stream output) operators . The flexible interface allows you not only to select the class fields that you want to use, but also to specify whether to create statements as members of a class, whether to use std::tie in the implementation, etc. At the same time, CLion analyzes whether there are any operators of those that the user wants to generate, and can either recreate them, or add the missing ones:


In the last release, we presented the opportunity to generate definitions, while the implemented behavior of choosing where CLion places the created definitions caused great controversy and discussion. We analyzed all the comments of our users and in the release of 2016.2 changed the behavior, making it adaptive. In fact, CLion itself recognizes and supports three main models:


Of course, at any time during the generation of definitions you can change the model used. CLion will remember the new behavior and will offer you the next time you call the generation function:


Smart CMake support


We continue to work on facilitating the writing of CMake code in projects. In this release, we supported two refactoring for CMake:


We were often asked to make a way to determine that the call to CMake originates from CLion. In this case, many users would like to be able to set additional variables or change some used paths. Now there is such a way - the environment variable CLION_IDE . And to make it easier to find, auto-completion is implemented for environment variables:


Code formatting


CLion offers a variety of formatting options and pre-defined styles. In the new release, in addition to several new options, new styles were added - LLVM and LLDB .

General improvements IntelliJ-platform


The release of CLion 2016.2 also contains general changes to the IntelliJ platform:


Swift


Since the last release, CLion has added a plugin for writing Swift code. It is especially interesting to those who are now mastering Swift on Linux. The AppCode team continues to work on supporting the language, not forgetting (for which she thanks a lot!) To port changes to the plugin for CLion. This version adds support for Swift 2.2, as well as long-awaited refactoring - Introduce Variable, and supported templates for parameters (parameters placeholders). Learn more at the What's New page of the new version of AppCode 2016.2 .

Demo


And traditionally, a small video (in English), demonstrating the new features of CLion 2016.2:


You can read about these and other features of the new version on the product site . Follow also the articles in our English-language blog . As usual, there is a 30-day free trial , and in the price section you can find out about the cost. We will be happy to answer any of your questions in the comments.

Your JetBrains CLion Team
The Drive to Develop

Source: https://habr.com/ru/post/306028/


All Articles