From 8c80b3d908bf24a46bd68556068e501835cd7ad8 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 10 Oct 2022 17:17:46 +0800 Subject: [PATCH] sched: Guard backtrace related code correctly 1.Don't include unwind.h when arch specific backtrace is enable 2.Built arch specific backtrace wrapper only when enable Signed-off-by: Xiang Xiao --- libs/libc/sched/sched_backtrace.c | 6 ++---- sched/sched/Make.defs | 2 +- sched/sched/sched_backtrace.c | 2 ++ 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/libc/sched/sched_backtrace.c b/libs/libc/sched/sched_backtrace.c index 9e27d1f316..2c57eaf7f1 100644 --- a/libs/libc/sched/sched_backtrace.c +++ b/libs/libc/sched/sched_backtrace.c @@ -24,15 +24,13 @@ #include +#ifndef CONFIG_ARCH_HAVE_BACKTRACE + #include #include #include #include -#include - -#if !defined(CONFIG_ARCH_HAVE_BACKTRACE) - /**************************************************************************** * Private Data Types ****************************************************************************/ diff --git a/sched/sched/Make.defs b/sched/sched/Make.defs index 5d2ecad423..326887b060 100644 --- a/sched/sched/Make.defs +++ b/sched/sched/Make.defs @@ -99,7 +99,7 @@ ifeq ($(CONFIG_SCHED_CRITMONITOR),y) CSRCS += sched_critmonitor.c endif -ifeq ($(CONFIG_ARCH_HAVE_BACKTRACE),y) +ifeq ($(CONFIG_SCHED_BACKTRACE),y) CSRCS += sched_backtrace.c endif diff --git a/sched/sched/sched_backtrace.c b/sched/sched/sched_backtrace.c index 16fe43c731..cbe2fa4b9a 100644 --- a/sched/sched/sched_backtrace.c +++ b/sched/sched/sched_backtrace.c @@ -40,6 +40,7 @@ * ****************************************************************************/ +#ifdef CONFIG_ARCH_HAVE_BACKTRACE int sched_backtrace(pid_t tid, FAR void **buffer, int size, int skip) { FAR struct tcb_s *rtcb = NULL; @@ -55,3 +56,4 @@ int sched_backtrace(pid_t tid, FAR void **buffer, int size, int skip) return up_backtrace(rtcb, buffer, size, skip); } +#endif