-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document LD_LIBRARY_PATH and catching exceptions with GDB when testing #4175
Document LD_LIBRARY_PATH and catching exceptions with GDB when testing #4175
Conversation
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you, this is an improvement. i have a couple of minor comments.
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given my comment below, I'm fine with this as-is. But I'd like to get @fujitatomoya to approve before we merge.
Can we get a backport to |
@Mergifyio backport iron humble |
✅ Backports have been created
|
#4175) * Document LD_LIBRARY_PATH and catching exceptions Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com> * Uniform capitization of gdb Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com> * Remove extra line Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com> --------- Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com> (cherry picked from commit d084dd8)
#4175) * Document LD_LIBRARY_PATH and catching exceptions Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com> * Uniform capitization of gdb Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com> * Remove extra line Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com> --------- Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com> (cherry picked from commit d084dd8)
#4175) (#4176) * Document LD_LIBRARY_PATH and catching exceptions Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com> * Uniform capitization of gdb Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com> * Remove extra line Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com> --------- Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com> (cherry picked from commit d084dd8) Co-authored-by: Ryan <ryanfriedman5410+github@gmail.com>
#4175) (#4177) * Document LD_LIBRARY_PATH and catching exceptions Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com> * Uniform capitization of gdb Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com> * Remove extra line Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com> --------- Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com> (cherry picked from commit d084dd8) Co-authored-by: Ryan <ryanfriedman5410+github@gmail.com>
Background
I ran into another test failure that I couldn't track down. According to the guide I wrote earlier, debug symbols only get loaded on the test itself.
Now, users are recommended to source their workspace. With this, gdb is aware of the path to all the libraries and get debug symbols correctly. I presume this is through LD_LIBRARY_PATH, but I could be wrong.
Additionally, exceptions thrown in ROS libraries are caught by gtest, and if you want to have gdb find them first, the workflow is slightly different.
There may be better ways to do this, but the workflow works well for me.
Real world example
ANYbotics/grid_map#401 (comment)
Why is this necessary
Well, I have grid_map installed with binaries, and then develop locally in the workspace with debug. The installed binaries are in release mode, so gdb is actually running the wrong library and I'm testing the wrong code under GDB. Forgetting to source the environment means you might be debugging the wrong code! This explains why any modifications I did seemed to have no effect.
What about VSCode
VSCode is great, but can't run a script before starting a debug session. This means that the GDB configuration cannot run
source install/setup.bash
and have the environment configured correctly. I have yet to find a way around this other than telling people to learn CLI GDB.https://stackoverflow.com/questions/43836861/how-to-run-a-command-in-visual-studio-code-with-launch-json
Related
#3899