summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorarmink <[email protected]>2015-06-11 10:59:25 +0800
committerarmink <[email protected]>2015-06-11 10:59:25 +0800
commit892eac2cce846d11204036ad7e8fb80c8b332258 (patch)
tree0c852182d0480ba5a20080a86c9e2c7a35195bc2 /src
parenta51f6afa41adc5c617e6ba98a9659096602510fa (diff)
[kservice]add hook for RT_ASSERT
Diffstat (limited to 'src')
-rw-r--r--src/kservice.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/kservice.c b/src/kservice.c
index ab15917bbe..e8076eb237 100644
--- a/src/kservice.c
+++ b/src/kservice.c
@@ -1237,6 +1237,19 @@ int __rt_ffs(int value)
}
#endif
+#ifdef RT_DEBUG
+/* RT_ASSERT(EX)'s hook */
+void (*rt_assert_hook)(const char* ex, const char* func, rt_size_t line);
+/**
+ * This function will set a hook function to RT_ASSERT(EX). It will run when the expression is false.
+ *
+ * @param hook the hook function
+ */
+void rt_assert_set_hook(void (*hook)(const char* ex, const char* func, rt_size_t line)) {
+ rt_assert_hook = hook;
+}
+#endif /* RT_DEBUG */
+
#if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC) && defined (__GNUC__)
#include <sys/types.h>
void *memcpy(void *dest, const void *src, size_t n) __attribute__((weak, alias("rt_memcpy")));