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 <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-10-10 17:17:46 +08:00 committed by Petro Karashchenko
parent 1cd9fa25cd
commit 8c80b3d908
3 changed files with 5 additions and 5 deletions

View File

@ -24,15 +24,13 @@
#include <nuttx/config.h>
#ifndef CONFIG_ARCH_HAVE_BACKTRACE
#include <sys/types.h>
#include <unistd.h>
#include <execinfo.h>
#include <unwind.h>
#include <nuttx/irq.h>
#if !defined(CONFIG_ARCH_HAVE_BACKTRACE)
/****************************************************************************
* Private Data Types
****************************************************************************/

View File

@ -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

View File

@ -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