Adjusting Configuration to 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:
- Currently, if you need to view the content of STL containers in GDB, please use the
libstdc++
instead oflibc++
. To includelibstdc++
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++"
- add the following command in CMakeLists.txt file:
- We recommend that you keep on
dwarf3
debug info format. To do that, add the following commands toCMakeLists.txt
file:set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -gdwarf-3") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -gdwarf-3")
Last modified: 15 December 2017