From 244b903e5def3cd4aefc4bf2ebdc4687826e2f4d Mon Sep 17 00:00:00 2001 From: "Man, Jianting (Meco)" <920369182@qq.com> Date: Fri, 21 Jul 2023 22:36:42 -0400 Subject: [debug] 整理debug宏并增加RT_DEBUGING_CONTEXT (#7805) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/rtdbg.h | 8 ++++---- include/rtdef.h | 4 ++-- include/rtthread.h | 26 ++++++++------------------ 3 files changed, 14 insertions(+), 24 deletions(-) (limited to 'include') diff --git a/include/rtdbg.h b/include/rtdbg.h index 4eb544aecb..10331edc0e 100644 --- a/include/rtdbg.h +++ b/include/rtdbg.h @@ -36,13 +36,13 @@ extern "C" { #endif -/* the debug log will force enable when RT_DEBUG macro is defined */ -#if defined(RT_DEBUG) && !defined(DBG_ENABLE) +/* the debug log will force enable when RT_USING_DEBUG macro is defined */ +#if defined(RT_USING_DEBUG) && !defined(DBG_ENABLE) #define DBG_ENABLE #endif -/* it will force output color log when RT_DEBUG_COLOR macro is defined */ -#if defined(RT_DEBUG_COLOR) && !defined(DBG_COLOR) +/* it will force output color log when RT_DEBUGING_COLOR macro is defined */ +#if defined(RT_DEBUGING_COLOR) && !defined(DBG_COLOR) #define DBG_COLOR #endif diff --git a/include/rtdef.h b/include/rtdef.h index 9562c410f5..c0f1cb1f24 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -271,7 +271,7 @@ typedef __gnuc_va_list va_list; typedef int (*init_fn_t)(void); #ifdef _MSC_VER #pragma section("rti_fn$f",read) - #ifdef RT_DEBUG_INIT + #ifdef RT_DEBUGING_INIT struct rt_init_desc { const char* level; @@ -297,7 +297,7 @@ typedef int (*init_fn_t)(void); {__rti_level_##fn, fn }; #endif #else - #ifdef RT_DEBUG_INIT + #ifdef RT_DEBUGING_INIT struct rt_init_desc { const char* fn_name; diff --git a/include/rtthread.h b/include/rtthread.h index 4c0de6a511..69cec5992b 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -18,7 +18,7 @@ * 2021-11-14 Meco Man add rtlegacy.h for compatibility * 2022-06-04 Meco Man remove strnlen * 2023-05-20 Bernard add rtatomic.h header file to included files. - * 2023-06-30 ChuShicheng Move RT_DEBUG_CONTEXT_CHECK from the rtdebug.h + * 2023-06-30 ChuShicheng move debug check from the rtdebug.h */ #ifndef __RT_THREAD_H__ @@ -718,24 +718,19 @@ rt_size_t rt_strlen(const char *src); void rt_show_version(void); -#ifdef RT_DEBUG +#ifdef RT_USING_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); -/* Turn on this to enable context check */ -#ifndef RT_DEBUG_CONTEXT_CHECK -#define RT_DEBUG_CONTEXT_CHECK 1 -#endif - #define RT_ASSERT(EX) \ if (!(EX)) \ { \ rt_assert_handler(#EX, __FUNCTION__, __LINE__); \ } +#ifdef RT_DEBUGING_CONTEXT /* Macro to check current context */ -#if RT_DEBUG_CONTEXT_CHECK #define RT_DEBUG_NOT_IN_INTERRUPT \ do \ { \ @@ -806,19 +801,14 @@ while (0) #define RT_DEBUG_NOT_IN_INTERRUPT #define RT_DEBUG_IN_THREAD_CONTEXT #define RT_DEBUG_SCHEDULER_AVAILABLE(need_check) -#endif - -#else /* RT_DEBUG */ - +#endif /* RT_DEBUGING_CONTEXT */ +#else #define RT_ASSERT(EX) -#define RT_DEBUG_NOT_IN_INTERRUPT -#define RT_DEBUG_IN_THREAD_CONTEXT -#define RT_DEBUG_SCHEDULER_AVAILABLE(need_check) -#endif /* RT_DEBUG */ +#endif /* RT_USING_DEBUG */ #ifdef RT_USING_FINSH #include -#endif +#endif /* RT_USING_FINSH */ /**@}*/ @@ -826,4 +816,4 @@ while (0) } #endif -#endif +#endif /* __RT_THREAD_H__ */ -- cgit v1.3.1