lwip: log thread and sleep forever in assert()

This commit is contained in:
Christian Helmuth 2015-09-22 17:22:42 +02:00
parent 7e3bcb1e39
commit 6616bd4593
2 changed files with 27 additions and 13 deletions

View File

@ -36,15 +36,19 @@ typedef unsigned long mem_ptr_t;
#define X32_F "x"
void lwip_printf(const char *format, ...);
void lwip_sleep_forever(void);
#define LWIP_PLATFORM_DIAG(x) do { lwip_printf x; } while(0)
#ifdef GENODE_RELEASE
#define LWIP_PLATFORM_ASSERT(x)
#else /* GENODE_RELEASE */
#define LWIP_PLATFORM_ASSERT(x) do { \
lwip_printf("Assertion \"%s\" failed at line %d in %s\n", \
x, __LINE__, __FILE__); } while(0)
#define LWIP_PLATFORM_ASSERT(x) \
do { \
lwip_printf("Assertion \"%s\" failed at %s:%u\n", \
x, __FILE__, __LINE__); \
lwip_sleep_forever(); \
} while (0)
#endif /* GENODE_RELEASE */
#define PACK_STRUCT_FIELD(x) x

View File

@ -451,7 +451,7 @@ extern "C" {
*
* Afterwards sys_mbox_valid() returns 0.
* ATTENTION: This does NOT mean that the mailbox shall be deallocated:
* sys_mbox_free() is always called before calling this function!
* sys_mbox_free() is always called before calling this function!
*
* \param mbox mailbox to set invalid
*/
@ -530,21 +530,23 @@ extern "C" {
if (!mbox)
return 0;
u32_t ret = 0;
try {
Mailbox* _mbox = reinterpret_cast<Mailbox*>(mbox->ptr);
if (!_mbox) {
//PERR("Invalid mailbox pointer at %lx", *mbox->ptr);
return EINVAL;
}
return _mbox->get(msg, timeout);
Mailbox* _mbox = reinterpret_cast<Mailbox *>(mbox->ptr);
if (!_mbox)
return 0;
ret = _mbox->get(msg, timeout);
} catch (Genode::Timeout_exception) {
return SYS_ARCH_TIMEOUT;
ret = SYS_ARCH_TIMEOUT;
} catch (Genode::Nonblocking_exception) {
return SYS_MBOX_EMPTY;
ret = SYS_MBOX_EMPTY;
} catch (...) {
PERR("Unknown Exception occured!");
return -1;
ret = SYS_ARCH_TIMEOUT;
}
return ret;
}
@ -652,3 +654,11 @@ extern "C" {
Genode::memcpy(dst, src, size);
}
} /* extern "C" */
extern "C" void lwip_sleep_forever()
{
int dummy = 1;
PDBG("thread %u", (unsigned)(((Genode::addr_t)&dummy)>>20)&0xff);
Genode::sleep_forever();
}