MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_assert_handler

Function rt_assert_handler

src/kservice.c:1181–1205  ·  view source on GitHub ↗

* The RT_ASSERT function. * * @param ex_string is the assertion condition string. * * @param func is the function name when assertion. * * @param line is the file line number when assertion. */

Source from the content-addressed store, hash-verified

1179 * @param line is the file line number when assertion.
1180 */
1181void rt_assert_handler(const char *ex_string, const char *func, rt_size_t line)
1182{
1183 volatile char dummy = 0;
1184
1185 if (rt_assert_hook == RT_NULL)
1186 {
1187#ifdef RT_USING_MODULE
1188 if (dlmodule_self())
1189 {
1190 /* close assertion module */
1191 dlmodule_exit(-1);
1192 }
1193 else
1194#endif /*RT_USING_MODULE*/
1195 {
1196 rt_kprintf("(%s) assertion failed at function:%s, line number:%d \n", ex_string, func, line);
1197 rt_backtrace();
1198 while (dummy == 0);
1199 }
1200 }
1201 else
1202 {
1203 rt_assert_hook(ex_string, func, line);
1204 }
1205}
1206RTM_EXPORT(rt_assert_handler);
1207#endif /* RT_DEBUGING_ASSERT */
1208

Callers 4

usb_assertFunction · 0.85
usb_assertFunction · 0.85
usb_assertFunction · 0.85
rt_hw_uart_initFunction · 0.85

Calls 4

dlmodule_selfFunction · 0.85
dlmodule_exitFunction · 0.85
rt_kprintfFunction · 0.85
rt_backtraceFunction · 0.70

Tested by

no test coverage detected