Introduce arch-specific debug macro hooks
Make it possible for arch code to provide hook macros for NuttX dbg that will lead to arch-specific syslog() and lowsyslog() variants.
This commit is contained in:
parent
a5e48dd6a3
commit
d219f3a36e
6
Kconfig
6
Kconfig
@ -376,6 +376,12 @@ config ARCH_STDARG_H
|
|||||||
ARCH_STDARG_H=y and providing. If ARCH_STDARG_H, is not defined, then
|
ARCH_STDARG_H=y and providing. If ARCH_STDARG_H, is not defined, then
|
||||||
the stdarg.h header file will stay out-of-the-way in include/nuttx/.
|
the stdarg.h header file will stay out-of-the-way in include/nuttx/.
|
||||||
|
|
||||||
|
config ARCH_DEBUG_H
|
||||||
|
bool "debug.h"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
The debug.h contains architecture dependent debugging primitives
|
||||||
|
|
||||||
endmenu # Customize Header Files
|
endmenu # Customize Header Files
|
||||||
|
|
||||||
menu "Debug Options"
|
menu "Debug Options"
|
||||||
|
@ -43,6 +43,10 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <nuttx/compiler.h>
|
#include <nuttx/compiler.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_DEBUG_H
|
||||||
|
# include <arch/debug.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -94,6 +98,17 @@
|
|||||||
# define EXTRA_ARG
|
# define EXTRA_ARG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The actual logger function may be overridden in arch/debug.h if needed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __arch_syslog
|
||||||
|
# define __arch_syslog syslog
|
||||||
|
#endif
|
||||||
|
#ifndef __arch_lowsyslog
|
||||||
|
# define __arch_lowsyslog lowsyslog
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Debug macros will differ depending upon if the toolchain supports
|
/* Debug macros will differ depending upon if the toolchain supports
|
||||||
* macros with a variable number of arguments or not.
|
* macros with a variable number of arguments or not.
|
||||||
*/
|
*/
|
||||||
@ -104,30 +119,30 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
# define dbg(format, ...) \
|
# define dbg(format, ...) \
|
||||||
syslog(LOG_ERR, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
__arch_syslog(LOG_ERR, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
||||||
|
|
||||||
# ifdef CONFIG_ARCH_LOWPUTC
|
# ifdef CONFIG_ARCH_LOWPUTC
|
||||||
# define lldbg(format, ...) \
|
# define lldbg(format, ...) \
|
||||||
lowsyslog(LOG_ERR, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
__arch_lowsyslog(LOG_ERR, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
||||||
# else
|
# else
|
||||||
# define lldbg(x...)
|
# define lldbg(x...)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef CONFIG_DEBUG_VERBOSE
|
# ifdef CONFIG_DEBUG_VERBOSE
|
||||||
# define vdbg(format, ...) \
|
# define vdbg(format, ...) \
|
||||||
syslog(LOG_DEBUG, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
__arch_syslog(LOG_DEBUG, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
||||||
|
|
||||||
# ifdef CONFIG_ARCH_LOWPUTC
|
# ifdef CONFIG_ARCH_LOWPUTC
|
||||||
# define llvdbg(format, ...) \
|
# define llvdbg(format, ...) \
|
||||||
lowsyslog(LOG_DEBUG, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
__arch_lowsyslog(LOG_DEBUG, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
||||||
# else
|
# else
|
||||||
# define llvdbg(x...)
|
# define llvdbg(x...)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# else
|
# else /* CONFIG_DEBUG_VERBOSE */
|
||||||
# define vdbg(x...)
|
# define vdbg(x...)
|
||||||
# define llvdbg(x...)
|
# define llvdbg(x...)
|
||||||
# endif
|
# endif /* CONFIG_DEBUG_VERBOSE */
|
||||||
|
|
||||||
#else /* CONFIG_DEBUG */
|
#else /* CONFIG_DEBUG */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user