CLion 2019.2 EAP: GDB Server for Embedded Debugging

Posted on by Anastasia Kazakova

Hi,

A new CLion 2019.2 EAP build (192.4787.12) is now available. Download the full build from our site, install it via the Toolbox App, or use a snap package if you are using Ubuntu. A patch-update for those using the previous EAP build will be available shortly.

DOWNLOAD CLION 2019.2 EAP

On-Chip debug with GDB Server

As we announced previously, Embedded Development support is one of our main areas of focus right now. We already had some results to show you in v2019.1, with OpenOCD support and integration with STM32CubeMX, along with major improvements in the debugger like the Memory View.

We are now working on further improvements for general embedded debugging and a peripheral view. In this EAP build, we’ve implemented and polished a Run/Debug configuration for On-Chip debug with GDB Server. This covers such cases as:

  • Using OpenOCD as a standalone GDB Server
  • Using ST GDB Servers (you can get an OS version of the tools on GitHub)
  • Using Segger J-Link GDB Server
  • Using QEMU as a GDB Server
  • Any other specific GDB Server


To get into debugging with GDB Server on your MCU, follow the simple steps:

  1. Get a GDB Server installed on your machine.
  2. Create an Embedded GDB Server Run/Debug configuration in CLion, and provide an executable path, arguments to run the server, and other appropriate settings:
    gdbserver_embedded_config
  3. Debug from CLion using this new Embedded GDB Server configuration:
    on-chip debug

Other improvements

Other notable changes include:

  • CMake 3.14.5 is now bundled.
  • For remote projects: changes introduced to the project externally (from outside the IDE) are now automatically synchronized to the remote host.
  • The Member function can be static inspection was updated to avoid false positives in macros, for example when a Boost test macro is used (CPP-16229).
  • The quick-fix that simplifies an expression was updated to behave correctly on ternary operator (CPP-16372).

The full release notes are available here.

DOWNLOAD CLION 2019.2 EAP

Your CLion Team
JetBrains
The Drive to Develop

Comments below can no longer be edited.

22 Responses to CLion 2019.2 EAP: GDB Server for Embedded Debugging

  1. IvanG says:

    June 5, 2019

    I just updated to latest eap hopping Shell Script plugin is included as it is mentioned in full release notes, but seems not available yet for CLion?

    • Anastasia Kazakova says:

      June 5, 2019

      Unfortunately, it was bundled only into IntelliJ IDEA for now, CLion requires an additional work – https://youtrack.jetbrains.com/issue/CPP-16462. We hope to find time for that before 2019.2 release.

  2. Jonathan Zigler says:

    June 6, 2019

    Hoping for the day that Clion more natively supports embedded linux firmware deveopment, but enjoying the new features for embedded developers. A little less than a year ago I was having to do all this by hand with separate tools. Native support really helps. Keep up the good work!!

    • Anastasia Kazakova says:

      June 6, 2019

      Thank you for these encouraging words!

  3. guillaume says:

    June 6, 2019

    Is there any progress on debugging when using msvc tool chain ?

    Thanks in advance for any info you might share,

    • Anastasia Kazakova says:

      June 6, 2019

      It’s still under development. Since the debugger there is implemented from scratch, it’s a huge bunch of work to be done. We do our best to make it happen in 2019.2, but I can’t promise anything at this stage.

  4. Roman says:

    June 8, 2019

    I see Ivan had moved from QtCreator bugtracker to Clion bugtracker. Hopefully this will accelerate performance improvements in Clion. While it will be a bad if Jetbrains kills all competition in Linux and start raising prices.

    • Anastasia Kazakova says:

      June 8, 2019

      There is always a competition in C++ IDE market and it actually helps us improve the tool.
      Ivan indeed is working on Clangd in CLion and hopefully will help the rest of the team improve the parsing/resolving experience.

  5. Radek says:

    June 9, 2019

    I need some advice – which solution (if any) could make my work easier.
    My Setup:
    1. Arm7 embedded board running linux – target.
    2. The application is build on PC with Ubuntu using gnu arm cross-compiler.
    3. CLion can be only run Ubuntu – embedded board does not have resources to run it.
    4. I have remote debug setup in CLion where I have to manually copy executable over scp to embedded board and manually start a cross-compiled gdbserver also on embedded. Then I can connect to it from CLion running on Ubuntu.

    Is there a way for me control the embedded debugging without the manual operations directly from CLion? Does any of the new features would allow me to create a configuration which will eliminate the manual operations? I can not do use Full Remote Mode because the embedded side does not have resources for it.

    • elmot says:

      June 11, 2019

      Hello,
      I believe you may at least simplify your development using Before launch steps in your run configuration. Usually there is nothing or only Build step, but you can add steps for uploading files via sftp, run remote commands etc. If it’s not enough, you may configure ‘External Tools’, i.e. your own scripts or application runs. With all of that you may use either GDB Remote Debug or Embedded GDB run configurations.
      If you have any feedback, bug reports, or feature requests, please file or upvote tickets at our youtrack system

      A little bit more information about remote build steps:
      https://www.jetbrains.com/help/clion/uploading-and-downloading-files.html#upload-before-launch

  6. Hubert says:

    June 11, 2019

    With each release the performance of IDE is worse and worse. 2018.4 was kind of ok with a few hiccups but 2019.1.x is terrible. Ubuntu 18.04 on 72 core CPU, 64 GB, Clion memory bumped to 4 GB and I need to wait 20 seconds to paste one line of code into 5000 line source file. The only option is to paste without formatting. Even typing is lagged at some moments.
    By comparison VSC works way smoother with significantly less resources. I am not going to wait for next release with performance “improvements”. I am switching to VSC and will check Clion once a quarter just for curiosity. Performance is one thing but as I know inability to turn off completely code formatting/indexing/whatever spins CPU is really bad. Good luck but for now good bye. PS. Don’t ask me for CPU traces as many people did it so far without results. If you claim it helps please publish some test files with performance numbers of indexing/symbol lookup/ etc.

    • Anastasia Kazakova says:

      June 12, 2019

      We feel sorry you are disappointed, but without actual CPU snapshots and thread dumps not sure we can help you. There are dozens of different environments and setups, and we keep constantly improving and working on performance. There are things that improved. Still many things in work. And still, some are waiting for another ones to be finished. We can’t estimate or directly help with your particular issues, unless you share some additional info with us.

  7. Qian Wang says:

    June 19, 2019

    How to display the SWO messages in the console?

    • ilia.motornyi@jetbrains.com says:

      June 19, 2019

      It depends of your gdb server.
      openocd requires some hackish trick with it’s board config file
      st-util does not support swo yet.
      segger gdb server opens tcp port for it
      st-link can also open a port.
      We’re going to support this stuff better and document it as well.

  8. Trevor says:

    July 29, 2019

    Trying to get the new embedded debugger working with SEGGER on OSX.

    > WARNING: Unsupported remote command “arm semihosting enable”
    > com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$GDBCommandException: Target does not support this command.

    how does one disable this?

    • ilia.motornyi@jetbrains.com says:

      July 30, 2019

      Apparently, you have a command “arm semihosting enable” or “monitor arm semihosting enable” somewhere. Segger does not support the command, just remove it.

      • Trevor says:

        July 30, 2019

        I haven’t added that anywhere that I know of. It’s not in any of my project files or CLion config.

        • ilia.motornyi@jetbrains.com says:

          July 30, 2019

          It might be located in .gdbinit file in your home directory.

  9. Robert says:

    August 21, 2019

    Has anyone tried to use the embedded feature with a QNX target? I’m trying for days and didn’t find a solution.

    • ilia.motornyi@jetbrains.com says:

      August 21, 2019

      What kind of solution are you looking for?

      • Robert says:

        September 17, 2019

        Sorry, didn’t metioned your reply.

        I’m trying to connect to a remote microcontroller via tcp/ip. on the µcontroller runs qnx 7.0, the contoller itself is a arm V7. I tried the following configuration:
        https://1drv.ms/u/s!AmnYAZa3oHIHom-fsvBbza4wBhu5?e=GRQZww

        I get this error:

        C:\qnx700\host\win64\x86_64\usr\bin\ntoarmv7-gdb.exe
        ---Type  to continue, or q  to quit---
        
        com.jetbrains.cidr.execution.debugger.backend.gdb.GDBDriver$GDBCommandException: Remote replied unexpectedly to 'vMustReplyEmpty': timeout
        Debugger disconnected
        
        Process finished with exit code 0
        GDB Server stopped, exit code -1073741510
        
        • ilia.motornyi@jetbrains.com says:

          September 17, 2019

          Ok, I see now.

          I think, it’s a bit easier to use Remote GDB Debug configuration rather than Embedded GDB Server, even though both might be used.

          First of all, your utility (ntoarmv7-gdb) should be set up as a debugger but not as gdb server.
          Gdb server should be run on your target device, exposing tcp endpoint to the network, and the debugger must connect to it.
          That might be done via ssh tunnel also with some performance impact. And you need to upload and start your application under gdb server on your target platform. That might be done with some script, probably using plink utility from putty distribution. And you may run the script automatically before starting the debugger, see Before launch and External tools.

Subscribe

Subscribe for updates