2 * gdbserv-target.h -- part of GDB remote server.
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.
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. */
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
28 struct gdbserv_target {
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);
36 void (*process_set_args) (struct gdbserv *);
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 *);
45 /* Deprecated / SID Only. */
46 void (*process_get_reg) (struct gdbserv *, int reg);
47 void (*process_get_exp_regs) (struct gdbserv *);
50 /* Register Processing: new/untested/WIP */
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
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);
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);
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);
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
75 long (*sizeof_reg) (struct gdbserv *, int regnr);
77 /* Update REGNR with the value in REG. Return a negative value if
79 int (*set_reg) (struct gdbserv *, int regnr, struct gdbserv_reg *reg);
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);
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);
90 /* Memory Processing: Transfer LEN bytes of raw memory to/from
91 target. Return number of actual bytes transfered or -1 on
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);
96 /* Other operations. */
97 void (*process_set_pc) (struct gdbserv *, struct gdbserv_reg *val);
98 int (*process_signal) (struct gdbserv *, int sigval);
100 void (*flush_i_cache) (struct gdbserv *);
102 unsigned long (*compute_signal) (struct gdbserv *, unsigned long);
103 unsigned long (*get_trap_number) (struct gdbserv *);
106 /* Program state methods */
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 *);
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);
131 /* Breakpoint methods */
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);
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);
149 void (*process_target_packet) (struct gdbserv *);
152 void (*detach) (struct gdbserv *);
154 /* instance specific data */
158 void *gdbserv_target_data (struct gdbserv *gdbserv);