mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-04-07 13:20:10 +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) {
|
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
|
#ifdef MEM_STATS
|
||||||
++lwip_stats.mem.err;
|
++lwip_stats.mem.err;
|
||||||
#endif /* MEM_STATS */
|
#endif /* MEM_STATS */
|
||||||
@ -199,7 +199,7 @@ mem_realloc(void *rmem, mem_size_t newsize)
|
|||||||
(u8_t *)rmem < (u8_t *)ram_end);
|
(u8_t *)rmem < (u8_t *)ram_end);
|
||||||
|
|
||||||
if((u8_t *)rmem < (u8_t *)ram || (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;
|
return rmem;
|
||||||
}
|
}
|
||||||
mem = (struct mem *)((u8_t *)rmem - SIZEOF_STRUCT_MEM);
|
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;
|
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
|
#ifdef MEM_STATS
|
||||||
++lwip_stats.mem.err;
|
++lwip_stats.mem.err;
|
||||||
#endif /* MEM_STATS */
|
#endif /* MEM_STATS */
|
||||||
|
@ -204,7 +204,7 @@ memp_malloc(memp_t type)
|
|||||||
memset(mem, 0, memp_sizes[type]);
|
memset(mem, 0, memp_sizes[type]);
|
||||||
return mem;
|
return mem;
|
||||||
} else {
|
} 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
|
#ifdef MEMP_STATS
|
||||||
++lwip_stats.memp[type].err;
|
++lwip_stats.memp[type].err;
|
||||||
#endif /* MEMP_STATS */
|
#endif /* MEMP_STATS */
|
||||||
|
@ -267,7 +267,7 @@ pbuf_alloc(pbuf_layer l, u16_t size, pbuf_flag flag)
|
|||||||
while(rsize > 0) {
|
while(rsize > 0) {
|
||||||
q = pbuf_pool_alloc();
|
q = pbuf_pool_alloc();
|
||||||
if(q == NULL) {
|
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
|
#ifdef PBUF_STATS
|
||||||
++lwip_stats.pbuf.err;
|
++lwip_stats.pbuf.err;
|
||||||
#endif /* PBUF_STATS */
|
#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));
|
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)) {
|
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->payload,
|
||||||
(u8_t *)p + sizeof(struct pbuf)));
|
(u8_t *)p + sizeof(struct pbuf)));
|
||||||
p->payload = payload;
|
p->payload = payload;
|
||||||
@ -757,7 +757,7 @@ pbuf_unref(struct pbuf *f)
|
|||||||
{
|
{
|
||||||
/* deallocate chain */
|
/* deallocate chain */
|
||||||
pbuf_free(top);
|
pbuf_free(top);
|
||||||
DEBUGF(PBUF_DEBUG, ("pbuf_unref: failed\n"));
|
DEBUGF(PBUF_DEBUG | 2, ("pbuf_unref: failed\n"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user