* Makefile.in (idecode.o, op_utils.o, semantics.o, simops.o):
[deliverable/binutils-gdb.git] / gdb / remote-utils.h
CommitLineData
c906108c
SS
1/* Generic support for remote debugging interfaces.
2
b6ba6518 3 Copyright 1993, 1994, 2000, 2001 Free Software Foundation, Inc.
c906108c 4
c5aa993b 5 This file is part of GDB.
c906108c 6
c5aa993b
JM
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
c906108c 11
c5aa993b
JM
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
c906108c 16
c5aa993b
JM
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
c906108c
SS
21
22#ifndef REMOTE_UTILS_H
23#define REMOTE_UTILS_H
24
25#include "serial.h"
26#include "target.h"
c906108c
SS
27
28/* Stuff that should be shared (and handled consistently) among the various
29 remote targets. */
30
c5aa993b
JM
31struct _sr_settings
32 {
33 unsigned int timeout;
c906108c 34
c5aa993b 35 int retries;
c906108c 36
c5aa993b
JM
37 char *device;
38 serial_t desc;
c906108c 39
c5aa993b 40 };
c906108c
SS
41
42extern struct _sr_settings sr_settings;
43
44/* get and set debug value. */
45#define sr_get_debug() (remote_debug)
46#define sr_set_debug(newval) (remote_debug = (newval))
47
48/* get and set timeout. */
49#define sr_get_timeout() (sr_settings.timeout)
50#define sr_set_timeout(newval) (sr_settings.timeout = (newval))
51
52/* get and set device. */
53#define sr_get_device() (sr_settings.device)
54#define sr_set_device(newval) \
55{ \
338d7c5c 56 if (sr_settings.device) xfree (sr_settings.device); \
c906108c
SS
57 sr_settings.device = (newval); \
58}
59
60/* get and set descriptor value. */
61#define sr_get_desc() (sr_settings.desc)
62#define sr_set_desc(newval) (sr_settings.desc = (newval))
63
64/* get and set retries. */
65#define sr_get_retries() (sr_settings.retries)
66#define sr_set_retries(newval) (sr_settings.retries = (newval))
67
68#define sr_is_open() (sr_settings.desc != NULL)
69
70#define sr_check_open() { if (!sr_is_open()) \
71 error ("Remote device not open"); }
72
c5aa993b
JM
73struct gr_settings
74 {
c5aa993b
JM
75 char *prompt;
76 struct target_ops *ops;
507f3c78 77 int (*clear_all_breakpoints) (void);
507f3c78 78 void (*checkin) (void);
c5aa993b 79 };
c906108c
SS
80
81extern struct gr_settings *gr_settings;
82
c906108c
SS
83/* get and set prompt. */
84#define gr_get_prompt() (gr_settings->prompt)
85#define gr_set_prompt(newval) (gr_settings->prompt = (newval))
86
87/* get and set ops. */
88#define gr_get_ops() (gr_settings->ops)
89#define gr_set_ops(newval) (gr_settings->ops = (newval))
90
91#define gr_clear_all_breakpoints() ((gr_settings->clear_all_breakpoints)())
92#define gr_checkin() ((gr_settings->checkin)())
93
94/* Keep discarding input until we see the prompt.
95
96 The convention for dealing with the prompt is that you
97 o give your command
98 o *then* wait for the prompt.
99
100 Thus the last thing that a procedure does with the serial line
101 will be an gr_expect_prompt(). Exception: resume does not
102 wait for the prompt, because the terminal is being handed over
103 to the inferior. However, the next thing which happens after that
104 is a bug_wait which does wait for the prompt.
105 Note that this includes abnormal exit, e.g. error(). This is
106 necessary to prevent getting into states from which we can't
107 recover. */
108
109#define gr_expect_prompt() sr_expect(gr_get_prompt())
110
a14ed312
KB
111int gr_multi_scan (char *list[], int passthrough);
112int sr_get_hex_digit (int ignore_space);
113int sr_pollchar (void);
114int sr_readchar (void);
115int sr_timed_read (char *buf, int n);
116long sr_get_hex_word (void);
117void gr_close (int quitting);
118void gr_create_inferior (char *execfile, char *args, char **env);
119void gr_detach (char *args, int from_tty);
120void gr_files_info (struct target_ops *ops);
121void gr_generic_checkin (void);
122void gr_kill (void);
123void gr_mourn (void);
124void gr_prepare_to_store (void);
a14ed312
KB
125void sr_expect (char *string);
126void sr_get_hex_byte (char *byt);
127void sr_scan_args (char *proto, char *args);
128void sr_write (char *a, int l);
129void sr_write_cr (char *s);
130
131void gr_open (char *args, int from_tty, struct gr_settings *gr_settings);
132void gr_load_image (char *, int from_tty);
c906108c 133#endif /* REMOTE_UTILS_H */
This page took 0.119073 seconds and 4 git commands to generate.