Skip to content

Commit

Permalink
Debugging messages
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Santiago Paunovic <[email protected]>
  • Loading branch information
ivanpauno committed Dec 3, 2019
1 parent b740f90 commit 5f7f249
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rclpy/rclpy/handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 6 additions & 0 deletions rclpy/src/rclpy/_rclpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -75,6 +76,7 @@ _rclpy_context_capsule_destructor(PyObject * capsule)
rcl_reset_error();
}
}
fprintf(stderr, "context destructed\n");
PyMem_FREE(context);
}

Expand Down Expand Up @@ -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) {
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -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
Expand Down

0 comments on commit 5f7f249

Please sign in to comment.