From: Jérémie Galarneau Date: Tue, 9 Feb 2021 22:09:37 +0000 (-0500) Subject: buffer-view: improve logging on creation failure X-Git-Tag: v2.13.0-rc1~342 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=df62dbcd26798ca35926f8316a1b5734e825b84b;p=lttng-tools.git buffer-view: improve logging on creation failure Signed-off-by: Jérémie Galarneau Change-Id: Iddb902d6a02e69a3d2f02598c99a4a818bb4540c --- diff --git a/src/common/buffer-view.c b/src/common/buffer-view.c index 7337dbb06..04bd1ca35 100644 --- a/src/common/buffer-view.c +++ b/src/common/buffer-view.c @@ -34,12 +34,14 @@ struct lttng_buffer_view lttng_buffer_view_from_view( assert(src); if (offset > src->size) { - ERR("Attempt to create buffer view with invalid offset"); + ERR("Attempt to create buffer view from another view with invalid offset (offset > source size): source size = %zu, offset in source = %zu, length = %zd", + src->size, offset, len); goto end; } if (len != -1 && len > (src->size - offset)) { - ERR("Attempt to create buffer view with invalid length"); + ERR("Attempt to create buffer view from another view with invalid length (length > space left after offset in source): source size = %zu, offset in source = %zu, length = %zd", + src->size, offset, len); goto end; } @@ -59,12 +61,14 @@ struct lttng_buffer_view lttng_buffer_view_from_dynamic_buffer( assert(src); if (offset > src->size) { - ERR("Attempt to create buffer view with invalid offset"); + ERR("Attempt to create buffer view from a dynamic buffer with invalid offset (offset > source size): source size = %zu, offset in source = %zu, length = %zd", + src->size, offset, len); goto end; } if (len != -1 && len > (src->size - offset)) { - ERR("Attempt to create buffer view with invalid length"); + ERR("Attempt to create buffer view from a dynamic buffer with invalid length (length > space left after offset in source): source size = %zu, offset in source = %zu, length = %zd", + src->size, offset, len); goto end; }