diff --git a/include/execinfo.h b/include/execinfo.h index b7e0492bee..9ada133433 100644 --- a/include/execinfo.h +++ b/include/execinfo.h @@ -34,7 +34,7 @@ extern "C" #define EXTERN extern #endif -#if defined(CONFIG_UNWINDER) +#if defined(CONFIG_SCHED_BACKTRACE) /* Store up to SIZE return address of the current program state in * ARRAY and return the exact number of values stored. diff --git a/libs/libc/Kconfig b/libs/libc/Kconfig index 30e30737b7..1ffde33ff8 100644 --- a/libs/libc/Kconfig +++ b/libs/libc/Kconfig @@ -29,4 +29,3 @@ source "libs/libc/wqueue/Kconfig" source "libs/libc/hex2bin/Kconfig" source "libs/libc/userfs/Kconfig" source "libs/libc/builtin/Kconfig" -source "libs/libc/debug/Kconfig" diff --git a/libs/libc/Makefile b/libs/libc/Makefile index 6b66f96a3a..508f23e7c2 100644 --- a/libs/libc/Makefile +++ b/libs/libc/Makefile @@ -25,7 +25,6 @@ include assert/Make.defs include audio/Make.defs include builtin/Make.defs include ctype/Make.defs -include debug/Make.defs include dirent/Make.defs include dlfcn/Make.defs include endian/Make.defs diff --git a/libs/libc/debug/Kconfig b/libs/libc/debug/Kconfig deleted file mode 100644 index f926d22e91..0000000000 --- a/libs/libc/debug/Kconfig +++ /dev/null @@ -1,22 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see the file kconfig-language.txt in the NuttX tools repository. -# - -# These are library functions that may be overridden by architecture- -# specific implementations. Not all architectures support implementations -# for every library function. - -menu "Library Debugging" - -config UNWINDER - bool "Stack Unwinder" - default "n" - ---help--- - This option enables stack unwinding support in NuttX - using the information automatically generated by the - compiler. The resulting image is slightly bigger but - the performance is not affected. Currently, this feature - only works with EABI compilers. - -endmenu # Library Debugging Support diff --git a/libs/libc/debug/Make.defs b/libs/libc/debug/Make.defs deleted file mode 100644 index 81ac7d19e4..0000000000 --- a/libs/libc/debug/Make.defs +++ /dev/null @@ -1,30 +0,0 @@ -############################################################################ -# libs/libc/debug/Make.defs -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -############################################################################ - -ifeq ($(CONFIG_UNWINDER),y) - -CSRCS += lib_backtrace.c lib_dumpstack.c - -endif - -# Include debug build support - -DEPPATH += --dep-path debug -VPATH += :debug diff --git a/libs/libc/sched/Make.defs b/libs/libc/sched/Make.defs index c2e156339c..ea9efa914a 100644 --- a/libs/libc/sched/Make.defs +++ b/libs/libc/sched/Make.defs @@ -34,6 +34,10 @@ ifneq ($(CONFIG_BUILD_KERNEL),y) CSRCS += task_startup.c endif +ifeq ($(CONFIG_SCHED_BACKTRACE),y) +CSRCS += lib_dumpstack.c lib_backtrace.c +endif + # Add the sched directory to the build DEPPATH += --dep-path sched diff --git a/libs/libc/debug/lib_backtrace.c b/libs/libc/sched/sched_backtrace.c similarity index 98% rename from libs/libc/debug/lib_backtrace.c rename to libs/libc/sched/sched_backtrace.c index fde70b556b..7b8671bf95 100644 --- a/libs/libc/debug/lib_backtrace.c +++ b/libs/libc/sched/sched_backtrace.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libs/libc/debug/lib_backtrace.c + * libs/libc/sched/sched_backtrace.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/libs/libc/debug/lib_dumpstack.c b/libs/libc/sched/sched_dumpstack.c similarity index 98% rename from libs/libc/debug/lib_dumpstack.c rename to libs/libc/sched/sched_dumpstack.c index 84eeb80470..ca7f02df18 100644 --- a/libs/libc/debug/lib_dumpstack.c +++ b/libs/libc/sched/sched_dumpstack.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libs/libc/debug/lib_dumpstack.c + * libs/libc/sched/sched_dumpstack.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/sched/Kconfig b/sched/Kconfig index 6fdf8632c5..0d851d97e0 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -1822,3 +1822,12 @@ config PTHREAD_STACK_DEFAULT Default pthread stack size endmenu # Stack and heap information + +config SCHED_BACKTRACE + bool "Stack BackTrace" + default "n" + ---help--- + This option enables stack backtrace support in the NuttX + using the information automatically generated by the + compiler or architecture specific approach when ARCH_HAVE_BACKTRACE + is selected