How to access executable for ComposableNodeContainer for gdb debugging?
I have a .py launch file that defines two composable node descriptions: desc1
and desc2
, each of which describe two nodes that are already built and registered as
rclcpp_components_register_node(node1
PLUGIN "node1NS::node1node"
EXECUTABLE node1_node
)
and
rclcpp_components_register_node(node2
PLUGIN "node2NS::node2node"
EXECUTABLE node2_node
)
in their respective CMakeLists.txt files
The .py launch file then uses the two descriptions to create a ComposableNodeContainer like so:
container = ComposableNodeContainer(
name="NodeContainer",
namespace="",
package="rclcpp_components",
executable=LaunchConfiguration("container_executable"),
prefix="gdbserver 127.0.0.1:3050",
composable_node_descriptions=[
desc1,
desc2,
],
output="screen",
)
I added prefix
so that I can hook a dubugging instance to this container in the launchfile (which is nested within 4 other levels of launch-files)
Now I wish to create a launch.json
in VSCode to debug, so I wrote this configuration:
{
"name": "NodeDebug",
"type": "cppdbg",
"request": "launch",
"miDebuggerServerAddress": "127.0.0.1:3050",
"program": <executable-here>,
"preLaunchTask": "launch_nodes",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
I know what to add to program:
if I were debugging a single node (ie. node1_node
and node2_node
). However, since the executable for this container is built on runtime, how I do access it? Is there any other way to debug a ComposableNodeContainer?