From 5f7f249aa690a88e451b66a03e5cdbf8690586f4 Mon Sep 17 00:00:00 2001 From: Ivan Santiago Paunovic Date: Tue, 3 Dec 2019 12:51:57 -0300 Subject: [PATCH] Debugging messages Signed-off-by: Ivan Santiago Paunovic --- rclpy/rclpy/handle.py | 3 +++ rclpy/src/rclpy/_rclpy.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/rclpy/rclpy/handle.py b/rclpy/rclpy/handle.py index d82216a25..b0720d365 100644 --- a/rclpy/rclpy/handle.py +++ b/rclpy/rclpy/handle.py @@ -198,3 +198,6 @@ def __destroy_self(self): self.__destroy_callbacks.pop()(self) # get rid of references to other handles to break reference cycles del self.__required_handles + + def __del__(self): + print('destroying', self.__capsule_name, ' ', self.__capsule_pointer) diff --git a/rclpy/src/rclpy/_rclpy.c b/rclpy/src/rclpy/_rclpy.c index 4d24d510b..60ed9a453 100644 --- a/rclpy/src/rclpy/_rclpy.c +++ b/rclpy/src/rclpy/_rclpy.c @@ -47,6 +47,7 @@ static PyObject * NodeNameNonExistentError; void _rclpy_context_capsule_destructor(PyObject * capsule) { + fprintf(stderr, "context being destructed\n"); rcl_context_t * context = (rcl_context_t *)PyCapsule_GetPointer(capsule, "rcl_context_t"); if (!context) { return; @@ -75,6 +76,7 @@ _rclpy_context_capsule_destructor(PyObject * capsule) rcl_reset_error(); } } + fprintf(stderr, "context destructed\n"); PyMem_FREE(context); } @@ -594,6 +596,7 @@ rclpy_init(PyObject * Py_UNUSED(self), PyObject * args) static void _rclpy_destroy_node(PyObject * pyentity) { + fprintf(stderr, "destroying node\n"); rcl_node_t * node = (rcl_node_t *)PyCapsule_GetPointer( pyentity, "rcl_node_t"); if (!node) { @@ -615,6 +618,7 @@ _rclpy_destroy_node(PyObject * pyentity) rcl_get_error_string().str); } PyMem_Free(node); + fprintf(stderr, "destroyed node\n"); } /// Create a node @@ -2148,6 +2152,7 @@ rclpy_send_request(PyObject * Py_UNUSED(self), PyObject * args) static void _rclpy_destroy_service(PyObject * pyentity) { + fprintf(stderr, "destroying service\n"); rclpy_service_t * srv = (rclpy_service_t *)PyCapsule_GetPointer( pyentity, "rclpy_service_t"); if (!srv) { @@ -2169,6 +2174,7 @@ _rclpy_destroy_service(PyObject * pyentity) rcl_get_error_string().str); } PyMem_Free(srv); + fprintf(stderr, "destroyed service\n"); } /// Create a service server