Does clion debugger work well now?

i wanna learn C++ primer(book) in one month later, can clion do it now?

0
10 comments

There are still some unresolved issues, but in most cases it works correctly.

0

For me it's impossible to debug on OSX yosemite with

-std=c++11
0

Hi Massimo.

Could you please specify what libraries are you using in your project and which gcc, gdb versions are used?

0

Thanks for the quick reply!!!

here my CMakeLists.txt


option(project_build_tests "Build all of project's unit tests." OFF)
cmake_minimum_required(VERSION 3.1)
project(MST)

#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")

# General
###############################################################################
# Activate C++0x support (if you encounter gmock errors, use 1.6.0 version)
#add_definitions(-std=c++0x)
# Extra warnings
#add_definitions(-Wextra)
# Google Mock & Test
###############################################################################
#add_subdirectory(${GMOCK_ROOT})
#include_directories(${GMOCK_ROOT}/include)
#include_directories(${GMOCK_ROOT}/gtest/include)
# Main program executable
###############################################################################
include_directories("/usr/local/include")
link_directories("/usr/local/lib")
# Include root directory
include_directories(BEFORE ".")
include_directories(BEFORE "src/")

set(EXECUTABLE_NAME "program")
# Source files
file(GLOB SRC_FILES "src/*.cpp" "src/*.h")
# Set link libraries
# target_link_libraries($EXECUTABLE_NAME ...)
# Tests executable
###############################################################################
set(TEST_EXECUTABLE_NAME "tests")
# Test files
file(GLOB TEST_FILES "test/*.cpp")
# Don't include Main.cpp from src
file(GLOB MAIN_SRC "src/main.cpp")
list(REMOVE_ITEM SRC_FILES ${MAIN_SRC})



# Set link libraries (order matters)
#target_link_libraries("${TEST_EXECUTABLE_NAME}" gmock gtest pthread)
set(Boost_USE_STATIC_LIBS        ON) # only find static libs
set(Boost_USE_MULTITHREADED      ON)
set(Boost_USE_STATIC_RUNTIME    OFF)
find_package(Boost 1.36.0 COMPONENTS date_time filesystem system graph)

# Executable dependencies

if
(Boost_FOUND AND SRC_FILES)
  include_directories(${Boost_INCLUDE_DIRS})
   add_executable(${EXECUTABLE_NAME} ${SRC_FILES} ${MAIN_SRC})
  target_link_libraries(${EXECUTABLE_NAME} ${Boost_LIBRARIES})
endif()
set(project_build_tests      ON)
if (project_build_tests )
    enable_testing()
    add_executable(${TEST_EXECUTABLE_NAME} ${TEST_FILES} ${SRC_FILES})
    target_link_libraries(${TEST_EXECUTABLE_NAME}
        pthread
)
    target_link_libraries(${TEST_EXECUTABLE_NAME}
        gmock
        gmock_main
)
    target_link_libraries(${TEST_EXECUTABLE_NAME}
        gtest
        gtest_main
)
     target_link_libraries(${TEST_EXECUTABLE_NAME} ${Boost_LIBRARIES})

    add_test(all-tests ${TEST_EXECUTABLE_NAME})
endif()
add_definitions(-std=c++11)
add_definitions(-stdlib=libc++)

massimo@massimos-mbp:~$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix

and

massimo@massimos-mbp:~$ gdb --version

GNU gdb (GDB) 7.8
Copyright (C) 2014 Free Software Foundation, Inc.

0

Ah I forgot to say that for a project c++98 linking

-stdlib=libstdc++


the debugger is working

0

Hi Massimo.

You said that it's impossible to debug, do you get any errors?
How does it look like?
Are you able to debug your project using gdb console?

0

Hi Anna,
I created this simple Hello World exampe

#include <iostream>
#include <string>

using namespace std;

int main() {
    string test = "test";
    
cout << "Hello, World!" << endl;
    return 0;
}


And I put a break point on the return statement
if I use this CMakeList.txt

VERSION 3.1)
project(Hello)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++" )

set(SOURCE_FILES main.cpp)
add_executable(Hello ${SOURCE_FILES})

The string test is shown as std::__1::__basic_string<comm ....

instead with a CMakeList.txt like

cmake_minimum_required(VERSION 3.1)
project(Hello)

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

set(SOURCE_FILES main.cpp)
add_executable(Hello ${SOURCE_FILES})


The string is shown in a "pretty" way


Unfortunately with a CMakeLists.txt like the second I cannot compile boost ... I think for an etensive use of C++11 featere like nullptr, stoi .... etc


thanks
Massimo



Attachment(s):
Screen Shot 2015-03-26 at 15.26.17.png
Screen Shot 2015-03-26 at 15.21.40.png
0

Hi Anna,
I created this simple Hello World exampe

#include <iostream>
#include <string>

using namespace std;

int main() {
    string test = "test";
    
cout << "Hello, World!" << endl;
    return 0;
}


And I put a break point on the return statement
if I use this CMakeList.txt

VERSION 3.1)
project(Hello)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++" )

set(SOURCE_FILES main.cpp)
add_executable(Hello ${SOURCE_FILES})

The string test is shown as std::__1::__basic_string<comm ....

instead with a CMakeList.txt like

cmake_minimum_required(VERSION 3.1)
project(Hello)

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

set(SOURCE_FILES main.cpp)
add_executable(Hello ${SOURCE_FILES})


The string is shown in a "pretty" way


Unfortunately with a CMakeLists.txt like the second I cannot compile boost ... I think for an etensive use of C++11 featere like nullptr, stoi .... etc


thanks
Massimo

0

Hi Anna,
I created this simple Hello World exampe

#include <iostream>
#include <string>

using namespace std;

int main() {
    string test = "test";
    
cout << "Hello, World!" << endl;
    return 0;
}


And I put a break point on the return statement
if I use this CMakeList.txt

VERSION 3.1)
project(Hello)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++" )

set(SOURCE_FILES main.cpp)
add_executable(Hello ${SOURCE_FILES})

The string test is shown as std::__1::__basic_string<comm ....

instead with a CMakeList.txt like

cmake_minimum_required(VERSION 3.1)
project(Hello)

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

set(SOURCE_FILES main.cpp)
add_executable(Hello ${SOURCE_FILES})


The string is shown in a "pretty" way


Unfortunately  with a CMakeLists.txt like the second I cannot compile boost ... I  think for an etensive use of C++11 featere like nullptr, stoi .... etc


thanks
Massimo

0

Hi Massimo.

Thank you for the details!
We have issue about support clang libc++ renderers in our tracker:
https://youtrack.jetbrains.com/issue/CPP-2437
Feel free to comment to upvote.
Follow to get the updates.

0

Please sign in to leave a comment.