source: rtems/bsps/lm32/shared/gdbstub/gdb_if.h @ fd67814

5
Last change on this file since fd67814 was fd67814, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 23, 2018 at 10:06:14 AM

bsps: Move GDB stubs to bsps

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 4.2 KB
Line 
1/**
2 * @file
3 * @ingroup lm32_gdb
4 * @brief definition of the interface between the stub and gdb
5 */
6
7/*
8 * gdb_if.h - definition of the interface between the stub and gdb
9 *
10 *                   THIS SOFTWARE IS NOT COPYRIGHTED
11 *
12 *  The following software is offered for use in the public domain.
13 *  There is no warranty with regard to this software or its performance
14 *  and the user must accept the software "AS IS" with all faults.
15 *
16 *  THE CONTRIBUTORS DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, WITH
17 *  REGARD TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 *  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 */
20
21/**
22 * @defgroup lm32_gdb LM32 GDB Interface
23 * @ingroup lm32_shared
24 * @brief Definition of the interface between the stub and gdb,
25 * @{
26 */
27
28#ifndef _GDB_IF_H
29#define _GDB_IF_H
30
31/** @brief Max number of threads in qM response */
32#define QM_MAX_THREADS (20)
33
34struct rtems_gdb_stub_thread_info {
35  char display[256];
36  char name[256];
37  char more_display[256];
38};
39
40/*
41 *  Prototypes
42 */
43
44int parse_zbreak(const char *in, int *type, unsigned char **addr, int *len);
45
46char* mem2hstr(char *buf, const unsigned char *mem, int count);
47int   hstr2mem(unsigned char *mem, const char *buf, int count);
48void  set_mem_err(void);
49unsigned char get_byte(const unsigned char *ptr);
50void  set_byte(unsigned char *ptr, int val);
51char* thread2vhstr(char *buf, int thread);
52char* thread2fhstr(char *buf, int thread);
53const char* fhstr2thread(const char *buf, int *thread);
54const char* vhstr2thread(const char *buf, int *thread);
55char* int2fhstr(char *buf, int val);
56char* int2vhstr(char *buf, int vali);
57const char* fhstr2int(const char *buf, int *ival);
58const char* vhstr2int(const char *buf, int *ival);
59int   hstr2byte(const char *buf, int *bval);
60int   hstr2nibble(const char *buf, int *nibble);
61
62Thread_Control *rtems_gdb_index_to_stub_id(int);
63int rtems_gdb_stub_thread_support_ok(void);
64int rtems_gdb_stub_get_current_thread(void);
65int rtems_gdb_stub_get_next_thread(int);
66int rtems_gdb_stub_get_offsets(
67  unsigned char **text_addr,
68  unsigned char **data_addr,
69  unsigned char **bss_addr
70);
71int rtems_gdb_stub_get_thread_regs(
72  int thread,
73  unsigned int *registers
74);
75int rtems_gdb_stub_set_thread_regs(
76  int thread,
77  unsigned int *registers
78);
79void rtems_gdb_process_query(
80  char *inbuffer,
81  char *outbuffer,
82  int   do_threads,
83  int   thread
84);
85
86/** @brief Exception IDs */
87#define LM32_EXCEPTION_RESET                  0x0
88#define LM32_EXCEPTION_INST_BREAKPOINT        0x1
89#define LM32_EXCEPTION_INST_BUS_ERROR         0x2
90#define LM32_EXCEPTION_DATA_BREAKPOINT        0x3
91#define LM32_EXCEPTION_DATA_BUS_ERROR         0x4
92#define LM32_EXCEPTION_DIVIDE_BY_ZERO         0x5
93#define LM32_EXCEPTION_INTERRUPT              0x6
94#define LM32_EXCEPTION_SYSTEM_CALL            0x7
95
96/** @brief Breakpoint instruction */
97#define LM32_BREAK                            0xac000002UL
98
99/** @brief This numbering must be consistant with GDBs numbering in gdb/lm32-tdep.c */
100enum lm32_regnames {
101  LM32_REG_R0, LM32_REG_R1, LM32_REG_R2, LM32_REG_R3, LM32_REG_R4, LM32_REG_R5,
102  LM32_REG_R6, LM32_REG_R7, LM32_REG_R8, LM32_REG_R9, LM32_REG_R10,
103  LM32_REG_R11, LM32_REG_R12, LM32_REG_R13, LM32_REG_R14, LM32_REG_R15,
104  LM32_REG_R16, LM32_REG_R17, LM32_REG_R18, LM32_REG_R19, LM32_REG_R20,
105  LM32_REG_R21, LM32_REG_R22, LM32_REG_R23, LM32_REG_R24, LM32_REG_R25,
106  LM32_REG_GP, LM32_REG_FP, LM32_REG_SP, LM32_REG_RA, LM32_REG_EA, LM32_REG_BA,
107  LM32_REG_PC, LM32_REG_EID, LM32_REG_EBA, LM32_REG_DEBA, LM32_REG_IE, NUM_REGS
108};
109
110/* keep this in sync with the debug isr handler in lm32-debug.S */
111enum lm32_int_regnames {
112  LM32_INT_REG_R1, LM32_INT_REG_R2, LM32_INT_REG_R3, LM32_INT_REG_R4,
113  LM32_INT_REG_R5, LM32_INT_REG_R6, LM32_INT_REG_R7, LM32_INT_REG_R8,
114  LM32_INT_REG_R9, LM32_INT_REG_R10, LM32_INT_REG_RA, LM32_INT_REG_EA,
115  LM32_INT_REG_BA, LM32_INT_REG_R11, LM32_INT_REG_R12, LM32_INT_REG_R13,
116  LM32_INT_REG_R14, LM32_INT_REG_R15, LM32_INT_REG_R16, LM32_INT_REG_R17,
117  LM32_INT_REG_R18, LM32_INT_REG_R19, LM32_INT_REG_R20, LM32_INT_REG_R21,
118  LM32_INT_REG_R22, LM32_INT_REG_R23, LM32_INT_REG_R24, LM32_INT_REG_R25,
119  LM32_INT_REG_GP, LM32_INT_REG_FP, LM32_INT_REG_SP, LM32_INT_REG_PC,
120  LM32_INT_REG_EID, LM32_INT_REG_EBA, LM32_INT_REG_DEBA, LM32_INT_REG_IE,
121};
122
123#endif /* _GDB_IF_H */
124
125/** @} */
Note: See TracBrowser for help on using the repository browser.