* mdebugread.c (parse_symbol): If finishing a function without
[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
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
51d6a954
RS
25struct rom_cmd_data {
26 char *cmd; /* command to send */
27 char *delim; /* the delimiter */
28 char *result; /* the result */
29};
30
1265e2d8
SG
31/* This structure describes the strings necessary to give small command
32 sequences to the monitor, and parse the response.
33
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...
39
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.
46
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.
53
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.
57*/
58
59struct cmd_resp {
60 char *cmd; /* Command to send */
61 char *resp_delim; /* String just prior to the desired value */
62 char *term; /* Terminating string to search for */
63 char *term_cmd; /* String to get out of sub-mode (if necessary) */
64};
65
054240ec 66struct monitor_ops {
0b0669fe 67 int type; /* 1 is ascii, 0 is GDB remote protocol */
51d6a954 68 char *init; /* initialize to the monitor */
054240ec
RS
69 char *execute; /* execute or usually GO command */
70 char *resume; /* continue command */
71 char *step; /* single step */
72 char *set_break; /* set a breakpoint */
73 char *clr_break; /* clear a breakpoint */
7804e5bc 74 int clr_type; /* number or address for clearing */
1265e2d8
SG
75 struct cmd_resp setmem; /* set memory to a value */
76 struct cmd_resp getmem; /* display memory */
77 struct cmd_resp setreg; /* set a register */
78 struct cmd_resp getreg; /* get a register */
2081365f
SG
79 /* Some commands can dump a bunch of registers
80 at once. This comes as a set of REG=VAL
81 pairs. This should be called for each pair
82 of registers that we can parse to supply
83 GDB with the value of a register. */
84 char *register_pattern; /* Pattern that picks out register from reg dump */
85 void (*supply_register) PARAMS ((char *name, int namelen, char *val, int vallen));
51d6a954 86 char *load; /* load command */
054240ec
RS
87 char *prompt; /* monitor command prompt */
88 char *cmd_delim; /* end-of-command delimitor */
89 char *cmd_end; /* optional command terminator */
51d6a954 90 struct target_ops *target; /* target operations */
1265e2d8
SG
91 char **loadtypes; /* the load types that are supported */
92 char **loadprotos; /* the load protocols that are supported */
cf51c601
RS
93 char *baudrates; /* supported baud rates */
94 int stopbits; /* number of stop bits */
51d6a954 95 char **regnames; /* array of register names in ascii */
054240ec
RS
96};
97
98extern struct monitor_ops *current_monitor;
99
51d6a954
RS
100#define PROTO_TYPE (current_monitor->type)
101#define LOADTYPES (current_monitor->loadtypes)
b3b8d9bf 102#define LOADPROTOS (current_monitor->loadprotos)
51d6a954 103#define INIT_CMD (current_monitor->init)
054240ec
RS
104#define GO_CMD (current_monitor->execute)
105#define CONT_CMD (current_monitor->resume)
106#define STEP_CMD (current_monitor->step)
107#define SET_BREAK_CMD (current_monitor->set_break)
108#define CLR_BREAK_CMD (current_monitor->clr_break)
7804e5bc 109#define CLR_BREAK_ADDR (current_monitor->clr_type)
51d6a954
RS
110#define SET_MEM (current_monitor->setmem)
111#define GET_MEM (current_monitor->getmem)
054240ec 112#define LOAD_CMD (current_monitor->load)
51d6a954
RS
113#define GET_REG (current_monitor->regget)
114#define SET_REG (current_monitor->regset)
054240ec
RS
115#define CMD_END (current_monitor->cmd_end)
116#define CMD_DELIM (current_monitor->cmd_delim)
117#define PROMPT (current_monitor->prompt)
51d6a954
RS
118#define TARGET_OPS (current_monitor->target)
119#define TARGET_NAME (current_monitor->target->to_shortname)
cf51c601
RS
120#define BAUDRATES (current_monitor->baudrates)
121#define STOPBITS (current_monitor->stopbits)
51d6a954
RS
122#define REGNAMES(x) (current_monitor->regnames[x])
123#define ROMCMD(x) (x.cmd)
124#define ROMDELIM(x) (x.delim)
125#define ROMRES(x) (x.result)
054240ec
RS
126
127#define push_monitor(x) current_monitor = x;
51d6a954 128
df3cf84a 129#define SREC_SIZE 160
0b0669fe 130#define GDBPROTO ((current_monitor->type) ? 0: 1)
df3cf84a 131
df3cf84a
RS
132/*
133 * FIXME: These are to temporarily maintain compatability with the
134 * old monitor structure till remote-mon.c is fixed to work
135 * like the *-rom.c files.
136 */
137#define MEM_PROMPT (current_monitor->loadtypes)
138#define MEM_SET_CMD (current_monitor->setmem)
139#define MEM_DIS_CMD (current_monitor->getmem)
140#define REG_DELIM (current_monitor->regset.delim)
32fa4b59
SG
141
142extern void monitor_open PARAMS ((char *args, struct monitor_ops *ops, int from_tty));
2081365f 143extern char *monitor_supply_register PARAMS ((int regno, char *valstr));
This page took 0.140465 seconds and 4 git commands to generate.