1 /* Remote debugging interface ROM monitors.
2 * Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
3 * Contributed by Cygnus Support. Written by Rob Savoye for Cygnus.
5 * Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
6 * Contributed by Cygnus Support. Written by Rob Savoye for Cygnus.
8 * This file is part of GDB.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 char *cmd; /* command to send */
27 char *delim; /* the delimiter */
28 char *result; /* the result */
31 /* This structure describes the strings necessary to give small command
32 sequences to the monitor, and parse the response.
34 CMD is the actual command typed at the monitor. Usually this has embedded
35 sequences ala printf, which are substituted with the arguments appropriate
36 to that type of command. Ie: to examine a register, we substitute the
37 register name for the first arg. To modify memory, we substitute the memory
38 location and the new contents for the first and second args, etc...
40 RESP_DELIM used to home in on the response string, and is used to
41 disambiguate the answer within the pile of text returned by the monitor.
42 This should be a unique string that immediately precedes the answer. Ie: if
43 your monitor prints out `PC: 00000001= ' in response to asking for the PC,
44 you should use `: ' as the RESP_DELIM. RESP_DELIM may be NULL if the res-
45 ponse is going to be ignored, or has no particular leading text.
47 TERM is the string that the monitor outputs to indicate that it is idle, and
48 waiting for input. This is usually a prompt of some sort. In the previous
49 example, it would be `= '. It is important that TERM really means that the
50 monitor is idle, otherwise GDB may try to type at it when it isn't ready for
51 input. This is a problem because many monitors cannot deal with type-ahead.
52 TERM may be NULL if the normal prompt is output.
54 TERM_CMD is used to quit out of the subcommand mode and get back to the main
55 prompt. TERM_CMD may be NULL if it isn't necessary. It will also be
56 ignored if TERM is NULL.
61 char *cmdb; /* Command to send for byte read/write */
62 char *cmdw; /* Command for word (16 bit) read/write */
63 char *cmdl; /* Command for long (32 bit) read/write */
64 char *cmdll; /* Command for long long (64 bit) read/write */
65 char *resp_delim; /* String just prior to the desired value */
66 char *term; /* Terminating string to search for */
67 char *term_cmd; /* String to get out of sub-mode (if necessary) */
72 char *cmd; /* Command to send for reg read/write */
73 char *resp_delim; /* String just prior to the desired value */
74 char *term; /* Terminating string to search for */
75 char *term_cmd; /* String to get out of sub-mode (if necessary) */
80 int flags; /* See below */
81 char **init; /* List of init commands. NULL terminated. */
82 char *cont; /* continue command */
83 char *step; /* single step */
84 char *set_break; /* set a breakpoint */
85 char *clr_break; /* clear a breakpoint */
86 char *clr_all_break; /* Clear all breakpoints */
87 char *fill; /* Memory fill cmd (addr len val) */
88 struct memrw_cmd setmem; /* set memory to a value */
89 struct memrw_cmd getmem; /* display memory */
90 struct regrw_cmd setreg; /* set a register */
91 struct regrw_cmd getreg; /* get a register */
92 /* Some commands can dump a bunch of registers
93 at once. This comes as a set of REG=VAL
94 pairs. This should be called for each pair
95 of registers that we can parse to supply
96 GDB with the value of a register. */
97 char *dump_registers; /* Command to dump all regs at once */
98 char *register_pattern; /* Pattern that picks out register from reg dump */
99 void (*supply_register) PARAMS ((char *name, int namelen, char *val, int vallen));
100 char *load; /* load command */
101 char *loadresp; /* Response to load command */
102 char *prompt; /* monitor command prompt */
103 char *cmd_delim; /* end-of-command delimitor */
104 char *cmd_end; /* optional command terminator */
105 struct target_ops *target; /* target operations */
106 char **loadtypes; /* the load types that are supported */
107 char **loadprotos; /* the load protocols that are supported */
108 char *baudrates; /* supported baud rates */
109 int stopbits; /* number of stop bits */
110 char **regnames; /* array of register names in ascii */
111 int magic; /* Check value */
114 #define MONITOR_OPS_MAGIC 600925
116 /* Flag defintions */
118 #define MO_CLR_BREAK_USES_ADDR 0x1 /* If set, then clear breakpoint command
119 uses address, otherwise it uses an index
120 returned by the monitor. */
121 #define MO_FILL_USES_ADDR 0x2 /* If set, then memory fill command uses
122 STARTADDR, ENDADDR+1, VALUE as args, else it
123 uses STARTADDR, LENGTH, VALUE as args. */
124 #define MO_NEED_REGDUMP_AFTER_CONT 0x4 /* If set, then monitor doesn't auto-
125 matically supply register dump when
126 coming back after a continue. */
128 extern struct monitor_ops *current_monitor;
130 #define LOADTYPES (current_monitor->loadtypes)
131 #define LOADPROTOS (current_monitor->loadprotos)
132 #define INIT_CMD (current_monitor->init)
133 #define CONT_CMD (current_monitor->cont)
134 #define STEP_CMD (current_monitor->step)
135 #define SET_BREAK_CMD (current_monitor->set_break)
136 #define CLR_BREAK_CMD (current_monitor->clr_break)
137 #define SET_MEM (current_monitor->setmem)
138 #define GET_MEM (current_monitor->getmem)
139 #define LOAD_CMD (current_monitor->load)
140 #define GET_REG (current_monitor->regget)
141 #define SET_REG (current_monitor->regset)
142 #define CMD_END (current_monitor->cmd_end)
143 #define CMD_DELIM (current_monitor->cmd_delim)
144 #define PROMPT (current_monitor->prompt)
145 #define TARGET_OPS (current_monitor->target)
146 #define TARGET_NAME (current_monitor->target->to_shortname)
147 #define BAUDRATES (current_monitor->baudrates)
148 #define STOPBITS (current_monitor->stopbits)
149 #define REGNAMES(x) (current_monitor->regnames[x])
150 #define ROMCMD(x) (x.cmd)
151 #define ROMDELIM(x) (x.delim)
152 #define ROMRES(x) (x.result)
154 #define push_monitor(x) current_monitor = x;
156 #define SREC_SIZE 160
159 * FIXME: These are to temporarily maintain compatability with the
160 * old monitor structure till remote-mon.c is fixed to work
161 * like the *-rom.c files.
163 #define MEM_PROMPT (current_monitor->loadtypes)
164 #define MEM_SET_CMD (current_monitor->setmem)
165 #define MEM_DIS_CMD (current_monitor->getmem)
166 #define REG_DELIM (current_monitor->regset.delim)
168 extern void monitor_open PARAMS ((char *args, struct monitor_ops *ops, int from_tty));
169 extern char *monitor_supply_register PARAMS ((int regno, char *valstr));