* parse.c (write_dollar_variable): New function.
[deliverable/binutils-gdb.git] / gdb / monitor.h
CommitLineData
51d6a954 1/* Remote debugging interface ROM monitors.
054240ec
RS
2 * Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
3 * Contributed by Cygnus Support. Written by Rob Savoye for Cygnus.
4 *
5 * Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
6 * Contributed by Cygnus Support. Written by Rob Savoye for Cygnus.
7 *
8 * This file is part of GDB.
9 *
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.
14 *
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.
19 *
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
6c9638b4 22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
054240ec
RS
23 */
24
5de0c648
SG
25#include "serial.h"
26
51d6a954
RS
27struct rom_cmd_data {
28 char *cmd; /* command to send */
29 char *delim; /* the delimiter */
30 char *result; /* the result */
31};
32
1265e2d8
SG
33/* This structure describes the strings necessary to give small command
34 sequences to the monitor, and parse the response.
35
36 CMD is the actual command typed at the monitor. Usually this has embedded
37 sequences ala printf, which are substituted with the arguments appropriate
38 to that type of command. Ie: to examine a register, we substitute the
39 register name for the first arg. To modify memory, we substitute the memory
40 location and the new contents for the first and second args, etc...
41
42 RESP_DELIM used to home in on the response string, and is used to
43 disambiguate the answer within the pile of text returned by the monitor.
44 This should be a unique string that immediately precedes the answer. Ie: if
45 your monitor prints out `PC: 00000001= ' in response to asking for the PC,
46 you should use `: ' as the RESP_DELIM. RESP_DELIM may be NULL if the res-
47 ponse is going to be ignored, or has no particular leading text.
48
49 TERM is the string that the monitor outputs to indicate that it is idle, and
50 waiting for input. This is usually a prompt of some sort. In the previous
51 example, it would be `= '. It is important that TERM really means that the
52 monitor is idle, otherwise GDB may try to type at it when it isn't ready for
53 input. This is a problem because many monitors cannot deal with type-ahead.
54 TERM may be NULL if the normal prompt is output.
55
56 TERM_CMD is used to quit out of the subcommand mode and get back to the main
57 prompt. TERM_CMD may be NULL if it isn't necessary. It will also be
58 ignored if TERM is NULL.
59*/
60
a25a9f49
SG
61struct memrw_cmd
62{
63 char *cmdb; /* Command to send for byte read/write */
64 char *cmdw; /* Command for word (16 bit) read/write */
65 char *cmdl; /* Command for long (32 bit) read/write */
66 char *cmdll; /* Command for long long (64 bit) read/write */
1265e2d8
SG
67 char *resp_delim; /* String just prior to the desired value */
68 char *term; /* Terminating string to search for */
69 char *term_cmd; /* String to get out of sub-mode (if necessary) */
70};
71
a25a9f49
SG
72struct regrw_cmd
73{
74 char *cmd; /* Command to send for reg read/write */
75 char *resp_delim; /* String just prior to the desired value */
76 char *term; /* Terminating string to search for */
77 char *term_cmd; /* String to get out of sub-mode (if necessary) */
78};
79
80struct monitor_ops
81{
82 int flags; /* See below */
83 char **init; /* List of init commands. NULL terminated. */
84 char *cont; /* continue command */
85 char *step; /* single step */
a706069f 86 char *stop; /* Interrupt program string */
a25a9f49
SG
87 char *set_break; /* set a breakpoint */
88 char *clr_break; /* clear a breakpoint */
89 char *clr_all_break; /* Clear all breakpoints */
90 char *fill; /* Memory fill cmd (addr len val) */
91 struct memrw_cmd setmem; /* set memory to a value */
92 struct memrw_cmd getmem; /* display memory */
93 struct regrw_cmd setreg; /* set a register */
94 struct regrw_cmd getreg; /* get a register */
2081365f
SG
95 /* Some commands can dump a bunch of registers
96 at once. This comes as a set of REG=VAL
97 pairs. This should be called for each pair
98 of registers that we can parse to supply
99 GDB with the value of a register. */
a25a9f49 100 char *dump_registers; /* Command to dump all regs at once */
2081365f 101 char *register_pattern; /* Pattern that picks out register from reg dump */
a25a9f49 102 void (*supply_register) PARAMS ((char *name, int namelen, char *val, int vallen));
5de0c648 103 void (*load_routine) PARAMS ((serial_t desc, char *file, int hashmark)); /* Download routine */
a25a9f49
SG
104 char *load; /* load command */
105 char *loadresp; /* Response to load command */
106 char *prompt; /* monitor command prompt */
d8afcce9 107 char *line_term; /* end-of-command delimitor */
a25a9f49 108 char *cmd_end; /* optional command terminator */
51d6a954 109 struct target_ops *target; /* target operations */
a25a9f49
SG
110 int stopbits; /* number of stop bits */
111 char **regnames; /* array of register names in ascii */
112 int magic; /* Check value */
054240ec
RS
113};
114
a25a9f49
SG
115#define MONITOR_OPS_MAGIC 600925
116
117/* Flag defintions */
118
119#define MO_CLR_BREAK_USES_ADDR 0x1 /* If set, then clear breakpoint command
120 uses address, otherwise it uses an index
121 returned by the monitor. */
122#define MO_FILL_USES_ADDR 0x2 /* If set, then memory fill command uses
123 STARTADDR, ENDADDR+1, VALUE as args, else it
124 uses STARTADDR, LENGTH, VALUE as args. */
125#define MO_NEED_REGDUMP_AFTER_CONT 0x4 /* If set, then monitor doesn't auto-
126 matically supply register dump when
127 coming back after a continue. */
3da4297e 128#define MO_GETMEM_NEEDS_RANGE 0x8 /* getmem needs start addr and end addr */
d8afcce9 129#define MO_GETMEM_READ_SINGLE 0x10 /* getmem can only read one loc at a time */
a25a9f49 130
054240ec
RS
131extern struct monitor_ops *current_monitor;
132
51d6a954 133#define LOADTYPES (current_monitor->loadtypes)
b3b8d9bf 134#define LOADPROTOS (current_monitor->loadprotos)
51d6a954 135#define INIT_CMD (current_monitor->init)
a25a9f49 136#define CONT_CMD (current_monitor->cont)
054240ec
RS
137#define STEP_CMD (current_monitor->step)
138#define SET_BREAK_CMD (current_monitor->set_break)
139#define CLR_BREAK_CMD (current_monitor->clr_break)
51d6a954
RS
140#define SET_MEM (current_monitor->setmem)
141#define GET_MEM (current_monitor->getmem)
054240ec 142#define LOAD_CMD (current_monitor->load)
51d6a954
RS
143#define GET_REG (current_monitor->regget)
144#define SET_REG (current_monitor->regset)
054240ec
RS
145#define CMD_END (current_monitor->cmd_end)
146#define CMD_DELIM (current_monitor->cmd_delim)
147#define PROMPT (current_monitor->prompt)
51d6a954
RS
148#define TARGET_OPS (current_monitor->target)
149#define TARGET_NAME (current_monitor->target->to_shortname)
cf51c601
RS
150#define BAUDRATES (current_monitor->baudrates)
151#define STOPBITS (current_monitor->stopbits)
51d6a954
RS
152#define REGNAMES(x) (current_monitor->regnames[x])
153#define ROMCMD(x) (x.cmd)
154#define ROMDELIM(x) (x.delim)
155#define ROMRES(x) (x.result)
054240ec
RS
156
157#define push_monitor(x) current_monitor = x;
51d6a954 158
df3cf84a
RS
159#define SREC_SIZE 160
160
df3cf84a
RS
161/*
162 * FIXME: These are to temporarily maintain compatability with the
163 * old monitor structure till remote-mon.c is fixed to work
164 * like the *-rom.c files.
165 */
166#define MEM_PROMPT (current_monitor->loadtypes)
167#define MEM_SET_CMD (current_monitor->setmem)
168#define MEM_DIS_CMD (current_monitor->getmem)
169#define REG_DELIM (current_monitor->regset.delim)
32fa4b59 170
5de0c648
SG
171extern void monitor_open PARAMS ((char *args, struct monitor_ops *ops, int from_tty));
172extern char *monitor_supply_register PARAMS ((int regno, char *valstr));
173extern int monitor_expect PARAMS ((char *prompt, char *buf, int buflen));
174extern int monitor_expect_prompt PARAMS ((char *buf, int buflen));
e3033bb0
C
175extern void monitor_printf PARAMS ((char *, ...))
176 ATTR_FORMAT(printf, 1, 2);
177extern void monitor_printf_noecho PARAMS ((char *, ...))
178 ATTR_FORMAT(printf, 1, 2);
d108166f 179extern void init_monitor_ops PARAMS ((struct target_ops *));
This page took 0.221517 seconds and 4 git commands to generate.