Added a debug mode that keeps track of where individual queuebufs are allocated, which is useful when debugging queuebuf leakage problems.

This commit is contained in:
adamdunkels 2010-11-25 08:43:59 +00:00
parent 880233a451
commit 2f66db3ded
2 changed files with 56 additions and 3 deletions

View file

@ -41,7 +41,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: queuebuf.h,v 1.3 2010/10/12 19:51:28 oliverschmidt Exp $
* $Id: queuebuf.h,v 1.4 2010/11/25 08:43:59 adamdunkels Exp $
*/
/**
@ -62,13 +62,25 @@
#define QUEUEBUF_NUM 8
#endif
#ifdef QUEUEBUF_CONF_DEBUG
#define QUEUEBUF_DEBUG QUEUEBUF_CONF_DEBUG
#else /* QUEUEBUF_CONF_DEBUG */
#define QUEUEBUF_DEBUG 0
#endif /* QUEUEBUF_CONF_DEBUG */
struct queuebuf;
void queuebuf_init(void);
#if QUEUEBUF_DEBUG
struct queuebuf *queuebuf_new_from_packetbuf_debug(const char *file, int line);
#define queuebuf_new_from_packetbuf() queuebuf_new_from_packetbuf_debug(__FILE__, __LINE__)
#else /* QUEUEBUF_DEBUG */
struct queuebuf *queuebuf_new_from_packetbuf(void);
void queuebuf_free(struct queuebuf *b);
#endif /* QUEUEBUF_DEBUG */
void queuebuf_to_packetbuf(struct queuebuf *b);
void queuebuf_free(struct queuebuf *b);
void *queuebuf_dataptr(struct queuebuf *b);
int queuebuf_datalen(struct queuebuf *b);
@ -76,6 +88,8 @@ int queuebuf_datalen(struct queuebuf *b);
rimeaddr_t *queuebuf_addr(struct queuebuf *b, uint8_t type);
packetbuf_attr_t queuebuf_attr(struct queuebuf *b, uint8_t type);
void queuebuf_debug_print(void);
#endif /* __QUEUEBUF_H__ */
/** @} */