You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/10/10 22:01:43 UTC

[incubator-nuttx] 02/02: sched: Guard backtrace related code correctly

This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 8c80b3d908bf24a46bd68556068e501835cd7ad8
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Oct 10 17:17:46 2022 +0800

    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 <xi...@xiaomi.com>
---
 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 <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
  ****************************************************************************/
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