Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
gdbstub.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Intel Corporation.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#include <inttypes.h>
8
9#ifndef ZEPHYR_INCLUDE_ARCH_XTENSA_GDBSTUB_SYS_H_
10#define ZEPHYR_INCLUDE_ARCH_XTENSA_GDBSTUB_SYS_H_
11
12#ifdef CONFIG_GDBSTUB
13
14#define XTREG_GRP_MASK 0x0F00
15#define XTREG_GRP_GENERAL 0x0000
16#define XTREG_GRP_ADDR 0x0100
17#define XTREG_GRP_SPECIAL 0x0200
18#define XTREG_GRP_USER 0x0300
19
71
72/* Due to Xtensa SoCs being highly configurable,
73 * the register files between SoCs are not identical.
74 *
75 * This means generic registers can, sometimes, have
76 * different offsets from start of register files
77 * needed to communicate with GDB.
78 *
79 * Therefore, it is better to defer to the SoC layer
80 * for proper support for GDB.
81 */
82#include <gdbstub/soc.h>
83
87struct gdb_ctx {
89 unsigned int exception;
90
93
96
99
102
105
108};
109
116static inline bool gdb_xtensa_is_logical_addr_reg(struct xtensa_register *reg)
117{
118 if (reg->regno < 16) {
119 return true;
120 } else {
121 return false;
122 }
123}
124
131static inline bool gdb_xtensa_is_address_reg(struct xtensa_register *reg)
132{
133 if ((reg->regno & XTREG_GRP_MASK) == XTREG_GRP_ADDR) {
134 return true;
135 } else {
136 return false;
137 }
138}
139
147static inline bool gdb_xtensa_is_special_reg(struct xtensa_register *reg)
148{
149 if ((reg->regno & XTREG_GRP_MASK) == XTREG_GRP_SPECIAL) {
150 return true;
151 } else {
152 return false;
153 }
154}
155
163static inline bool gdb_xtensa_is_user_reg(struct xtensa_register *reg)
164{
165 if ((reg->regno & XTREG_GRP_MASK) == XTREG_GRP_USER) {
166 return true;
167 } else {
168 return false;
169 }
170}
171
172#endif /* CONFIG_GDBSTUB */
173
174#endif /* ZEPHYR_INCLUDE_ARCH_XTENSA_GDBSTUB_SYS_H_ */
#define XTREG_GRP_USER
Definition gdbstub.h:18
static bool gdb_xtensa_is_address_reg(struct xtensa_register *reg)
Test if the register is a address register (AR0 - AR31/AR63).
Definition gdbstub.h:131
#define XTREG_GRP_ADDR
Definition gdbstub.h:16
static bool gdb_xtensa_is_logical_addr_reg(struct xtensa_register *reg)
Test if the register is a logical address register (A0 - A15).
Definition gdbstub.h:116
static bool gdb_xtensa_is_special_reg(struct xtensa_register *reg)
Test if the register is a special register that needs to be accessed via RSR/WSR.
Definition gdbstub.h:147
#define XTREG_GRP_MASK
Definition gdbstub.h:14
#define XTREG_GRP_SPECIAL
Definition gdbstub.h:17
static bool gdb_xtensa_is_user_reg(struct xtensa_register *reg)
Test if the register is a user register that needs to be accessed via RUR/WUR.
Definition gdbstub.h:163
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
__INT8_TYPE__ int8_t
Definition stdint.h:72
__INT16_TYPE__ int16_t
Definition stdint.h:73
Architecture specific GDB context.
Definition gdbstub.h:61
uint8_t num_regs
Number of registers.
Definition gdbstub.h:95
uint8_t wb_idx
Index in register descriptions of WINDOWBASE register.
Definition gdbstub.h:107
uint8_t seqno
Sequence number.
Definition gdbstub.h:98
uint8_t a0_idx
Index in register descriptions of A0 register.
Definition gdbstub.h:101
struct xtensa_register * regs
Register descriptions.
Definition gdbstub.h:92
unsigned int exception
Exception reason.
Definition gdbstub.h:63
uint8_t ar_idx
Index in register descriptions of AR0 register.
Definition gdbstub.h:104
Register description for GDB stub.
Definition gdbstub.h:37
uint8_t byte_size
Size of register.
Definition gdbstub.h:45
uint32_t val
Register value.
Definition gdbstub.h:39
uint8_t idx
GDB register index (for p/P packets)
Definition gdbstub.h:42
uint8_t seqno
Sequence number.
Definition gdbstub.h:63
uint16_t regno
Xtensa register number.
Definition gdbstub.h:48
int16_t gpkt_offset
Offset of this register in GDB G-packet.
Definition gdbstub.h:54
uint8_t is_read_only
Set to 1 if register should not be written to during debugging.
Definition gdbstub.h:69
int8_t stack_offset
Offset of saved register in stack frame.
Definition gdbstub.h:60