From a705038403c12d4a0f56fe2ffd506cfbb8e06672 Mon Sep 17 00:00:00 2001 From: Ryan Friedman Date: Fri, 16 Feb 2024 10:54:36 -0700 Subject: [PATCH 1/3] Document LD_LIBRARY_PATH and catching exceptions Signed-off-by: Ryan Friedman --- source/Tutorials/Intermediate/Testing/CLI.rst | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/source/Tutorials/Intermediate/Testing/CLI.rst b/source/Tutorials/Intermediate/Testing/CLI.rst index 3579c52b2f..8d84da793c 100644 --- a/source/Tutorials/Intermediate/Testing/CLI.rst +++ b/source/Tutorials/Intermediate/Testing/CLI.rst @@ -43,9 +43,26 @@ Since the previous build type may be cached by CMake, clean the cache and rebuil colcon build --cmake-clean-cache --mixin debug -Next, run the test directly through gdb. +In order for gdb to load debug symbols for any shared libraries called, make sure to source your environment. +This configures the value of ``LD_LIBRARY_PATH``. + +.. code-block:: console + + source install/setup.bash + + +Finally, run the test directly through gdb. For example: .. code-block:: console gdb -ex run ./build/rcl/test/test_logging + +If the code is throwing an unhandled exception, you can catch it in GDB before gtest handles it. + +.. code-block:: console + + gdb ./build/rcl/test/test_logging + catch throw + run + From bff358ffa043f35f4b255bbfd6fd25cf858b8a84 Mon Sep 17 00:00:00 2001 From: Ryan Friedman Date: Fri, 16 Feb 2024 10:58:50 -0700 Subject: [PATCH 2/3] Uniform capitization of gdb Signed-off-by: Ryan Friedman --- source/Tutorials/Intermediate/Testing/CLI.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/Tutorials/Intermediate/Testing/CLI.rst b/source/Tutorials/Intermediate/Testing/CLI.rst index 8d84da793c..01f6a12172 100644 --- a/source/Tutorials/Intermediate/Testing/CLI.rst +++ b/source/Tutorials/Intermediate/Testing/CLI.rst @@ -35,7 +35,7 @@ To see the exact test cases which fail, use the ``--verbose`` flag: Debugging tests with GDB ^^^^^^^^^^^^^^^^^^^^^^^^ -If a C++ test is failing, gdb can be used directly on the test executable in the build directory. +If a C++ test is failing, GDB can be used directly on the test executable in the build directory. Ensure to build the code in debug mode. Since the previous build type may be cached by CMake, clean the cache and rebuild. @@ -43,7 +43,7 @@ Since the previous build type may be cached by CMake, clean the cache and rebuil colcon build --cmake-clean-cache --mixin debug -In order for gdb to load debug symbols for any shared libraries called, make sure to source your environment. +In order for GDB to load debug symbols for any shared libraries called, make sure to source your environment. This configures the value of ``LD_LIBRARY_PATH``. .. code-block:: console @@ -51,7 +51,7 @@ This configures the value of ``LD_LIBRARY_PATH``. source install/setup.bash -Finally, run the test directly through gdb. +Finally, run the test directly through GDB. For example: .. code-block:: console From 4469693864ce74d5c42bad45af01d3b94a05bb86 Mon Sep 17 00:00:00 2001 From: Ryan Friedman Date: Fri, 16 Feb 2024 12:23:48 -0700 Subject: [PATCH 3/3] Remove extra line Signed-off-by: Ryan Friedman --- source/Tutorials/Intermediate/Testing/CLI.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/source/Tutorials/Intermediate/Testing/CLI.rst b/source/Tutorials/Intermediate/Testing/CLI.rst index 01f6a12172..cdd8374ef8 100644 --- a/source/Tutorials/Intermediate/Testing/CLI.rst +++ b/source/Tutorials/Intermediate/Testing/CLI.rst @@ -50,7 +50,6 @@ This configures the value of ``LD_LIBRARY_PATH``. source install/setup.bash - Finally, run the test directly through GDB. For example: