* 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. */
| 1179 | * @param line is the file line number when assertion. |
| 1180 | */ |
| 1181 | void 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 | } |
| 1206 | RTM_EXPORT(rt_assert_handler); |
| 1207 | #endif /* RT_DEBUGING_ASSERT */ |
| 1208 |
no test coverage detected