Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:51

0001 /**
0002  * @file
0003  * @ingroup mips_gdb
0004  * @brief Definition of the interface between stub and gdb
0005  */
0006 
0007 /*
0008  * gdb_if.h - definition of the interface between the stub and gdb
0009  *
0010  *                   THIS SOFTWARE IS NOT COPYRIGHTED
0011  *
0012  *  The following software is offered for use in the public domain.
0013  *  There is no warranty with regard to this software or its performance
0014  *  and the user must accept the software "AS IS" with all faults.
0015  *
0016  *  THE CONTRIBUTORS DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, WITH
0017  *  REGARD TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES
0018  *  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
0019  */
0020 
0021 /**
0022  * @defgroup mips_gdb GDB Interface
0023  * @ingroup RTEMSBSPsMIPSShared
0024  * @brief GDB Interface
0025  * @{
0026  */
0027 
0028 #ifndef _GDB_IF_H
0029 #define _GDB_IF_H
0030 
0031 /** @brief Max number of threads in qM response */
0032 #define QM_MAX_THREADS (20)
0033 
0034 struct rtems_gdb_stub_thread_info {
0035   char display[256];
0036   char name[256];
0037   char more_display[256];
0038 };
0039 
0040 /**
0041  * @name Prototypes
0042  * @{
0043  */
0044 
0045 int parse_zbreak(const char *in, int *type, unsigned char **addr, int *len);
0046 
0047 char* mem2hstr(char *buf, const unsigned char *mem, int count);
0048 int   hstr2mem(unsigned char *mem, const char *buf, int count);
0049 void  set_mem_err(void);
0050 unsigned char get_byte(const unsigned char *ptr);
0051 void  set_byte(unsigned char *ptr, int val);
0052 char* thread2vhstr(char *buf, int thread);
0053 char* thread2fhstr(char *buf, int thread);
0054 const char* fhstr2thread(const char *buf, int *thread);
0055 const char* vhstr2thread(const char *buf, int *thread);
0056 char* int2fhstr(char *buf, int val);
0057 char* int2vhstr(char *buf, int vali);
0058 const char* fhstr2int(const char *buf, int *ival);
0059 const char* vhstr2int(const char *buf, int *ival);
0060 int   hstr2byte(const char *buf, int *bval);
0061 int   hstr2nibble(const char *buf, int *nibble);
0062 
0063 Thread_Control *rtems_gdb_index_to_stub_id(int);
0064 int rtems_gdb_stub_thread_support_ok(void);
0065 int rtems_gdb_stub_get_current_thread(void);
0066 int rtems_gdb_stub_get_next_thread(int);
0067 int rtems_gdb_stub_get_offsets(
0068   unsigned char **text_addr,
0069   unsigned char **data_addr,
0070   unsigned char **bss_addr
0071 );
0072 int rtems_gdb_stub_get_thread_regs(
0073   int thread,
0074   unsigned int *registers
0075 );
0076 int rtems_gdb_stub_set_thread_regs(
0077   int thread,
0078   unsigned int *registers
0079 );
0080 void rtems_gdb_process_query(
0081   char *inbuffer,
0082   char *outbuffer,
0083   int   do_threads,
0084   int   thread
0085 );
0086 
0087 /** @} */
0088 
0089 /**
0090  * @name MIPS registers
0091  * @brief Numbered in the order in which gdb expects to see them.
0092  * @{
0093  */
0094 
0095 #define ZERO        0
0096 #define AT      1
0097 #define V0      2
0098 #define V1      3
0099 #define A0      4
0100 #define A1      5
0101 #define A2      6
0102 #define A3      7
0103 
0104 #define T0      8
0105 #define T1      9
0106 #define T2      10
0107 #define T3      11
0108 #define T4      12
0109 #define T5      13
0110 #define T6      14
0111 #define T7      15
0112 
0113 #define S0      16
0114 #define S1      17
0115 #define S2      18
0116 #define S3      19
0117 #define S4      20
0118 #define S5      21
0119 #define S6      22
0120 #define S7      23
0121 
0122 #define T8      24
0123 #define T9      25
0124 #define K0      26
0125 #define K1      27
0126 #define GP      28
0127 #define SP      29
0128 #define S8      30
0129 #define RA      31
0130 
0131 #define SR      32
0132 #define LO      33
0133 #define HI      34
0134 #define BAD_VA      35
0135 #define CAUSE       36
0136 #define PC      37
0137 
0138 #define F0      38
0139 #define F1      39
0140 #define F2      40
0141 #define F3      41
0142 #define F4      42
0143 #define F5      43
0144 #define F6      44
0145 #define F7      45
0146 
0147 #define F8      46
0148 #define F9      47
0149 #define F10     48
0150 #define F11     49
0151 #define F12     50
0152 #define F13     51
0153 #define F14     52
0154 #define F15     53
0155 
0156 #define F16     54
0157 #define F17     55
0158 #define F18     56
0159 #define F19     57
0160 #define F20     58
0161 #define F21     59
0162 #define F22     60
0163 #define F23     61
0164 
0165 #define F24     62
0166 #define F25     63
0167 #define F26     64
0168 #define F27     65
0169 #define F28     66
0170 #define F29     67
0171 #define F30     68
0172 #define F31     69
0173 
0174 #define FCSR        70
0175 #define FIRR        71
0176 
0177 #define NUM_REGS    72
0178 
0179 /** @} */
0180 
0181 void mips_gdb_stub_install(int enableThreads) ;
0182 
0183 #define MEMOPT_READABLE   1
0184 #define MEMOPT_WRITEABLE  2
0185 
0186 #ifndef NUM_MEMSEGS
0187 #define NUM_MEMSEGS     10
0188 #endif
0189 
0190 int gdbstub_add_memsegment(unsigned,unsigned,int);
0191 
0192 /** @} */
0193 
0194 #endif /* _GDB_IF_H */