sched_backtrace: define sched_dumpstack when not enable SCHED_BACKTRACE

Before directly use sched_backtrace() with SCHED_BACKTRACE disable will
lead compile error, this commit avoid this problem by define
sched_backtrace to 0 when CONFIG_SCHED_BACKTRACE not enable.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This commit is contained in:
Bowen Wang 2023-07-06 23:09:29 +08:00 committed by Xiang Xiao
parent 28cb5e7984
commit c9e3a0669f
2 changed files with 8 additions and 14 deletions

View File

@ -33,20 +33,9 @@
* Pre-processor Definitions
****************************************************************************/
#if defined(CONFIG_SCHED_BACKTRACE)
/* Store up to SIZE return address of the current back trace in
* ARRAY and return the exact number of values stored.
*/
# define backtrace(buffer, size) sched_backtrace(_SCHED_GETTID(), \
buffer, size, 0)
# define dump_stack() sched_dumpstack(_SCHED_GETTID())
#else
# define backtrace(buffer, size) 0
# define dump_stack()
#endif
#define backtrace(buffer, size) sched_backtrace(_SCHED_GETTID(), \
buffer, size, 0)
#define dump_stack() sched_dumpstack(_SCHED_GETTID())
/****************************************************************************
* Public Function Prototypes

View File

@ -267,8 +267,13 @@ bool sched_idletask(void);
/* Task Backtrace */
#ifdef CONFIG_SCHED_BACKTRACE
int sched_backtrace(pid_t tid, FAR void **buffer, int size, int skip);
void sched_dumpstack(pid_t tid);
#else
# define sched_backtrace(tid, buffer, size, skip) 0
# define sched_dumpstack(tid)
#endif
#undef EXTERN
#if defined(__cplusplus)