Change in libosmocore[master]: msgb_put: more elaborate logging of head/tailroom failure

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

neels gerrit-no-reply at lists.osmocom.org
Thu Nov 21 20:31:42 UTC 2019


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/16164 )


Change subject: msgb_put: more elaborate logging of head/tailroom failure
......................................................................

msgb_put: more elaborate logging of head/tailroom failure

Change-Id: I55b68098e1037c74ebe5faa86e34bd4494f5b726
---
M include/osmocom/core/msgb.h
1 file changed, 12 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/64/16164/1

diff --git a/include/osmocom/core/msgb.h b/include/osmocom/core/msgb.h
index 1833a6c..cc76e3a 100644
--- a/include/osmocom/core/msgb.h
+++ b/include/osmocom/core/msgb.h
@@ -239,7 +239,11 @@
 {
 	unsigned char *tmp = msgb->tail;
 	if (msgb_tailroom(msgb) < (int) len)
-		MSGB_ABORT(msgb, "Not enough tailroom msgb_put (%u < %u)\n",
+		MSGB_ABORT(msgb, "Not enough tailroom msgb_put"
+			   " (allocated %u, head at %u, len %u, tailroom %u < want tailroom %u)\n",
+			   msgb->data_len - sizeof(struct msgb),
+			   msgb->head - msgb->_data,
+			   msgb->len,
 			   msgb_tailroom(msgb), len);
 	msgb->tail += len;
 	msgb->len += len;
@@ -335,8 +339,13 @@
 static inline unsigned char *msgb_push(struct msgb *msgb, unsigned int len)
 {
 	if (msgb_headroom(msgb) < (int) len)
-		MSGB_ABORT(msgb, "Not enough headroom msgb_push (%u < %u)\n",
-			   msgb_headroom(msgb), len);
+		MSGB_ABORT(msgb, "Not enough headroom msgb_push"
+			   " (allocated %u, head at %u < want headroom %u, len %u, tailroom %u)\n",
+			   msgb->data_len - sizeof(struct msgb),
+			   msgb->head - msgb->_data,
+			   len,
+			   msgb->len,
+			   msgb_tailroom(msgb));
 	msgb->data -= len;
 	msgb->len += len;
 	return msgb->data;

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/16164
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I55b68098e1037c74ebe5faa86e34bd4494f5b726
Gerrit-Change-Number: 16164
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191121/ec2a9a51/attachment.htm>


More information about the gerrit-log mailing list