Back to home page

LXR

 
 

    


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

0001 /**
0002  *  @file
0003  *
0004  *  @ingroup m68k_gdbstub
0005  *
0006  *  @brief definition of the interface between the stub and gdb
0007  */
0008 
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 #ifndef _GDB_IF_H
0022 #define _GDB_IF_H
0023 
0024 /**
0025  *  @defgroup m68k_gdbstub GDB Stub
0026  *
0027  *  @ingroup RTEMSBSPsM68kShared
0028  *
0029  *  @brief GDB Stub interface support
0030  */
0031 
0032 /* Max number of threads in qM response */
0033 #define QM_MAX_THREADS (20)
0034 
0035 struct rtems_gdb_stub_thread_info {
0036   char display[256];
0037   char name[256];
0038   char more_display[256];
0039 };
0040 
0041 /*
0042  *  Prototypes
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 #if defined (__mc68000__)
0088 /* there are 180 bytes of registers on a 68020 w/68881      */
0089 /* many of the fpa registers are 12 byte (96 bit) registers */
0090 #define NUMREGBYTES 180
0091 enum regnames {D0,D1,D2,D3,D4,D5,D6,D7,
0092                A0,A1,A2,A3,A4,A5,A6,A7,
0093                PS,PC,
0094                FP0,FP1,FP2,FP3,FP4,FP5,FP6,FP7,
0095                FPCONTROL,FPSTATUS,FPIADDR
0096               };
0097 #elif defined (__mips__)
0098 /*
0099  * MIPS registers, numbered in the order in which gdb expects to see them.
0100  */
0101 #define ZERO        0
0102 #define AT      1
0103 #define V0      2
0104 #define V1      3
0105 #define A0      4
0106 #define A1      5
0107 #define A2      6
0108 #define A3      7
0109 
0110 #define T0      8
0111 #define T1      9
0112 #define T2      10
0113 #define T3      11
0114 #define T4      12
0115 #define T5      13
0116 #define T6      14
0117 #define T7      15
0118 
0119 #define S0      16
0120 #define S1      17
0121 #define S2      18
0122 #define S3      19
0123 #define S4      20
0124 #define S5      21
0125 #define S6      22
0126 #define S7      23
0127 
0128 #define T8      24
0129 #define T9      25
0130 #define K0      26
0131 #define K1      27
0132 #define GP      28
0133 #define SP      29
0134 #define S8      30
0135 #define RA      31
0136 
0137 #define SR      32
0138 #define LO      33
0139 #define HI      34
0140 #define BAD_VA      35
0141 #define CAUSE       36
0142 #define PC      37
0143 
0144 #define F0      38
0145 #define F1      39
0146 #define F2      40
0147 #define F3      41
0148 #define F4      42
0149 #define F5      43
0150 #define F6      44
0151 #define F7      45
0152 
0153 #define F8      46
0154 #define F9      47
0155 #define F10     48
0156 #define F11     49
0157 #define F12     50
0158 #define F13     51
0159 #define F14     52
0160 #define F15     53
0161 
0162 #define F16     54
0163 #define F17     55
0164 #define F18     56
0165 #define F19     57
0166 #define F20     58
0167 #define F21     59
0168 #define F22     60
0169 #define F23     61
0170 
0171 #define F24     62
0172 #define F25     63
0173 #define F26     64
0174 #define F27     65
0175 #define F28     66
0176 #define F29     67
0177 #define F30     68
0178 #define F31     69
0179 
0180 #define FCSR        70
0181 #define FIRR        71
0182 
0183 #define NUM_REGS    72
0184 
0185 void mips_gdb_stub_install(int enableThreads) ;
0186 #endif /* defined (__mips__) */
0187 
0188 #define MEMOPT_READABLE   1
0189 #define MEMOPT_WRITEABLE  2
0190 
0191 #define NUM_MEMSEGS     10
0192 
0193 int gdbstub_add_memsegment(unsigned,unsigned,int);
0194 
0195 #endif /* _GDB_IF_H */