OSDN Git Service

Merge branch 'master' of git://github.com/monaka/binutils
[pf3gnuchains/pf3gnuchains3x.git] / sid / component / gdb / gdbserv-target.h
1 /*
2  * gdbserv-target.h -- part of GDB remote server.
3  *
4  * Copyright (C) 2000, 2002, 2006 Red Hat.
5  * This file is part of SID and is licensed under the GPL.
6  * See the file COPYING.SID for conditions for redistribution.
7  */
8
9
10 struct gdbserv;
11
12 enum gdbserv_target_rc {
13   GDBSERV_TARGET_RC_ERROR = -1, /* Failed, ack with ``Enn''. */
14   GDBSERV_TARGET_RC_OK = 0, /* Ok, ack with ``OK'' where applicable. */
15   GDBSERV_TARGET_RC_UNKNOWN = 1 /* Not supported, or silent. */
16 };
17
18 enum gdbserv_target_bp {
19   GDBSERV_TARGET_BP_UNKNOWN = -1,
20   GDBSERV_TARGET_BP_SOFTWARE,
21   GDBSERV_TARGET_BP_HARDWARE,
22   GDBSERV_TARGET_BP_WRITE,
23   GDBSERV_TARGET_BP_READ,
24   GDBSERV_TARGET_BP_ACCESS
25 };
26
27
28 struct gdbserv_target {
29   /* GDB Client */
30
31   /* Remote Qq packet methods */
32   void (*process_get_gen) (struct gdbserv *);
33   void (*process_set_gen) (struct gdbserv *);
34   void (*process_rcmd) (struct gdbserv *, const char *cmd, int sizeof_cmd);
35
36   void (*process_set_args) (struct gdbserv *);
37
38   /* Register Processing: old/tested */
39   /* Either implement process_set_reg, process_get_regs,
40      process_set_regs OR get_sizeof_reg, get_reg, set_reg. */
41   int (*process_set_reg) (struct gdbserv *, int reg);
42   int (*process_set_regs) (struct gdbserv *);
43   void (*process_get_regs) (struct gdbserv *);
44
45   /* Deprecated / SID Only. */
46   void (*process_get_reg) (struct gdbserv *, int reg);
47   void (*process_get_exp_regs) (struct gdbserv *);
48
49
50   /* Register Processing: new/untested/WIP */
51
52   /* Input/Output a ``struct gdbserv_reg'' according to the target
53      dependant byte ordering.  See gdbserv_input_reg_{beb,leb} and
54      gdbserv_output_reg_{beb,leb}. Return a negative value to indicate
55      a parse error. */
56   int (*input_reg) (struct gdbserv *gdbserv, struct gdbserv_reg *reg, int len);
57   void (*output_reg) (struct gdbserv *gdbserv, struct gdbserv_reg *reg, int len);
58
59   /* Return the REG-NR for the ``I''th register in the ``Gg'' packets.
60      Return a negative value when there are no more registers. Called
61      iteratively starting with 0. */
62   int (*gg_reg_nr) (struct gdbserv *, int index);
63
64   /* (optional) Return the REG-NR for ``expedited'' register ``I'' in
65      the ``T'' packet.  Return a negative value when there are no more
66      registers.  Expedited registers help improve the remote protocol
67      performance.  Called iteratively starting with 0. */
68   int (*expedited_reg_nr) (struct gdbserv *, int index);
69
70   /* Return the SIZE of a REG-NR register (as returned by REG_NR() or
71      EXPEDITED_REG_NR()).  2*SIZE characters are assumed to represent
72      that register in the ``Gg'' packets.  Return a negated SIZE if
73      there is a ``hole'' in the G packet - data but no corresponding
74      register. */
75   long (*sizeof_reg) (struct gdbserv *, int regnr);
76
77   /* Update REGNR with the value in REG. Return a negative value if
78      the write breaks. */
79   int (*set_reg) (struct gdbserv *, int regnr, struct gdbserv_reg *reg);
80
81   /* Return REGNR in ``struct gdbserv_reg''. Return a negative value
82      if the write breaks. */
83   int (*get_reg) (struct gdbserv *, int regnr, struct gdbserv_reg *reg);
84
85   /* Deprecated / SID only. */
86   void (*process_get_mem) (struct gdbserv *, struct gdbserv_reg *addr, struct gdbserv_reg *len);
87   void (*process_set_mem) (struct gdbserv *, struct gdbserv_reg *addr, struct gdbserv_reg *len, int binary);
88
89
90   /* Memory Processing: Transfer LEN bytes of raw memory to/from
91      target. Return number of actual bytes transfered or -1 on
92      error. */
93   long (*get_mem) (struct gdbserv *, struct gdbserv_reg *addr, void *data, long len);
94   long (*set_mem) (struct gdbserv *, struct gdbserv_reg *addr, void *data, long len);
95
96   /* Other operations. */
97   void (*process_set_pc) (struct gdbserv *, struct gdbserv_reg *val);
98   int (*process_signal) (struct gdbserv *, int sigval);
99
100   void (*flush_i_cache) (struct gdbserv *);
101
102   unsigned long (*compute_signal) (struct gdbserv *, unsigned long);
103   unsigned long (*get_trap_number) (struct gdbserv *);
104
105
106   /* Program state methods */
107 #if 0 /* ASVP */
108   void (*exit_program) (struct gdbserv *);
109   void (*break_program) (struct gdbserv *);
110   int (*reset_program) (struct gdbserv *);
111   void (*restart_program) (struct gdbserv *);
112   void (*singlestep_program) (struct gdbserv *);
113   void (*cyclestep_program) (struct gdbserv *);
114   void (*sigkill_program) (struct gdbserv *);
115   void (*continue_program) (struct gdbserv *);
116 #else /* SID */
117   int (*exit_program) (struct gdbserv *);
118   int (*break_program) (struct gdbserv *);
119   int (*reset_program) (struct gdbserv *);
120   void (*restart_program) (struct gdbserv *);
121   int (*singlestep_program) (struct gdbserv *);
122   int (*rangestep_program) (struct gdbserv *, 
123                             struct gdbserv_reg *range_start, 
124                             struct gdbserv_reg *range_end);
125   void (*cyclestep_program) (struct gdbserv *);
126   void (*sigkill_program) (struct gdbserv *);
127   int (*continue_program) (struct gdbserv *);
128   int (*set_exec_direction) (struct gdbserv *, const char *direction);
129 #endif
130
131   /* Breakpoint methods */
132 #if 0 /* ASVP */
133   enum gdbserv_target_rc (*remove_breakpoint) (struct gdbserv *,
134                                                enum gdbserv_target_bp type,
135                                                struct gdbserv_reg *addr,
136                                                struct gdbserv_reg *len);
137   enum gdbserv_target_rc (*set_breakpoint) (struct gdbserv *,
138                                             enum gdbserv_target_bp type,
139                                             struct gdbserv_reg *addr,
140                                             struct gdbserv_reg *len);
141 #else /* SID */
142   int (*remove_breakpoint) (struct gdbserv *, unsigned long type, 
143                             struct gdbserv_reg *addr, struct gdbserv_reg *len);
144   int (*set_breakpoint) (struct gdbserv *, unsigned long type,
145                          struct gdbserv_reg *addr, struct gdbserv_reg *len);
146 #endif
147
148   /* misc methods */
149   void (*process_target_packet) (struct gdbserv *);
150
151   /* shutdown */
152   void (*detach) (struct gdbserv *);
153
154   /* instance specific data */
155   void *data;
156 };
157
158 void *gdbserv_target_data (struct gdbserv *gdbserv);
159
160