Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug: add tools for task aware debug #4810

Merged
merged 3 commits into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,14 @@ endmenu # Customize Header Files

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
bool
default n
Expand Down
64 changes: 64 additions & 0 deletions arch/arm/src/arm/arm_tcbinfo.c
Original file line number Diff line number Diff line change
@@ -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 changes: 71 additions & 0 deletions arch/arm/src/armv6-m/arm_tcbinfo.c
Original file line number Diff line number Diff line change
@@ -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 changes: 108 additions & 0 deletions arch/arm/src/armv7-a/arm_tcbinfo.c
Original file line number Diff line number Diff line change
@@ -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 changes: 114 additions & 0 deletions arch/arm/src/armv7-m/arm_tcbinfo.c
Original file line number Diff line number Diff line change
@@ -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
Loading