From 20667e5163655b09eede4d0439ce634f2f42a6b5 Mon Sep 17 00:00:00 2001 From: likewise Date: Mon, 24 Mar 2003 10:29:03 +0000 Subject: [PATCH] Added debug levels for some serious errors (out of memory). --- src/core/mem.c | 6 +++--- src/core/memp.c | 2 +- src/core/pbuf.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/mem.c b/src/core/mem.c index 9bfad447..50f2bbe4 100644 --- a/src/core/mem.c +++ b/src/core/mem.c @@ -149,7 +149,7 @@ mem_free(void *rmem) if((u8_t *)rmem < (u8_t *)ram || (u8_t *)rmem >= (u8_t *)ram_end) { - DEBUGF(MEM_DEBUG, ("mem_free: illegal memory\n")); + DEBUGF(MEM_DEBUG | 3, ("mem_free: illegal memory\n")); #ifdef MEM_STATS ++lwip_stats.mem.err; #endif /* MEM_STATS */ @@ -199,7 +199,7 @@ mem_realloc(void *rmem, mem_size_t newsize) (u8_t *)rmem < (u8_t *)ram_end); if((u8_t *)rmem < (u8_t *)ram || (u8_t *)rmem >= (u8_t *)ram_end) { - DEBUGF(MEM_DEBUG, ("mem_realloc: illegal memory\n")); + DEBUGF(MEM_DEBUG | 3, ("mem_realloc: illegal memory\n")); return rmem; } mem = (struct mem *)((u8_t *)rmem - SIZEOF_STRUCT_MEM); @@ -291,7 +291,7 @@ mem_malloc(mem_size_t size) return (u8_t *)mem + SIZEOF_STRUCT_MEM; } } - DEBUGF(MEM_DEBUG, ("mem_malloc: could not allocate %d bytes\n", (int)size)); + DEBUGF(MEM_DEBUG | 2, ("mem_malloc: could not allocate %d bytes\n", (int)size)); #ifdef MEM_STATS ++lwip_stats.mem.err; #endif /* MEM_STATS */ diff --git a/src/core/memp.c b/src/core/memp.c index 70991347..50441a7e 100644 --- a/src/core/memp.c +++ b/src/core/memp.c @@ -204,7 +204,7 @@ memp_malloc(memp_t type) memset(mem, 0, memp_sizes[type]); return mem; } else { - DEBUGF(MEMP_DEBUG, ("memp_malloc: out of memory in pool %d\n", type)); + DEBUGF(MEMP_DEBUG | 2, ("memp_malloc: out of memory in pool %d\n", type)); #ifdef MEMP_STATS ++lwip_stats.memp[type].err; #endif /* MEMP_STATS */ diff --git a/src/core/pbuf.c b/src/core/pbuf.c index b6b3c6b3..b2bf2a79 100644 --- a/src/core/pbuf.c +++ b/src/core/pbuf.c @@ -267,7 +267,7 @@ pbuf_alloc(pbuf_layer l, u16_t size, pbuf_flag flag) while(rsize > 0) { q = pbuf_pool_alloc(); if(q == NULL) { - DEBUGF(PBUF_DEBUG, ("pbuf_alloc: Out of pbufs in pool,\n")); + DEBUGF(PBUF_DEBUG | 2, ("pbuf_alloc: Out of pbufs in pool.\n")); #ifdef PBUF_STATS ++lwip_stats.pbuf.err; #endif /* PBUF_STATS */ @@ -510,7 +510,7 @@ pbuf_header(struct pbuf *p, s16_t header_size) DEBUGF(PBUF_DEBUG, ("pbuf_header: old %p new %p (%d)\n", payload, p->payload, header_size)); if((u8_t *)p->payload < (u8_t *)p + sizeof(struct pbuf)) { - DEBUGF(PBUF_DEBUG, ("pbuf_header: failed %p %p\n", + DEBUGF(PBUF_DEBUG | 2, ("pbuf_header: failed %p %p\n", (u8_t *)p->payload, (u8_t *)p + sizeof(struct pbuf))); p->payload = payload; @@ -757,7 +757,7 @@ pbuf_unref(struct pbuf *f) { /* deallocate chain */ pbuf_free(top); - DEBUGF(PBUF_DEBUG, ("pbuf_unref: failed\n")); + DEBUGF(PBUF_DEBUG | 2, ("pbuf_unref: failed\n")); return NULL; } }