CLion 2019.1 Help

macOS Specific Adjustments

Selecting Debugger

The macOS version of CLion provides two bundled debuggers at your choice: LLDB (by default) and GDB. Currently, the bundled versions are LLDB v 7.0.1 and GDB v 8.0.1. If you decide for a custom GDB, the versions supported are 7.8.x-8.2.x.

To change the debugger, do the following:

  1. Navigate to Preferences | Build, Execution, Deployment | Toolchains.

  2. In Debugger section of the right pane, select the desired debugger.

    the Select Dubgger list

  3. Press OK to proceed.

Configuring GDB

Combination of GDB as the debugging back end and Clang (CMake default compiler) implies some limitation to macOS projects debugging. In particular, it refers to viewing the content of STL containers. Examples below demonstrate how you can overcome these limitations using CMake commands and settings:

  1. Currently, if you need to view the content of STL containers in GDB, use the libstdc++ instead of libc++. To include libstdc++ in your macOS project, do one of the following:
    • add the following command in CMakeLists.txt file:

      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")

    • In CMake options field of CMake Settings dialog, specify the library to be included:
      -D CMAKE_CXX_FLAGS = "-stdlib=libstdc++"
  2. We recommend that you keep on dwarf3 debug info format. To do that, add the following commands to CMakeLists.txt file:


Last modified: 24 July 2019

See Also

External Links: