summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2015-08-03 16:07:30 +0800
committerBernard Xiong <[email protected]>2015-08-03 16:07:30 +0800
commit266496cef3a109660dc575a38a127d5508d59208 (patch)
tree40bdcce55d498ac1ae6d918d9fdd4d4f2b7b9aa9 /include
parentabd19b8dd7fac0235c28c5c5e84bc5779d4d0991 (diff)
[Kernel] Use rt_assert_handler() function to handle assertion.
Diffstat (limited to 'include')
-rw-r--r--include/rtdebug.h9
-rw-r--r--include/rtthread.h2
2 files changed, 3 insertions, 8 deletions
diff --git a/include/rtdebug.h b/include/rtdebug.h
index a324a29623..69a33b391f 100644
--- a/include/rtdebug.h
+++ b/include/rtdebug.h
@@ -83,14 +83,7 @@ while (0)
#define RT_ASSERT(EX) \
if (!(EX)) \
{ \
- volatile char dummy = 0; \
- if (rt_assert_hook == RT_NULL) \
- { \
- rt_kprintf("(%s) assert failed at %s:%d \n", #EX, __FUNCTION__, __LINE__);\
- while (dummy == 0); \
- } else { \
- rt_assert_hook(#EX, __FUNCTION__, __LINE__); \
- } \
+ rt_assert_handler(#EX, __FUNCTION__, __LINE__); \
}
/* Macro to check current context */
diff --git a/include/rtthread.h b/include/rtthread.h
index 705795b522..c7f35d163e 100644
--- a/include/rtthread.h
+++ b/include/rtthread.h
@@ -518,6 +518,8 @@ void rt_show_version(void);
#ifdef RT_DEBUG
extern void (*rt_assert_hook)(const char* ex, const char* func, rt_size_t line);
void rt_assert_set_hook(void (*hook)(const char* ex, const char* func, rt_size_t line));
+
+void rt_assert_handler(const char* ex, const char* func, rt_size_t line);
#endif /* RT_DEBUG */
/*@}*/