aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/core/msgb.h
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2019-11-11 05:51:43 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2019-11-24 19:59:35 +0100
commit63cb949ebc76a4688c0168ef95bc8f4a8eb24d45 (patch)
treeaa4606a4c5e8dab90fa16e55e201a2c91feba06d /include/osmocom/core/msgb.h
parent344776d2516bfc52d29f0ce67f0edd2c244bd56a (diff)
msgb_put: more elaborate logging of head/tailroom failure
Diffstat (limited to 'include/osmocom/core/msgb.h')
-rw-r--r--include/osmocom/core/msgb.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/include/osmocom/core/msgb.h b/include/osmocom/core/msgb.h
index 1833a6c1..cc76e3ad 100644
--- a/include/osmocom/core/msgb.h
+++ b/include/osmocom/core/msgb.h
@@ -239,7 +239,11 @@ static inline unsigned char *msgb_put(struct msgb *msgb, unsigned int len)
{
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 uint32_t msgb_get_u32(struct msgb *msgb)
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;