From f33b0ade03f6aab9ecd566dbf775f92f22cc34f1 Mon Sep 17 00:00:00 2001 From: Stefan Scherzinger Date: Fri, 13 Aug 2021 13:33:09 +0200 Subject: [PATCH] Use thread sanitizer (tsan) to check data races This is a quick draft to temporary add thread sanitizer (tsan) to the core of the driver. It's not meant to stay here and shall only give an in-depth analysis of possible data races in the code. --- ur_robot_driver/CMakeLists.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ur_robot_driver/CMakeLists.txt b/ur_robot_driver/CMakeLists.txt index e20817320..43aca3bd4 100644 --- a/ur_robot_driver/CMakeLists.txt +++ b/ur_robot_driver/CMakeLists.txt @@ -74,6 +74,10 @@ endif() add_compile_options(-Wall) add_compile_options(-Wextra) add_compile_options(-Wno-unused-parameter) +add_compile_options(-fsanitize=thread) +add_compile_options(-fno-omit-frame-pointer) +add_compile_options(-O2) +add_compile_options(-g) include_directories( @@ -86,34 +90,34 @@ add_library(ur_robot_driver_plugin src/dashboard_client_ros.cpp src/hardware_interface.cpp ) -target_link_libraries(ur_robot_driver_plugin ur_client_library::urcl ${catkin_LIBRARIES}) +target_link_libraries(ur_robot_driver_plugin ur_client_library::urcl ${catkin_LIBRARIES} tsan) add_dependencies(ur_robot_driver_plugin ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) add_library(urcl_log_handler src/urcl_log_handler.cpp ) -target_link_libraries(urcl_log_handler ${catkin_LIBRARIES} ur_client_library::urcl) +target_link_libraries(urcl_log_handler ${catkin_LIBRARIES} ur_client_library::urcl tsan) add_executable(ur_robot_driver_node src/dashboard_client_ros.cpp src/hardware_interface.cpp src/hardware_interface_node.cpp ) -target_link_libraries(ur_robot_driver_node ${catkin_LIBRARIES} ur_client_library::urcl urcl_log_handler) +target_link_libraries(ur_robot_driver_node ${catkin_LIBRARIES} ur_client_library::urcl urcl_log_handler tsan) add_dependencies(ur_robot_driver_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) add_executable(dashboard_client src/dashboard_client_ros.cpp src/dashboard_client_node.cpp ) -target_link_libraries(dashboard_client ${catkin_LIBRARIES} ur_client_library::urcl urcl_log_handler) +target_link_libraries(dashboard_client ${catkin_LIBRARIES} ur_client_library::urcl urcl_log_handler tsan) add_dependencies(dashboard_client ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) add_executable(robot_state_helper src/robot_state_helper.cpp src/robot_state_helper_node.cpp ) -target_link_libraries(robot_state_helper ${catkin_LIBRARIES} ur_client_library::urcl) +target_link_libraries(robot_state_helper ${catkin_LIBRARIES} ur_client_library::urcl tsan) add_dependencies(robot_state_helper ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) if(CATKIN_ENABLE_TESTING)