Add Breakpoint in Library

I am using CLion with ROS and and am having a package that mainly provides a shared library with all my nodes and multiple executable to start each of them:

# Lib
add_library(
  ${PROJECT_NAME}_lib SHARED
     my_node.cpp
my_other_node.cpp
some_robot_model_used_by_all_nodes.cpp
utility_stuff_used_by_all_nodes.cpp
)

# Node 1
add_executable(
  ${PROJECT_NAME}_node_1
    src/run_node.cpp
)
target_link_libraries(
  ${PROJECT_NAME}_node
    ${PROJECT_NAME}_lib
)

# Node 2
add_executable(
  ${PROJECT_NAME}_node_2
    src/run_other_node.cpp
)
target_link_libraries(
  ${PROJECT_NAME}_node_2
    ${PROJECT_NAME}_lib
)

where my executable are basically just dummies looking similar to this:

#include <my_package/my_node.h>

int main(int argc, char** argv) {
ros::init(argc, argv, "my_node");

MyNode node;
node.spin();

return 0;
}

Everything is happening in a single CLion project which is build in Debug configuration. The issue is, that I can only add breakpoints in src/run_node.cpp. If I want to add a breakpoint in any file that is part of ${PROJECT_NAME}_lib the breakpoint gets grayed out with the notification "Breakpoint will not currently be hit. No executable code is associated with this line".

Am I doing something wrong, or is it just not possible at all to have a breakpoint in a second build target at all?

0
1 comment
Avatar
Permanently deleted user

Seems I figured it out myself. After setting up a new dummy workspace debug my library I switched to it directly from CLion instead of exiting, loading the new setup.bash on the shell and restarting it, causing GCC it to link to a copy if the library in the old workspace.

0

Please sign in to leave a comment.