ChibiOS/RT  5.1.0
Collaboration diagram for Debug:

Detailed Description

Debug APIs and services:

Note
Stack checks are not implemented in this module but in the port layer in an architecture-dependent way.

Modules

 Checks and Assertions
 
 Tracing
 
 Statistics
 

Debug related settings

#define CH_DBG_STACK_FILL_VALUE   0x55
 Fill value for thread stack area in debug mode. More...
 

Macro Functions

#define chDbgCheck(c)
 Function parameters check. More...
 
#define chDbgAssert(c, r)
 Condition assertion. More...
 

Functions

void _dbg_check_disable (void)
 Guard code for chSysDisable(). More...
 
void _dbg_check_suspend (void)
 Guard code for chSysSuspend(). More...
 
void _dbg_check_enable (void)
 Guard code for chSysEnable(). More...
 
void _dbg_check_lock (void)
 Guard code for chSysLock(). More...
 
void _dbg_check_unlock (void)
 Guard code for chSysUnlock(). More...
 
void _dbg_check_lock_from_isr (void)
 Guard code for chSysLockFromIsr(). More...
 
void _dbg_check_unlock_from_isr (void)
 Guard code for chSysUnlockFromIsr(). More...
 
void _dbg_check_enter_isr (void)
 Guard code for CH_IRQ_PROLOGUE(). More...
 
void _dbg_check_leave_isr (void)
 Guard code for CH_IRQ_EPILOGUE(). More...
 
void chDbgCheckClassI (void)
 I-class functions context check. More...
 
void chDbgCheckClassS (void)
 S-class functions context check. More...
 

Macro Definition Documentation

#define CH_DBG_STACK_FILL_VALUE   0x55

Fill value for thread stack area in debug mode.

Definition at line 47 of file chdebug.h.

Referenced by chThdCreate(), chThdCreateFromHeap(), chThdCreateFromMemoryPool(), chThdCreateStatic(), and chThdCreateSuspended().

#define chDbgCheck (   c)
Value:
do { \
/*lint -save -e506 -e774 [2.1, 14.3] Can be a constant by design.*/ \
if (!(c)) { \
/*lint -restore*/ \
chSysHalt(__func__); \
} \
} \
} while (false)
#define CH_DBG_ENABLE_CHECKS
Debug option, parameters checks.
Definition: chconf.h:487
void chSysHalt(const char *reason)
Halts the system.
Definition: chsys.c:198
#define FALSE
Generic 'false' preprocessor boolean constant.
Definition: ch.h:77

Function parameters check.

If the condition check fails then the kernel panics and halts.

Note
The condition is tested only if the CH_DBG_ENABLE_CHECKS switch is specified in chconf.h else the macro does nothing.
Parameters
[in]cthe condition to be verified to be true
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 101 of file chdebug.h.

Referenced by chCondBroadcastI(), chCondObjectInit(), chCondSignal(), chCondSignalI(), chCondWaitS(), chCondWaitTimeoutS(), chCoreAllocAlignedWithOffsetI(), chEvtBroadcastFlagsI(), chEvtDispatch(), chEvtRegisterMaskWithFlags(), chEvtSignal(), chEvtSignalI(), chEvtUnregister(), chGuardedPoolLoadArray(), chHeapAllocAligned(), chHeapFree(), chHeapObjectInit(), chMBFetchI(), chMBFetchTimeoutS(), chMBObjectInit(), chMBPostAheadI(), chMBPostAheadTimeoutS(), chMBPostI(), chMBPostTimeoutS(), chMBResetI(), chMsgSend(), chMtxLockS(), chMtxObjectInit(), chMtxTryLockS(), chMtxUnlock(), chMtxUnlockS(), chPoolAllocI(), chPoolFreeI(), chPoolLoadArray(), chPoolObjectInitAligned(), chSchReadyAheadI(), chSchReadyI(), chSemAddCounterI(), chSemObjectInit(), chSemResetI(), chSemSignal(), chSemSignalI(), chSemSignalWait(), chSemWaitS(), chSemWaitTimeoutS(), chThdCreateFromMemoryPool(), chThdCreateStatic(), chThdCreateSuspendedI(), chThdSetPriority(), chThdSleepS(), chThdWait(), chTimeAddX(), chVTDoResetI(), and chVTDoSetI().

#define chDbgAssert (   c,
 
)
Value:
do { \
/*lint -save -e506 -e774 [2.1, 14.3] Can be a constant by design.*/ \
if (!(c)) { \
/*lint -restore*/ \
chSysHalt(__func__); \
} \
} \
} while (false)
void chSysHalt(const char *reason)
Halts the system.
Definition: chsys.c:198
#define CH_DBG_ENABLE_ASSERTS
Debug option, consistency checks.
Definition: chconf.h:499
#define FALSE
Generic 'false' preprocessor boolean constant.
Definition: ch.h:77

Condition assertion.

If the condition check fails then the kernel panics with a message and halts.

Note
The condition is tested only if the CH_DBG_ENABLE_ASSERTS switch is specified in chconf.h else the macro does nothing.
The remark string is not currently used except for putting a comment in the code about the assertion.
Parameters
[in]cthe condition to be verified to be true
[in]ra remark string
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 127 of file chdebug.h.

Referenced by chCondWaitS(), chCondWaitTimeoutS(), chEvtDispatch(), chFifoSendObject(), chFifoSendObjectAhead(), chFifoSendObjectAheadI(), chFifoSendObjectAheadS(), chFifoSendObjectI(), chFifoSendObjectS(), chGuardedPoolAllocI(), chHeapFree(), chMsgGet(), chMsgRelease(), chMtxLockS(), chMtxTryLockS(), chMtxUnlock(), chMtxUnlockS(), chPoolFreeI(), chRegNextThread(), chSchReadyAheadI(), chSchReadyI(), chSchWakeupS(), chSemAddCounterI(), chSemResetI(), chSemSignal(), chSemSignalI(), chSemSignalWait(), chSemWaitS(), chSemWaitTimeoutS(), chSysUnlock(), chThdAddRef(), chThdCreate(), chThdCreateStatic(), chThdCreateSuspended(), chThdDoDequeueNextI(), chThdExitS(), chThdRelease(), chThdResumeI(), chThdResumeS(), chThdStart(), chThdStartI(), chThdSuspendS(), chThdSuspendTimeoutS(), chThdWait(), chTimeI2MS(), chTimeI2S(), chTimeI2US(), chTimeMS2I(), chTimeS2I(), chTimeUS2I(), chVTDoResetI(), chVTDoSetI(), and chVTDoTickI().

Function Documentation

void _dbg_check_disable ( void  )

Guard code for chSysDisable().

Function Class:
Not an API, this function is for internal use only.

Definition at line 114 of file chdebug.c.

References ch, chSysHalt(), ch_system::dbg, ch_system_debug::isr_cnt, and ch_system_debug::lock_cnt.

Referenced by chSysDisable().

Here is the call graph for this function:

void _dbg_check_suspend ( void  )

Guard code for chSysSuspend().

Function Class:
Not an API, this function is for internal use only.

Definition at line 126 of file chdebug.c.

References ch, chSysHalt(), ch_system::dbg, ch_system_debug::isr_cnt, and ch_system_debug::lock_cnt.

Referenced by chSysSuspend().

Here is the call graph for this function:

void _dbg_check_enable ( void  )

Guard code for chSysEnable().

Function Class:
Not an API, this function is for internal use only.

Definition at line 138 of file chdebug.c.

References ch, chSysHalt(), ch_system::dbg, ch_system_debug::isr_cnt, and ch_system_debug::lock_cnt.

Referenced by chSysEnable().

Here is the call graph for this function:

void _dbg_check_lock ( void  )

Guard code for chSysLock().

Function Class:
Not an API, this function is for internal use only.

Definition at line 150 of file chdebug.c.

References ch, chSysHalt(), ch_system::dbg, ch_system_debug::isr_cnt, and ch_system_debug::lock_cnt.

Referenced by chSysLock().

Here is the call graph for this function:

void _dbg_check_unlock ( void  )

Guard code for chSysUnlock().

Function Class:
Not an API, this function is for internal use only.

Definition at line 163 of file chdebug.c.

References ch, chSysHalt(), ch_system::dbg, ch_system_debug::isr_cnt, and ch_system_debug::lock_cnt.

Referenced by chSysUnlock().

Here is the call graph for this function:

void _dbg_check_lock_from_isr ( void  )

Guard code for chSysLockFromIsr().

Function Class:
Not an API, this function is for internal use only.

Definition at line 176 of file chdebug.c.

References ch, chSysHalt(), ch_system::dbg, ch_system_debug::isr_cnt, and ch_system_debug::lock_cnt.

Referenced by chSysLockFromISR().

Here is the call graph for this function:

void _dbg_check_unlock_from_isr ( void  )

Guard code for chSysUnlockFromIsr().

Function Class:
Not an API, this function is for internal use only.

Definition at line 189 of file chdebug.c.

References ch, chSysHalt(), ch_system::dbg, ch_system_debug::isr_cnt, and ch_system_debug::lock_cnt.

Referenced by chSysUnlockFromISR().

Here is the call graph for this function:

void _dbg_check_enter_isr ( void  )

Guard code for CH_IRQ_PROLOGUE().

Function Class:
Not an API, this function is for internal use only.

Definition at line 202 of file chdebug.c.

References ch, chSysHalt(), ch_system::dbg, ch_system_debug::isr_cnt, and ch_system_debug::lock_cnt.

Here is the call graph for this function:

void _dbg_check_leave_isr ( void  )

Guard code for CH_IRQ_EPILOGUE().

Function Class:
Not an API, this function is for internal use only.

Definition at line 217 of file chdebug.c.

References ch, chSysHalt(), ch_system::dbg, ch_system_debug::isr_cnt, and ch_system_debug::lock_cnt.

Here is the call graph for this function:

void chDbgCheckClassI ( void  )
void chDbgCheckClassS ( void  )

S-class functions context check.

Verifies that the system is in an appropriate state for invoking an S-class API function. A panic is generated if the state is not compatible.

Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 250 of file chdebug.c.

References ch, chSysHalt(), ch_system::dbg, ch_system_debug::isr_cnt, and ch_system_debug::lock_cnt.

Referenced by chBSemWaitS(), chBSemWaitTimeoutS(), chCondWaitS(), chCondWaitTimeoutS(), chMBFetchTimeoutS(), chMBPostAheadTimeoutS(), chMBPostTimeoutS(), chMsgReleaseS(), chMtxLockS(), chMtxQueueNotEmptyS(), chMtxTryLockS(), chMtxUnlockS(), chSchCanYieldS(), chSchGoSleepS(), chSchGoSleepTimeoutS(), chSchIsRescRequiredI(), chSchRescheduleS(), chSchWakeupS(), chSemWaitS(), and chSemWaitTimeoutS().

Here is the call graph for this function: