mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 12:08:36 +08:00
arch:debug: add struct for task aware debug.
When enable DEBUG_TCBINFO config, a global struct will provide, then debuggers can aware nuttx task infomation. Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
This commit is contained in:
parent
201c67acbd
commit
012bd1494c
9 changed files with 740 additions and 0 deletions
8
Kconfig
8
Kconfig
|
@ -546,6 +546,14 @@ endmenu # Customize Header Files
|
||||||
|
|
||||||
menu "Debug Options"
|
menu "Debug Options"
|
||||||
|
|
||||||
|
config DEBUG_TCBINFO
|
||||||
|
bool "Enable TCBinfo struct for debug"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enables tcbinfo struct for debugger infomation.
|
||||||
|
Selecting this option will enable g_tcbinfo in arch and
|
||||||
|
procfs.
|
||||||
|
|
||||||
config DEBUG_ALERT
|
config DEBUG_ALERT
|
||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
|
|
64
arch/arm/src/arm/arm_tcbinfo.c
Normal file
64
arch/arm/src/arm/arm_tcbinfo.c
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* arch/arm/src/arm/arm_tcbinfo.c
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_TCBINFO
|
||||||
|
|
||||||
|
#include <nuttx/sched.h>
|
||||||
|
#include <arch/irq.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
const struct tcbinfo_s g_tcbinfo =
|
||||||
|
{
|
||||||
|
TCB_PID_OFF,
|
||||||
|
TCB_STATE_OFF,
|
||||||
|
TCB_PRI_OFF,
|
||||||
|
TCB_NAME_OFF,
|
||||||
|
|
||||||
|
XCPTCONTEXT_REGS,
|
||||||
|
|
||||||
|
TCB_REG_OFF(REG_R0),
|
||||||
|
TCB_REG_OFF(REG_R1),
|
||||||
|
TCB_REG_OFF(REG_R2),
|
||||||
|
TCB_REG_OFF(REG_R3),
|
||||||
|
TCB_REG_OFF(REG_R4),
|
||||||
|
TCB_REG_OFF(REG_R5),
|
||||||
|
TCB_REG_OFF(REG_R6),
|
||||||
|
TCB_REG_OFF(REG_R7),
|
||||||
|
TCB_REG_OFF(REG_R8),
|
||||||
|
TCB_REG_OFF(REG_R9),
|
||||||
|
TCB_REG_OFF(REG_R10),
|
||||||
|
TCB_REG_OFF(REG_R11),
|
||||||
|
TCB_REG_OFF(REG_R12),
|
||||||
|
TCB_REG_OFF(REG_R13),
|
||||||
|
TCB_REG_OFF(REG_R14),
|
||||||
|
TCB_REG_OFF(REG_R15),
|
||||||
|
TCB_REG_OFF(REG_CPSR),
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
71
arch/arm/src/armv6-m/arm_tcbinfo.c
Normal file
71
arch/arm/src/armv6-m/arm_tcbinfo.c
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* arch/arm/src/armv6-m/arm_tcbinfo.c
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_TCBINFO
|
||||||
|
|
||||||
|
#include <nuttx/sched.h>
|
||||||
|
#include <arch/irq.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
const struct tcbinfo_s g_tcbinfo =
|
||||||
|
{
|
||||||
|
TCB_PID_OFF,
|
||||||
|
TCB_STATE_OFF,
|
||||||
|
TCB_PRI_OFF,
|
||||||
|
TCB_NAME_OFF,
|
||||||
|
|
||||||
|
XCPTCONTEXT_REGS,
|
||||||
|
|
||||||
|
TCB_REG_OFF(REG_R0),
|
||||||
|
TCB_REG_OFF(REG_R1),
|
||||||
|
TCB_REG_OFF(REG_R2),
|
||||||
|
TCB_REG_OFF(REG_R3),
|
||||||
|
TCB_REG_OFF(REG_R4),
|
||||||
|
TCB_REG_OFF(REG_R5),
|
||||||
|
TCB_REG_OFF(REG_R6),
|
||||||
|
TCB_REG_OFF(REG_R7),
|
||||||
|
TCB_REG_OFF(REG_R8),
|
||||||
|
TCB_REG_OFF(REG_R9),
|
||||||
|
TCB_REG_OFF(REG_R10),
|
||||||
|
TCB_REG_OFF(REG_R11),
|
||||||
|
TCB_REG_OFF(REG_R12),
|
||||||
|
TCB_REG_OFF(REG_R13),
|
||||||
|
TCB_REG_OFF(REG_R14),
|
||||||
|
TCB_REG_OFF(REG_R15),
|
||||||
|
TCB_REG_OFF(REG_XPSR),
|
||||||
|
|
||||||
|
0,
|
||||||
|
TCB_REG_OFF(REG_R13),
|
||||||
|
TCB_REG_OFF(REG_PRIMASK),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
108
arch/arm/src/armv7-a/arm_tcbinfo.c
Normal file
108
arch/arm/src/armv7-a/arm_tcbinfo.c
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* arch/arm/src/armv7-a/arm_tcbinfo.c
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_TCBINFO
|
||||||
|
|
||||||
|
#include <nuttx/sched.h>
|
||||||
|
#include <arch/irq.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
const struct tcbinfo_s g_tcbinfo =
|
||||||
|
{
|
||||||
|
TCB_PID_OFF,
|
||||||
|
TCB_STATE_OFF,
|
||||||
|
TCB_PRI_OFF,
|
||||||
|
TCB_NAME_OFF,
|
||||||
|
|
||||||
|
XCPTCONTEXT_REGS,
|
||||||
|
|
||||||
|
TCB_REG_OFF(REG_R0),
|
||||||
|
TCB_REG_OFF(REG_R1),
|
||||||
|
TCB_REG_OFF(REG_R2),
|
||||||
|
TCB_REG_OFF(REG_R3),
|
||||||
|
TCB_REG_OFF(REG_R4),
|
||||||
|
TCB_REG_OFF(REG_R5),
|
||||||
|
TCB_REG_OFF(REG_R6),
|
||||||
|
TCB_REG_OFF(REG_R7),
|
||||||
|
TCB_REG_OFF(REG_R8),
|
||||||
|
TCB_REG_OFF(REG_R9),
|
||||||
|
TCB_REG_OFF(REG_R10),
|
||||||
|
TCB_REG_OFF(REG_R11),
|
||||||
|
TCB_REG_OFF(REG_R12),
|
||||||
|
TCB_REG_OFF(REG_R13),
|
||||||
|
TCB_REG_OFF(REG_R14),
|
||||||
|
TCB_REG_OFF(REG_R15),
|
||||||
|
TCB_REG_OFF(REG_CPSR),
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_FPU
|
||||||
|
TCB_REG_OFF(REG_D0),
|
||||||
|
TCB_REG_OFF(REG_D1),
|
||||||
|
TCB_REG_OFF(REG_D2),
|
||||||
|
TCB_REG_OFF(REG_D3),
|
||||||
|
TCB_REG_OFF(REG_D4),
|
||||||
|
TCB_REG_OFF(REG_D5),
|
||||||
|
TCB_REG_OFF(REG_D6),
|
||||||
|
TCB_REG_OFF(REG_D7),
|
||||||
|
TCB_REG_OFF(REG_D8),
|
||||||
|
TCB_REG_OFF(REG_D9),
|
||||||
|
TCB_REG_OFF(REG_D10),
|
||||||
|
TCB_REG_OFF(REG_D11),
|
||||||
|
TCB_REG_OFF(REG_D12),
|
||||||
|
TCB_REG_OFF(REG_D13),
|
||||||
|
TCB_REG_OFF(REG_D14),
|
||||||
|
TCB_REG_OFF(REG_D15),
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARM_HAVE_FPU_D32
|
||||||
|
TCB_REG_OFF(REG_D16),
|
||||||
|
TCB_REG_OFF(REG_D17),
|
||||||
|
TCB_REG_OFF(REG_D18),
|
||||||
|
TCB_REG_OFF(REG_D19),
|
||||||
|
TCB_REG_OFF(REG_D20),
|
||||||
|
TCB_REG_OFF(REG_D21),
|
||||||
|
TCB_REG_OFF(REG_D22),
|
||||||
|
TCB_REG_OFF(REG_D23),
|
||||||
|
TCB_REG_OFF(REG_D24),
|
||||||
|
TCB_REG_OFF(REG_D25),
|
||||||
|
TCB_REG_OFF(REG_D26),
|
||||||
|
TCB_REG_OFF(REG_D27),
|
||||||
|
TCB_REG_OFF(REG_D28),
|
||||||
|
TCB_REG_OFF(REG_D29),
|
||||||
|
TCB_REG_OFF(REG_D30),
|
||||||
|
TCB_REG_OFF(REG_D31),
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_FPU
|
||||||
|
0,
|
||||||
|
TCB_REG_OFF(REG_FPSCR),
|
||||||
|
0,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
114
arch/arm/src/armv7-m/arm_tcbinfo.c
Normal file
114
arch/arm/src/armv7-m/arm_tcbinfo.c
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* arch/arm/src/armv7-m/arm_tcbinfo.c
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_TCBINFO
|
||||||
|
|
||||||
|
#include <nuttx/sched.h>
|
||||||
|
#include <arch/irq.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
const struct tcbinfo_s g_tcbinfo =
|
||||||
|
{
|
||||||
|
TCB_PID_OFF,
|
||||||
|
TCB_STATE_OFF,
|
||||||
|
TCB_PRI_OFF,
|
||||||
|
TCB_NAME_OFF,
|
||||||
|
|
||||||
|
XCPTCONTEXT_REGS,
|
||||||
|
|
||||||
|
TCB_REG_OFF(REG_R0),
|
||||||
|
TCB_REG_OFF(REG_R1),
|
||||||
|
TCB_REG_OFF(REG_R2),
|
||||||
|
TCB_REG_OFF(REG_R3),
|
||||||
|
TCB_REG_OFF(REG_R4),
|
||||||
|
TCB_REG_OFF(REG_R5),
|
||||||
|
TCB_REG_OFF(REG_R6),
|
||||||
|
TCB_REG_OFF(REG_R7),
|
||||||
|
TCB_REG_OFF(REG_R8),
|
||||||
|
TCB_REG_OFF(REG_R9),
|
||||||
|
TCB_REG_OFF(REG_R10),
|
||||||
|
TCB_REG_OFF(REG_R11),
|
||||||
|
TCB_REG_OFF(REG_R12),
|
||||||
|
TCB_REG_OFF(REG_R13),
|
||||||
|
TCB_REG_OFF(REG_R14),
|
||||||
|
TCB_REG_OFF(REG_R15),
|
||||||
|
TCB_REG_OFF(REG_XPSR),
|
||||||
|
|
||||||
|
0,
|
||||||
|
TCB_REG_OFF(REG_R13),
|
||||||
|
#ifdef CONFIG_ARMV7M_USEBASEPRI
|
||||||
|
0,
|
||||||
|
TCB_REG_OFF(REG_BASEPRI),
|
||||||
|
#else
|
||||||
|
TCB_REG_OFF(REG_PRIMASK),
|
||||||
|
0,
|
||||||
|
#endif
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_FPU
|
||||||
|
TCB_REG_OFF(REG_S0),
|
||||||
|
TCB_REG_OFF(REG_S1),
|
||||||
|
TCB_REG_OFF(REG_S2),
|
||||||
|
TCB_REG_OFF(REG_S3),
|
||||||
|
TCB_REG_OFF(REG_S4),
|
||||||
|
TCB_REG_OFF(REG_S5),
|
||||||
|
TCB_REG_OFF(REG_S6),
|
||||||
|
TCB_REG_OFF(REG_S7),
|
||||||
|
TCB_REG_OFF(REG_S8),
|
||||||
|
TCB_REG_OFF(REG_S9),
|
||||||
|
TCB_REG_OFF(REG_S10),
|
||||||
|
TCB_REG_OFF(REG_S11),
|
||||||
|
TCB_REG_OFF(REG_S12),
|
||||||
|
TCB_REG_OFF(REG_S13),
|
||||||
|
TCB_REG_OFF(REG_S14),
|
||||||
|
TCB_REG_OFF(REG_S15),
|
||||||
|
TCB_REG_OFF(REG_S16),
|
||||||
|
TCB_REG_OFF(REG_S17),
|
||||||
|
TCB_REG_OFF(REG_S18),
|
||||||
|
TCB_REG_OFF(REG_S19),
|
||||||
|
TCB_REG_OFF(REG_S20),
|
||||||
|
TCB_REG_OFF(REG_S21),
|
||||||
|
TCB_REG_OFF(REG_S22),
|
||||||
|
TCB_REG_OFF(REG_S23),
|
||||||
|
TCB_REG_OFF(REG_S24),
|
||||||
|
TCB_REG_OFF(REG_S25),
|
||||||
|
TCB_REG_OFF(REG_S26),
|
||||||
|
TCB_REG_OFF(REG_S27),
|
||||||
|
TCB_REG_OFF(REG_S28),
|
||||||
|
TCB_REG_OFF(REG_S29),
|
||||||
|
TCB_REG_OFF(REG_S30),
|
||||||
|
TCB_REG_OFF(REG_S31),
|
||||||
|
0,
|
||||||
|
TCB_REG_OFF(REG_FPSCR),
|
||||||
|
0,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
108
arch/arm/src/armv7-r/arm_tcbinfo.c
Normal file
108
arch/arm/src/armv7-r/arm_tcbinfo.c
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* arch/arm/src/armv7-r/arm_tcbinfo.c
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_TCBINFO
|
||||||
|
|
||||||
|
#include <nuttx/sched.h>
|
||||||
|
#include <arch/irq.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
const struct tcbinfo_s g_tcbinfo =
|
||||||
|
{
|
||||||
|
TCB_PID_OFF,
|
||||||
|
TCB_STATE_OFF,
|
||||||
|
TCB_PRI_OFF,
|
||||||
|
TCB_NAME_OFF,
|
||||||
|
|
||||||
|
XCPTCONTEXT_REGS,
|
||||||
|
|
||||||
|
TCB_REG_OFF(REG_R0),
|
||||||
|
TCB_REG_OFF(REG_R1),
|
||||||
|
TCB_REG_OFF(REG_R2),
|
||||||
|
TCB_REG_OFF(REG_R3),
|
||||||
|
TCB_REG_OFF(REG_R4),
|
||||||
|
TCB_REG_OFF(REG_R5),
|
||||||
|
TCB_REG_OFF(REG_R6),
|
||||||
|
TCB_REG_OFF(REG_R7),
|
||||||
|
TCB_REG_OFF(REG_R8),
|
||||||
|
TCB_REG_OFF(REG_R9),
|
||||||
|
TCB_REG_OFF(REG_R10),
|
||||||
|
TCB_REG_OFF(REG_R11),
|
||||||
|
TCB_REG_OFF(REG_R12),
|
||||||
|
TCB_REG_OFF(REG_R13),
|
||||||
|
TCB_REG_OFF(REG_R14),
|
||||||
|
TCB_REG_OFF(REG_R15),
|
||||||
|
TCB_REG_OFF(REG_CPSR),
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_FPU
|
||||||
|
TCB_REG_OFF(REG_D0),
|
||||||
|
TCB_REG_OFF(REG_D1),
|
||||||
|
TCB_REG_OFF(REG_D2),
|
||||||
|
TCB_REG_OFF(REG_D3),
|
||||||
|
TCB_REG_OFF(REG_D4),
|
||||||
|
TCB_REG_OFF(REG_D5),
|
||||||
|
TCB_REG_OFF(REG_D6),
|
||||||
|
TCB_REG_OFF(REG_D7),
|
||||||
|
TCB_REG_OFF(REG_D8),
|
||||||
|
TCB_REG_OFF(REG_D9),
|
||||||
|
TCB_REG_OFF(REG_D10),
|
||||||
|
TCB_REG_OFF(REG_D11),
|
||||||
|
TCB_REG_OFF(REG_D12),
|
||||||
|
TCB_REG_OFF(REG_D13),
|
||||||
|
TCB_REG_OFF(REG_D14),
|
||||||
|
TCB_REG_OFF(REG_D15),
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARM_HAVE_FPU_D32
|
||||||
|
TCB_REG_OFF(REG_D16),
|
||||||
|
TCB_REG_OFF(REG_D17),
|
||||||
|
TCB_REG_OFF(REG_D18),
|
||||||
|
TCB_REG_OFF(REG_D19),
|
||||||
|
TCB_REG_OFF(REG_D20),
|
||||||
|
TCB_REG_OFF(REG_D21),
|
||||||
|
TCB_REG_OFF(REG_D22),
|
||||||
|
TCB_REG_OFF(REG_D23),
|
||||||
|
TCB_REG_OFF(REG_D24),
|
||||||
|
TCB_REG_OFF(REG_D25),
|
||||||
|
TCB_REG_OFF(REG_D26),
|
||||||
|
TCB_REG_OFF(REG_D27),
|
||||||
|
TCB_REG_OFF(REG_D28),
|
||||||
|
TCB_REG_OFF(REG_D29),
|
||||||
|
TCB_REG_OFF(REG_D30),
|
||||||
|
TCB_REG_OFF(REG_D31),
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_FPU
|
||||||
|
0,
|
||||||
|
TCB_REG_OFF(REG_FPSCR),
|
||||||
|
0,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
114
arch/arm/src/armv8-m/arm_tcbinfo.c
Normal file
114
arch/arm/src/armv8-m/arm_tcbinfo.c
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* arch/arm/src/armv8-m/arm_tcbinfo.c
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_TCBINFO
|
||||||
|
|
||||||
|
#include <nuttx/sched.h>
|
||||||
|
#include <arch/irq.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
const struct tcbinfo_s g_tcbinfo =
|
||||||
|
{
|
||||||
|
TCB_PID_OFF,
|
||||||
|
TCB_STATE_OFF,
|
||||||
|
TCB_PRI_OFF,
|
||||||
|
TCB_NAME_OFF,
|
||||||
|
|
||||||
|
XCPTCONTEXT_REGS,
|
||||||
|
|
||||||
|
TCB_REG_OFF(REG_R0),
|
||||||
|
TCB_REG_OFF(REG_R1),
|
||||||
|
TCB_REG_OFF(REG_R2),
|
||||||
|
TCB_REG_OFF(REG_R3),
|
||||||
|
TCB_REG_OFF(REG_R4),
|
||||||
|
TCB_REG_OFF(REG_R5),
|
||||||
|
TCB_REG_OFF(REG_R6),
|
||||||
|
TCB_REG_OFF(REG_R7),
|
||||||
|
TCB_REG_OFF(REG_R8),
|
||||||
|
TCB_REG_OFF(REG_R9),
|
||||||
|
TCB_REG_OFF(REG_R10),
|
||||||
|
TCB_REG_OFF(REG_R11),
|
||||||
|
TCB_REG_OFF(REG_R12),
|
||||||
|
TCB_REG_OFF(REG_R13),
|
||||||
|
TCB_REG_OFF(REG_R14),
|
||||||
|
TCB_REG_OFF(REG_R15),
|
||||||
|
TCB_REG_OFF(REG_XPSR),
|
||||||
|
|
||||||
|
0,
|
||||||
|
TCB_REG_OFF(REG_R13),
|
||||||
|
#ifdef CONFIG_ARMV8M_USEBASEPRI
|
||||||
|
0,
|
||||||
|
TCB_REG_OFF(REG_BASEPRI),
|
||||||
|
#else
|
||||||
|
TCB_REG_OFF(REG_PRIMASK),
|
||||||
|
0,
|
||||||
|
#endif
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_FPU
|
||||||
|
TCB_REG_OFF(REG_S0),
|
||||||
|
TCB_REG_OFF(REG_S1),
|
||||||
|
TCB_REG_OFF(REG_S2),
|
||||||
|
TCB_REG_OFF(REG_S3),
|
||||||
|
TCB_REG_OFF(REG_S4),
|
||||||
|
TCB_REG_OFF(REG_S5),
|
||||||
|
TCB_REG_OFF(REG_S6),
|
||||||
|
TCB_REG_OFF(REG_S7),
|
||||||
|
TCB_REG_OFF(REG_S8),
|
||||||
|
TCB_REG_OFF(REG_S9),
|
||||||
|
TCB_REG_OFF(REG_S10),
|
||||||
|
TCB_REG_OFF(REG_S11),
|
||||||
|
TCB_REG_OFF(REG_S12),
|
||||||
|
TCB_REG_OFF(REG_S13),
|
||||||
|
TCB_REG_OFF(REG_S14),
|
||||||
|
TCB_REG_OFF(REG_S15),
|
||||||
|
TCB_REG_OFF(REG_S16),
|
||||||
|
TCB_REG_OFF(REG_S17),
|
||||||
|
TCB_REG_OFF(REG_S18),
|
||||||
|
TCB_REG_OFF(REG_S19),
|
||||||
|
TCB_REG_OFF(REG_S20),
|
||||||
|
TCB_REG_OFF(REG_S21),
|
||||||
|
TCB_REG_OFF(REG_S22),
|
||||||
|
TCB_REG_OFF(REG_S23),
|
||||||
|
TCB_REG_OFF(REG_S24),
|
||||||
|
TCB_REG_OFF(REG_S25),
|
||||||
|
TCB_REG_OFF(REG_S26),
|
||||||
|
TCB_REG_OFF(REG_S27),
|
||||||
|
TCB_REG_OFF(REG_S28),
|
||||||
|
TCB_REG_OFF(REG_S29),
|
||||||
|
TCB_REG_OFF(REG_S30),
|
||||||
|
TCB_REG_OFF(REG_S31),
|
||||||
|
0,
|
||||||
|
TCB_REG_OFF(REG_FPSCR),
|
||||||
|
0,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
118
arch/risc-v/src/common/riscv_tcbinfo.c
Normal file
118
arch/risc-v/src/common/riscv_tcbinfo.c
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
/****************************************************************************
|
||||||
|
* arch/risc-v/src/common/riscv_tcbinfo.c
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_TCBINFO
|
||||||
|
|
||||||
|
#include <nuttx/sched.h>
|
||||||
|
#include <arch/irq.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
const struct tcbinfo_s g_tcbinfo =
|
||||||
|
{
|
||||||
|
TCB_PID_OFF,
|
||||||
|
TCB_STATE_OFF,
|
||||||
|
TCB_PRI_OFF,
|
||||||
|
TCB_NAME_OFF,
|
||||||
|
|
||||||
|
XCPTCONTEXT_REGS,
|
||||||
|
|
||||||
|
0,
|
||||||
|
TCB_REG_OFF(REG_X1_NDX),
|
||||||
|
TCB_REG_OFF(REG_X2_NDX),
|
||||||
|
TCB_REG_OFF(REG_X3_NDX),
|
||||||
|
TCB_REG_OFF(REG_X4_NDX),
|
||||||
|
TCB_REG_OFF(REG_X5_NDX),
|
||||||
|
TCB_REG_OFF(REG_X6_NDX),
|
||||||
|
TCB_REG_OFF(REG_X7_NDX),
|
||||||
|
TCB_REG_OFF(REG_X8_NDX),
|
||||||
|
TCB_REG_OFF(REG_X9_NDX),
|
||||||
|
TCB_REG_OFF(REG_X10_NDX),
|
||||||
|
TCB_REG_OFF(REG_X11_NDX),
|
||||||
|
TCB_REG_OFF(REG_X12_NDX),
|
||||||
|
TCB_REG_OFF(REG_X13_NDX),
|
||||||
|
TCB_REG_OFF(REG_X14_NDX),
|
||||||
|
TCB_REG_OFF(REG_X15_NDX),
|
||||||
|
TCB_REG_OFF(REG_X16_NDX),
|
||||||
|
TCB_REG_OFF(REG_X17_NDX),
|
||||||
|
TCB_REG_OFF(REG_X18_NDX),
|
||||||
|
TCB_REG_OFF(REG_X19_NDX),
|
||||||
|
TCB_REG_OFF(REG_X20_NDX),
|
||||||
|
TCB_REG_OFF(REG_X21_NDX),
|
||||||
|
TCB_REG_OFF(REG_X22_NDX),
|
||||||
|
TCB_REG_OFF(REG_X23_NDX),
|
||||||
|
TCB_REG_OFF(REG_X24_NDX),
|
||||||
|
TCB_REG_OFF(REG_X25_NDX),
|
||||||
|
TCB_REG_OFF(REG_X26_NDX),
|
||||||
|
TCB_REG_OFF(REG_X27_NDX),
|
||||||
|
TCB_REG_OFF(REG_X28_NDX),
|
||||||
|
TCB_REG_OFF(REG_X29_NDX),
|
||||||
|
TCB_REG_OFF(REG_X30_NDX),
|
||||||
|
TCB_REG_OFF(REG_X31_NDX),
|
||||||
|
TCB_REG_OFF(REG_EPC_NDX),
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_FPU
|
||||||
|
TCB_REG_OFF(REG_F0_NDX),
|
||||||
|
TCB_REG_OFF(REG_F1_NDX),
|
||||||
|
TCB_REG_OFF(REG_F2_NDX),
|
||||||
|
TCB_REG_OFF(REG_F3_NDX),
|
||||||
|
TCB_REG_OFF(REG_F4_NDX),
|
||||||
|
TCB_REG_OFF(REG_F5_NDX),
|
||||||
|
TCB_REG_OFF(REG_F6_NDX),
|
||||||
|
TCB_REG_OFF(REG_F7_NDX),
|
||||||
|
TCB_REG_OFF(REG_F8_NDX),
|
||||||
|
TCB_REG_OFF(REG_F9_NDX),
|
||||||
|
TCB_REG_OFF(REG_F10_NDX),
|
||||||
|
TCB_REG_OFF(REG_F11_NDX),
|
||||||
|
TCB_REG_OFF(REG_F12_NDX),
|
||||||
|
TCB_REG_OFF(REG_F13_NDX),
|
||||||
|
TCB_REG_OFF(REG_F14_NDX),
|
||||||
|
TCB_REG_OFF(REG_F15_NDX),
|
||||||
|
TCB_REG_OFF(REG_F16_NDX),
|
||||||
|
TCB_REG_OFF(REG_F17_NDX),
|
||||||
|
TCB_REG_OFF(REG_F18_NDX),
|
||||||
|
TCB_REG_OFF(REG_F19_NDX),
|
||||||
|
TCB_REG_OFF(REG_F20_NDX),
|
||||||
|
TCB_REG_OFF(REG_F21_NDX),
|
||||||
|
TCB_REG_OFF(REG_F22_NDX),
|
||||||
|
TCB_REG_OFF(REG_F23_NDX),
|
||||||
|
TCB_REG_OFF(REG_F24_NDX),
|
||||||
|
TCB_REG_OFF(REG_F25_NDX),
|
||||||
|
TCB_REG_OFF(REG_F26_NDX),
|
||||||
|
TCB_REG_OFF(REG_F27_NDX),
|
||||||
|
TCB_REG_OFF(REG_F28_NDX),
|
||||||
|
TCB_REG_OFF(REG_F29_NDX),
|
||||||
|
TCB_REG_OFF(REG_F30_NDX),
|
||||||
|
TCB_REG_OFF(REG_F31_NDX),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
TCB_REG_OFF(REG_FCSR_NDX),
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -184,6 +184,14 @@
|
||||||
# error "CONFIG_SCHED_EXIT_MAX < 1"
|
# error "CONFIG_SCHED_EXIT_MAX < 1"
|
||||||
#endif
|
#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))
|
||||||
|
# define TCB_NAME_OFF (offsetof(struct tcb_s, name))
|
||||||
|
# define TCB_REG_OFF(reg) (offsetof(struct tcb_s, xcp.regs[reg]))
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Type Definitions
|
* Public Type Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -764,6 +772,33 @@ struct pthread_tcb_s
|
||||||
};
|
};
|
||||||
#endif /* !CONFIG_DISABLE_PTHREAD */
|
#endif /* !CONFIG_DISABLE_PTHREAD */
|
||||||
|
|
||||||
|
/* struct tcbinfo_s *********************************************************/
|
||||||
|
|
||||||
|
/* The structure save key filed offset of tcb_s while can be used by
|
||||||
|
* debuggers to parse the tcb information
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_TCBINFO
|
||||||
|
struct tcbinfo_s
|
||||||
|
{
|
||||||
|
uint16_t pid_off; /* Offset of tcb.pid */
|
||||||
|
uint16_t state_off; /* Offset of tcb.task_state */
|
||||||
|
uint16_t pri_off; /* Offset of tcb.sched_priority */
|
||||||
|
uint16_t name_off; /* Offset of tcb.name */
|
||||||
|
uint16_t reg_num; /* Num of regs in tcbinfo.reg_offs */
|
||||||
|
|
||||||
|
/* Offsets of xcp.regs, order in GDB org.gnu.gdb.xxx feature.
|
||||||
|
* Please refer:
|
||||||
|
* https://sourceware.org/gdb/current/onlinedocs/gdb/ARM-Features.html
|
||||||
|
* https://sourceware.org/gdb/current/onlinedocs/gdb/RISC_002dV-Features
|
||||||
|
* -.html
|
||||||
|
* value 0: This regsiter was not priovided by NuttX
|
||||||
|
*/
|
||||||
|
|
||||||
|
uint16_t reg_offs[XCPTCONTEXT_REGS];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This is the callback type used by nxsched_foreach() */
|
/* This is the callback type used by nxsched_foreach() */
|
||||||
|
|
||||||
typedef CODE void (*nxsched_foreach_t)(FAR struct tcb_s *tcb, FAR void *arg);
|
typedef CODE void (*nxsched_foreach_t)(FAR struct tcb_s *tcb, FAR void *arg);
|
||||||
|
|
Loading…
Reference in a new issue