ChibiOS/RT Architecture - Reference Manual - Guides |
Debug APIs and services:
Data Structures | |
struct | CtxSwcEvent |
Trace buffer record. More... | |
struct | TraceBuffer |
Trace buffer header. More... | |
Defines | |
#define | TRACE_BUFFER_SIZE 64 |
Trace buffer entries. | |
#define | STACK_FILL_VALUE 0x55 |
Fill value for thread stack area in debug mode. | |
#define | THREAD_FILL_VALUE 0xFF |
Fill value for thread area in debug mode. | |
#define | chDbgCheck(c, func) |
Function parameter check. | |
#define | chDbgAssert(c, m, r) |
Condition assertion. | |
Functions | |
void | trace_init (void) |
Trace circular buffer subsystem initialization. | |
void | chDbgTrace (Thread *otp) |
Inserts in the circular debug trace buffer a context switch record. | |
void | chDbgPanic (char *msg) |
Prints a panic message on the console and then halts the system. | |
Variables | |
TraceBuffer | trace_buffer |
Public trace buffer. | |
char * | panic_msg |
Pointer to the panic message. |
#define TRACE_BUFFER_SIZE 64 |
#define STACK_FILL_VALUE 0x55 |
Fill value for thread stack area in debug mode.
Definition at line 49 of file chdebug.h.
Referenced by chThdCreateFromHeap(), chThdCreateFromMemoryPool(), and chThdCreateStatic().
#define THREAD_FILL_VALUE 0xFF |
Fill value for thread area in debug mode.
Definition at line 60 of file chdebug.h.
Referenced by chThdCreateFromHeap(), chThdCreateFromMemoryPool(), and chThdCreateStatic().
#define chDbgCheck | ( | c, | ||
func | ||||
) |
{ \ if (!(c)) \ chDbgPanic(__QUOTE_THIS(func)"(), line "__QUOTE_THIS(__LINE__)); \ }
Function parameter check.
If the condition check fails then the kernel panics and halts.
CH_DBG_ENABLE_CHECKS
switch is specified in chconf.h
else the macro does nothing.[in] | c | the condition to be verified to be true |
[in] | func | the undecorated function name |
Definition at line 102 of file chdebug.h.
Referenced by adcStart(), adcStartConversion(), adcStop(), adcStopConversion(), canReceive(), canSleep(), canStart(), canStop(), canTransmit(), canWakeup(), chCondBroadcastI(), chCondInit(), chCondSignal(), chCondSignalI(), chCondWaitS(), chCondWaitTimeoutS(), chEvtBroadcastI(), chEvtDispatch(), chEvtRegisterMask(), chEvtSignal(), chEvtSignalI(), chEvtUnregister(), chHeapFree(), chHeapInit(), chIQReadTimeout(), chMBFetchS(), chMBInit(), chMBPostAheadS(), chMBPostS(), chMBReset(), chMsgSend(), chMtxInit(), chMtxLockS(), chMtxTryLockS(), chOQWriteTimeout(), chPoolAllocI(), chPoolFreeI(), chPoolInit(), chSemInit(), chSemResetI(), chSemSignal(), chSemSignalI(), chSemSignalWait(), chSemWaitS(), chSemWaitTimeoutS(), chThdCreateFromMemoryPool(), chThdCreateI(), chThdSetPriority(), chThdSleep(), chThdWait(), chVTResetI(), chVTSetI(), mmcConnect(), mmcDisconnect(), mmcSequentialRead(), mmcSequentialWrite(), mmcStart(), mmcStartSequentialRead(), mmcStartSequentialWrite(), mmcStop(), mmcStopSequentialRead(), mmcStopSequentialWrite(), palReadBus(), palSetBusMode(), palWriteBus(), pwmDisableChannel(), pwmEnableChannel(), pwmStart(), pwmStop(), sdAddFlagsI(), sdGetAndClearFlags(), sdIncomingDataI(), sdRequestDataI(), sdStart(), sdStop(), spiAcquireBus(), spiExchange(), spiIgnore(), spiReceive(), spiReleaseBus(), spiSelect(), spiSend(), spiStart(), spiStop(), and spiUnselect().
#define chDbgAssert | ( | c, | ||
m, | ||||
r | ||||
) |
{ \ if (!(c)) \ chDbgPanic(m); \ }
Condition assertion.
If the condition check fails then the kernel panics with the specified message and halts.
CH_DBG_ENABLE_ASSERTS
switch is specified in chconf.h
else the macro does nothing. [in] | c | the condition to be verified to be true |
[in] | m | the text message |
[in] | r | a remark string |
Definition at line 128 of file chdebug.h.
Referenced by adcStart(), adcStartConversion(), adcStop(), adcStopConversion(), adcWaitConversion(), canReceive(), canSleep(), canStart(), canStop(), canTransmit(), canWakeup(), chCondWaitS(), chCondWaitTimeoutS(), chEvtDispatch(), chHeapFree(), chMsgRelease(), chMtxLockS(), chMtxUnlock(), chMtxUnlockS(), chRegNextThread(), chThdAddRef(), chThdRelease(), chThdResume(), chThdWait(), chVTResetI(), mmcConnect(), mmcDisconnect(), mmcStart(), mmcStop(), pwmDisableChannel(), pwmEnableChannel(), pwmStart(), pwmStop(), sdStart(), sdStop(), spiExchange(), spiIgnore(), spiReceive(), spiSelect(), spiSend(), spiStart(), spiStop(), and spiUnselect().
void trace_init | ( | void | ) |
Trace circular buffer subsystem initialization.
Definition at line 51 of file chdebug.c.
References TraceBuffer::tb_buffer, TraceBuffer::tb_ptr, and TraceBuffer::tb_size.
Referenced by chSysInit().
void chDbgTrace | ( | Thread * | otp | ) |
Inserts in the circular debug trace buffer a context switch record.
[in] | otp | the thread being switched out |
Definition at line 62 of file chdebug.c.
References chTimeNow, CtxSwcEvent::cse_state, CtxSwcEvent::cse_tid, CtxSwcEvent::cse_time, CtxSwcEvent::cse_wtobjp, currp, Thread::p_state, Thread::p_u, TraceBuffer::tb_buffer, TraceBuffer::tb_ptr, TRACE_BUFFER_SIZE, and Thread::wtobjp.
Referenced by chSchDoRescheduleI(), chSchGoSleepS(), and chSchWakeupS().
void chDbgPanic | ( | char * | msg | ) |
char* panic_msg |
Pointer to the panic message.
This pointer is meant to be accessed through the debugger, it is written once and then the system is halted. This variable can be set to NULL
if the halt is caused by a stack overflow.
Definition at line 80 of file chdebug.c.
Referenced by chDbgPanic().