sched: Rename DEBUG_TCBINFO to ARCH_HAVE_TCBINFO

and select if the arch support to define g_tcbinfo variable

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-07-20 05:28:37 +08:00 committed by Alin Jerpelea
parent f295ac6fb3
commit f3269a6caa
26 changed files with 32 additions and 98 deletions

View File

@ -242,7 +242,7 @@ With gdb
You can also do NuttX aware debugging using ``gdb`` scripting support.
The benefit is that it works also for the sim build where ``openocd`` is
not applicable. For this to work, you will need to enable PROC filesystem support
which will expose required task information (``CONFIG_FS_PROCFS=y CONFIG_DEBUG_TCBINFO=y``).
which will expose required task information (``CONFIG_FS_PROCFS=y``).
To use this approach, you can load the ``nuttx/tools/gdb/__init__.py`` file. An
easy way to do this is to add an extra command:

View File

@ -2012,14 +2012,6 @@ endif # DEBUG_VIDEO
endif # DEBUG_FEATURES
config DEBUG_TCBINFO
bool "Enable TCBinfo struct for debug"
default n
---help---
Enables tcbinfo struct for debugger information.
Selecting this option will enable g_tcbinfo in arch and
procfs.
config ARCH_HAVE_STACKCHECK
bool
default n

View File

@ -18,6 +18,7 @@ config ARCH_ARM
select ARCH_HAVE_SETJMP if !ARCH_TOOLCHAIN_IAR
select ARCH_HAVE_SYSCALL_HOOKS
select ARCH_HAVE_RDWR_MEM_CPU_RUN
select ARCH_HAVE_TCBINFO
select ARCH_HAVE_THREAD_LOCAL
---help---
The ARM architectures
@ -33,6 +34,7 @@ config ARCH_ARM64
select ARCH_HAVE_STDARG_H
select ARCH_HAVE_SYSCALL_HOOKS
select ARCH_HAVE_RDWR_MEM_CPU_RUN
select ARCH_HAVE_TCBINFO
select ARCH_HAVE_THREAD_LOCAL
select ARCH_HAVE_PERF_EVENTS
select ONESHOT
@ -88,6 +90,7 @@ config ARCH_RISCV
select ARCH_HAVE_STDARG_H
select ARCH_HAVE_SYSCALL_HOOKS
select ARCH_HAVE_RDWR_MEM_CPU_RUN
select ARCH_HAVE_TCBINFO
select ARCH_HAVE_THREAD_LOCAL
---help---
RISC-V 32 and 64-bit RV32 / RV64 architectures.
@ -105,6 +108,7 @@ config ARCH_SIM
select ARCH_HAVE_FORK if !HOST_WINDOWS
select ARCH_HAVE_SETJMP
select ARCH_HAVE_CUSTOMOPT
select ARCH_HAVE_TCBINFO
select ARCH_HAVE_TEXT_HEAP
select ARCH_SETJMP_H
select ALARM_ARCH
@ -117,11 +121,13 @@ config ARCH_SIM
config ARCH_X86
bool "x86"
select ARCH_HAVE_TCBINFO
---help---
Intel x86 architectures.
config ARCH_X86_64
bool "x86_64"
select ARCH_HAVE_TCBINFO
select LIBC_ARCH_ELF_64BIT if LIBC_ARCH_ELF
---help---
x86-64 architectures.
@ -133,6 +139,7 @@ config ARCH_XTENSA
select ARCH_HAVE_INTERRUPTSTACK
select ARCH_HAVE_STACKCHECK
select ARCH_HAVE_CUSTOMOPT
select ARCH_HAVE_TCBINFO
select ARCH_HAVE_STDARG_H
select ARCH_HAVE_SETJMP if ARCH_TOOLCHAIN_GNU
select ARCH_HAVE_SYSCALL_HOOKS
@ -161,6 +168,7 @@ config ARCH_SPARC
bool "SPARC"
select ARCH_HAVE_INTERRUPTSTACK
select ARCH_HAVE_CUSTOMOPT
select ARCH_HAVE_TCBINFO
---help---
SPARC architectures (SPARC V8)
@ -483,6 +491,10 @@ config ARCH_HAVE_CPUINFO
bool
default n
config ARCH_HAVE_TCBINFO
bool
default n
config ARCH_HAVE_ELF_EXECUTABLE
bool
default n

View File

@ -24,8 +24,6 @@
#include <nuttx/config.h>
#ifdef CONFIG_DEBUG_TCBINFO
#include <nuttx/sched.h>
#include <arch/irq.h>
@ -74,9 +72,6 @@ const struct tcbinfo_s g_tcbinfo =
},
};
#endif
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -24,8 +24,6 @@
#include <nuttx/config.h>
#ifdef CONFIG_DEBUG_TCBINFO
#include <nuttx/sched.h>
#include <arch/irq.h>
@ -81,9 +79,6 @@ const struct tcbinfo_s g_tcbinfo =
},
};
#endif
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -24,8 +24,6 @@
#include <nuttx/config.h>
#ifdef CONFIG_DEBUG_TCBINFO
#include <nuttx/sched.h>
#include <arch/irq.h>
@ -116,9 +114,6 @@ const struct tcbinfo_s g_tcbinfo =
},
};
#endif
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -24,8 +24,6 @@
#include <nuttx/config.h>
#ifdef CONFIG_DEBUG_TCBINFO
#include <nuttx/sched.h>
#include <arch/irq.h>
@ -122,9 +120,6 @@ const struct tcbinfo_s g_tcbinfo =
},
};
#endif
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -24,8 +24,6 @@
#include <nuttx/config.h>
#ifdef CONFIG_DEBUG_TCBINFO
#include <nuttx/sched.h>
#include <arch/irq.h>
@ -116,9 +114,6 @@ const struct tcbinfo_s g_tcbinfo =
},
};
#endif
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -24,8 +24,6 @@
#include <nuttx/config.h>
#ifdef CONFIG_DEBUG_TCBINFO
#include <nuttx/sched.h>
#include <arch/irq.h>
@ -122,9 +120,6 @@ const struct tcbinfo_s g_tcbinfo =
},
};
#endif
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -24,8 +24,6 @@
#include <nuttx/config.h>
#ifdef CONFIG_DEBUG_TCBINFO
#include <nuttx/sched.h>
#include <arch/irq.h>
@ -114,9 +112,6 @@ const struct tcbinfo_s g_tcbinfo =
},
};
#endif
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -48,7 +48,7 @@ CMN_CSRCS += arm64_releasestack.c arm64_stackframe.c arm64_usestack.c
CMN_CSRCS += arm64_task_sched.c arm64_exit.c arm64_fork.c arm64_switchcontext.c
CMN_CSRCS += arm64_schedulesigaction.c arm64_sigdeliver.c
CMN_CSRCS += arm64_getintstack.c arm64_registerdump.c
CMN_CSRCS += arm64_perf.c
CMN_CSRCS += arm64_perf.c arm64_tcbinfo.c
# Common C source files ( hardware BSP )
CMN_CSRCS += arm64_arch_timer.c arm64_cache.c
@ -123,7 +123,3 @@ endif
ifeq ($(CONFIG_ARM64_SEMIHOSTING_HOSTFS),y)
CMN_CSRCS += arm64_hostfs.c
endif
ifeq ($(CONFIG_DEBUG_TCBINFO),y)
CMN_CSRCS += arm64_tcbinfo.c
endif

View File

@ -24,8 +24,6 @@
#include <nuttx/config.h>
#ifdef CONFIG_DEBUG_TCBINFO
#include <nuttx/sched.h>
#include <arch/irq.h>
@ -90,9 +88,6 @@ const struct tcbinfo_s g_tcbinfo =
},
};
#endif
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -24,8 +24,6 @@
#include <nuttx/config.h>
#ifdef CONFIG_DEBUG_TCBINFO
#include <nuttx/sched.h>
#include <arch/irq.h>
@ -128,9 +126,6 @@ const struct tcbinfo_s g_tcbinfo =
},
};
#endif
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -63,13 +63,9 @@ AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS = sim_initialize.c sim_idle.c sim_doirq.c sim_initialstate.c
CSRCS += sim_createstack.c sim_usestack.c sim_releasestack.c sim_stackframe.c
CSRCS += sim_exit.c sim_schedulesigaction.c sim_switchcontext.c sim_heap.c
CSRCS += sim_uart.c sim_copyfullstate.c sim_sigdeliver.c
CSRCS += sim_uart.c sim_copyfullstate.c sim_sigdeliver.c sim_tcbinfo.c
CSRCS += sim_registerdump.c sim_saveusercontext.c sim_textheap.c
ifeq ($(CONFIG_DEBUG_TCBINFO),y)
CSRCS += sim_tcbinfo.c
endif
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
CSRCS += sim_backtrace.c
endif

View File

@ -55,6 +55,7 @@ list(
sim_sigdeliver.c
sim_registerdump.c
sim_saveusercontext.c
sim_tcbinfo.c
sim_textheap.c)
if(CONFIG_HOST_X86_64)

View File

@ -24,8 +24,6 @@
#include <nuttx/config.h>
#ifdef CONFIG_DEBUG_TCBINFO
#include <nuttx/sched.h>
#include <arch/irq.h>
@ -101,8 +99,6 @@ const struct tcbinfo_s g_tcbinfo =
},
};
#endif
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -35,7 +35,7 @@ CMN_CSRCS += xtensa_modifyreg32.c xtensa_mdelay.c xtensa_nputs.c xtensa_perf.c
CMN_CSRCS += xtensa_releasestack.c xtensa_registerdump.c xtensa_sigdeliver.c
CMN_CSRCS += xtensa_switchcontext.c xtensa_swint.c xtensa_stackframe.c
CMN_CSRCS += xtensa_saveusercontext.c xtensa_schedsigaction.c xtensa_udelay.c
CMN_CSRCS += xtensa_usestack.c
CMN_CSRCS += xtensa_usestack.c xtensa_tcbinfo.c
# Configuration-dependent common Xtensa files
@ -43,10 +43,6 @@ ifeq ($(CONFIG_ARCH_USE_TEXT_HEAP),y)
CMN_ASRCS += xtensa_loadstore.S
endif
ifeq ($(CONFIG_DEBUG_TCBINFO),y)
CMN_CSRCS += xtensa_tcbinfo.c
endif
ifeq ($(CONFIG_ARCH_FPU),y)
CMN_CSRCS += xtensa_fpucmp.c
endif

View File

@ -76,4 +76,3 @@ const struct tcbinfo_s g_tcbinfo =
/****************************************************************************
* Public Functions
****************************************************************************/

View File

@ -65,7 +65,7 @@ config ELF_SYMBOL_CACHECOUNT
config ELF_COREDUMP
bool "ELF Coredump"
select DEBUG_TCBINFO
depends on ARCH_HAVE_TCBINFO
default n
---help---
Generate ELF core dump to provide information about the CPU state and the

View File

@ -23,7 +23,6 @@ CONFIG_DEBUG_SCHED_ERROR=y
CONFIG_DEBUG_SCHED_INFO=y
CONFIG_DEBUG_SCHED_WARN=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEBUG_TCBINFO=y
CONFIG_DEBUG_WARN=y
CONFIG_DEFAULT_TASK_STACKSIZE=8192
CONFIG_DEV_ZERO=y

View File

@ -23,7 +23,6 @@ CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEBUG_TCBINFO=y
CONFIG_DRIVERS_IEEE80211=y
CONFIG_DRIVERS_WIRELESS=y
CONFIG_ESP32C3_SPIFLASH=y

View File

@ -126,7 +126,7 @@ config FS_PROCFS_EXCLUDE_SMARTFS
config FS_PROCFS_EXCLUDE_TCBINFO
bool "Exclude tcbinfo procfs"
depends on DEBUG_TCBINFO
depends on ARCH_HAVE_TCBINFO
default DEFAULT_SMALL
config FS_PROCFS_EXCLUDE_UPTIME

View File

@ -170,15 +170,15 @@ static const struct procfs_entry_s g_procfs_entries[] =
{ "self/**", &g_proc_operations, PROCFS_UNKOWN_TYPE },
#endif
#if defined(CONFIG_DEBUG_TCBINFO) && !defined(CONFIG_FS_PROCFS_EXCLUDE_TCBINFO)
#if defined(CONFIG_ARCH_HAVE_TCBINFO) && !defined(CONFIG_FS_PROCFS_EXCLUDE_TCBINFO)
{ "tcbinfo", &g_tcbinfo_operations, PROCFS_FILE_TYPE },
#endif
#if !defined(CONFIG_FS_PROCFS_EXCLUDE_UPTIME)
#ifndef CONFIG_FS_PROCFS_EXCLUDE_UPTIME
{ "uptime", &g_uptime_operations, PROCFS_FILE_TYPE },
#endif
#if !defined(CONFIG_FS_PROCFS_EXCLUDE_VERSION)
#ifndef CONFIG_FS_PROCFS_EXCLUDE_VERSION
{ "version", &g_version_operations, PROCFS_FILE_TYPE },
#endif
};

View File

@ -40,8 +40,8 @@
#include <nuttx/fs/fs.h>
#include <nuttx/fs/procfs.h>
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_PROCFS)
#ifdef CONFIG_DEBUG_TCBINFO
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_PROCFS) && \
defined(CONFIG_ARCH_HAVE_TCBINFO) && !defined(CONFIG_FS_PROCFS_EXCLUDE_TCBINFO)
/****************************************************************************
* Pre-processor Definitions
@ -277,5 +277,4 @@ static int tcbinfo_stat(FAR const char *relpath, FAR struct stat *buf)
* Public Functions
****************************************************************************/
#endif /* CONFIG_DEBUG_TCBINFO */
#endif /* !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_PROCFS */

View File

@ -173,7 +173,6 @@
# define _SCHED_ERRVAL(r) (-errno)
#endif
#ifdef CONFIG_DEBUG_TCBINFO
#define TCB_PID_OFF offsetof(struct tcb_s, pid)
#define TCB_STATE_OFF offsetof(struct tcb_s, task_state)
#define TCB_PRI_OFF offsetof(struct tcb_s, sched_priority)
@ -186,7 +185,6 @@
#define TCB_REG_OFF(reg) (reg * sizeof(uintptr_t))
#define TCB_STACK_OFF offsetof(struct tcb_s, stack_base_ptr)
#define TCB_STACK_SIZE_OFF offsetof(struct tcb_s, adj_stack_size)
#endif
/* Get a pointer to the process' memory map struct from the task_group */
@ -710,7 +708,6 @@ struct pthread_tcb_s
* debuggers to parse the tcb information
*/
#ifdef CONFIG_DEBUG_TCBINFO
begin_packed_struct struct tcbinfo_s
{
uint16_t pid_off; /* Offset of tcb.pid */
@ -739,7 +736,6 @@ begin_packed_struct struct tcbinfo_s
}
end_packed_struct reg_off;
} end_packed_struct;
#endif
/* This is the callback type used by nxsched_foreach() */
@ -768,9 +764,7 @@ EXTERN unsigned long g_premp_max[CONFIG_SMP_NCPUS];
EXTERN unsigned long g_crit_max[CONFIG_SMP_NCPUS];
#endif /* CONFIG_SCHED_CRITMONITOR */
#ifdef CONFIG_DEBUG_TCBINFO
EXTERN const struct tcbinfo_s g_tcbinfo;
#endif
/****************************************************************************
* Public Function Prototypes

View File

@ -5,7 +5,7 @@
config LIB_GDBSTUB
tristate "GDBSTUB"
depends on DEBUG_TCBINFO
depends on ARCH_HAVE_TCBINFO
---help---
Enable support for gdbstub.