qwait() chDbgPanic()
Posted: Wed Jun 15, 2011 4:25 pm
This is on ChibiOS/RT trunk.
I modified syscalls.c/_write_t() with the intention to print "\r\n" if the last character is '\n', as follows:
if (ptr[len - 1] == '\n') {
sdWrite(&STDOUT_SD, (uint8_t *)ptr, (size_t)len - 1);
sdWrite(&STDOUT_SD, "\r\n", 2);
} else
{
sdWrite(&STDOUT_SD, (uint8_t *)ptr, (size_t)len);
}
I have added a printf("conn = %p\n"); to the http_server(); and this is what happens:
Program received signal SIGINT, Interrupt.
port_halt () at ../../os/ports/GCC/ARMCMx/chcore.c:43
43 }
(gdb) bt
#0 port_halt () at ../../os/ports/GCC/ARMCMx/chcore.c:43
#1 0x08000696 in chDbgPanic (msg=0x0) at ../../os/kernel/src/chdebug.c:91
#2 0x08000a06 in chSchGoSleepS (newstate=13 '\r')
at ../../os/kernel/src/chschd.c:117
#3 0x08000ae4 in chSchGoSleepTimeoutS (newstate=13 '\r', time=4294967295)
at ../../os/kernel/src/chschd.c:186
#4 0x08002ec0 in qwait (qp=0x200071f4, time=4294967295)
at ../../os/kernel/src/chqueues.c:71
#5 0x0800336c in chOQWriteTimeout (oqp=0x200071f4, bp=0x8033331 "\n", n=1,
time=4294967295) at ../../os/kernel/src/chqueues.c:400
#6 0x0800d40a in _write_r (r=0x20000108, file=1,
ptr=0x20008fa0 "conn = 0x2000a0b8\nking\n\354l\324\301\177\356\065\215$Ik\361\026\330b\375껇\031\252sGZm\375\205\061\256\\\272\024&\216*\353\016^?{t\337X\340?\302\357\366\206\254j\202\265!_\363\301\034", len=18)
at ../../os/various/syscalls.c:119
#7 0x08030f94 in __swrite ()
#8 0x0802f3b6 in _fflush_r ()
#9 0x0802fb7a in __sfvwrite_r ()
#10 0x20008e1c in ?? ()
#11 0x20008e1c in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
What did I overlook?
qwait() is reasonably new, maybe it tries to put the thread on the queue twice?
Regards,
Leon.
I modified syscalls.c/_write_t() with the intention to print "\r\n" if the last character is '\n', as follows:
if (ptr[len - 1] == '\n') {
sdWrite(&STDOUT_SD, (uint8_t *)ptr, (size_t)len - 1);
sdWrite(&STDOUT_SD, "\r\n", 2);
} else
{
sdWrite(&STDOUT_SD, (uint8_t *)ptr, (size_t)len);
}
I have added a printf("conn = %p\n"); to the http_server(); and this is what happens:
Program received signal SIGINT, Interrupt.
port_halt () at ../../os/ports/GCC/ARMCMx/chcore.c:43
43 }
(gdb) bt
#0 port_halt () at ../../os/ports/GCC/ARMCMx/chcore.c:43
#1 0x08000696 in chDbgPanic (msg=0x0) at ../../os/kernel/src/chdebug.c:91
#2 0x08000a06 in chSchGoSleepS (newstate=13 '\r')
at ../../os/kernel/src/chschd.c:117
#3 0x08000ae4 in chSchGoSleepTimeoutS (newstate=13 '\r', time=4294967295)
at ../../os/kernel/src/chschd.c:186
#4 0x08002ec0 in qwait (qp=0x200071f4, time=4294967295)
at ../../os/kernel/src/chqueues.c:71
#5 0x0800336c in chOQWriteTimeout (oqp=0x200071f4, bp=0x8033331 "\n", n=1,
time=4294967295) at ../../os/kernel/src/chqueues.c:400
#6 0x0800d40a in _write_r (r=0x20000108, file=1,
ptr=0x20008fa0 "conn = 0x2000a0b8\nking\n\354l\324\301\177\356\065\215$Ik\361\026\330b\375껇\031\252sGZm\375\205\061\256\\\272\024&\216*\353\016^?{t\337X\340?\302\357\366\206\254j\202\265!_\363\301\034", len=18)
at ../../os/various/syscalls.c:119
#7 0x08030f94 in __swrite ()
#8 0x0802f3b6 in _fflush_r ()
#9 0x0802fb7a in __sfvwrite_r ()
#10 0x20008e1c in ?? ()
#11 0x20008e1c in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
What did I overlook?
qwait() is reasonably new, maybe it tries to put the thread on the queue twice?
Regards,
Leon.