Skip to content
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

Add find and debug function #30

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

juraph-dev
Copy link

G'day,

This PR adds a simple debug head to the hydra, allowing a user to easily run a ros2 node through emacs-gdb. Works for local, and remote work-spaces through Tramp, including through a remote docker instance.

I would like to extend the hydra with more options, but I wanted to gauge your thoughts on this before getting too far into it.

ros.el Outdated
"Search for, then launch a ROS2 node in GDB mode."
(interactive)
(if (eq (ros-current-version) 1) (error "Debug does not currently support ros1")
(let* ((lib-path (ros-shell-command-to-string "env | grep LD_LIBRARY_PATH"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe rather do echo $LD_LIBRARY_PATH?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An echo would be more elegant, however the output gets cut by the sed in 'ros-shell-command-to-string (I don't understand why) and I figured the env | grep was less intrusive than modifying the expression, or creating a duplicate shell command function.

@mbeutelspacher
Copy link
Owner

mbeutelspacher commented Sep 27, 2023

Thanks for this proposal, this definitely sounds like a good idea, I will try if I can also find a way for an ROS1 implementation

@juraph-dev
Copy link
Author

Thanks for this proposal, this definitely sounds like a good idea, I will try if I can also find a way for an ROS1 implementation

Awesome! Since you're interested, I'll extend this for ROS1. Off the top of my head I know you can search nodelets with:
rosrun nodelet declared_nodelets, I'll have a look at how to handle nodes and see what I can come up with. I'll mark this as draft until I implement it.

@juraph-dev juraph-dev marked this pull request as draft September 28, 2023 01:35
Will check current ros version, using the corresponding
ros-find-debug-executable() function. Works for both nodes and nodelets,
presenting both to the user without additional intervention.
@juraph-dev juraph-dev marked this pull request as ready for review October 8, 2023 23:40
@juraph-dev
Copy link
Author

juraph-dev commented Oct 8, 2023

Added the ros1 debug function. Works well on my machine with a test ros1 workspace (msckf_vio) with both nodes and nodelets. GDB finding a source file for a Nodelet requires a *.so load at runtime, so you'll need to throw a blind breakpoint on first run ("b onInit()" is a safe bet).

I am very new to lisp, so let me know if there is anything that should be cleaned.

@juraph-dev
Copy link
Author

@mbeutelspacher Friendly ping.

juraph-dev and others added 10 commits November 27, 2023 14:28
Bring up to date with head repo
Prevent colcon from surgically inserting build/install folders throughout my workspace. Instead, simply cd to workspace for compilation.
I ran into a few issues with certain packages, notably sub-packages not being identified by ros-list-packages. Fix is to use ros2 list executables, trimming the output and using that as the pipe to gdb.
Allow the user to repeat the last gdb command, instead of having to
re-select the package, etc. Bound to _l_.
Attempting to justify the fork.
Sometimes, people (me) will create an executable with the same name as
its package. Handle appropriately.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants