mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-03-29 13:20:09 +00:00
Added debug levels for some serious errors (out of memory).
This commit is contained in:
parent
74f2b5e5f7
commit
20667e5163
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user