Page 1 of 1

handler of something like general kernel fault

Posted: Mon Jul 16, 2012 2:14 pm
by alex31
Hello.

Sometime something goes wrong, and program stop. Before launching gdb server is it possible to know
what goes wrong via serial console ?, is it possible to do thing like

* register something like a panic handler which is called, with an api to know what has caused the problem

or

* associate a BaseSequentialStream object to a debug function, and leave chibios print a diagnostic before hanging.

Thanks
Alexandre

Re: handler of something like general kernel fault

Posted: Mon Jul 16, 2012 3:35 pm
by Brrzzt
Search the code for chDbgPanic() -- and don't forget to enable the corresponding debug flags.

BR,

Gerhard

Re: handler of something like general kernel fault

Posted: Mon Jul 16, 2012 5:08 pm
by Giovanni
Correct, the OS always hangs in the panic handler and then the stack trace allows to understand where in halted. The global variable dbg_panic_msg will point to the error message.

If you install the ChibiOS debug plugin the message is automatically fetched and shown to you.

Giovanni