1 /* Generic support for remote debugging interfaces.
3 Copyright 1993 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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. */
22 #ifndef REMOTE_UTILS_H
23 #define REMOTE_UTILS_H
29 /* Stuff that should be shared (and handled consistently) among the various
43 extern struct _sr_settings sr_settings;
45 /* get and set debug value. */
46 #define sr_get_debug() (remote_debug)
47 #define sr_set_debug(newval) (remote_debug = (newval))
49 /* get and set timeout. */
50 #define sr_get_timeout() (sr_settings.timeout)
51 #define sr_set_timeout(newval) (sr_settings.timeout = (newval))
53 /* get and set device. */
54 #define sr_get_device() (sr_settings.device)
55 #define sr_set_device(newval) \
57 if (sr_settings.device) free(sr_settings.device); \
58 sr_settings.device = (newval); \
61 /* get and set descriptor value. */
62 #define sr_get_desc() (sr_settings.desc)
63 #define sr_set_desc(newval) (sr_settings.desc = (newval))
65 /* get and set retries. */
66 #define sr_get_retries() (sr_settings.retries)
67 #define sr_set_retries(newval) (sr_settings.retries = (newval))
69 #define sr_is_open() (sr_settings.desc != NULL)
71 #define sr_check_open() { if (!sr_is_open()) \
72 error ("Remote device not open"); }
76 /* This is our data cache. */
79 struct target_ops *ops;
80 int (*clear_all_breakpoints) (void);
82 memxferfunc writefunc;
83 void (*checkin) (void);
86 extern struct gr_settings *gr_settings;
88 /* get and set dcache. */
89 #define gr_get_dcache() (gr_settings->dcache)
90 #define gr_set_dcache(newval) (gr_settings->dcache = (newval))
92 /* get and set prompt. */
93 #define gr_get_prompt() (gr_settings->prompt)
94 #define gr_set_prompt(newval) (gr_settings->prompt = (newval))
96 /* get and set ops. */
97 #define gr_get_ops() (gr_settings->ops)
98 #define gr_set_ops(newval) (gr_settings->ops = (newval))
100 #define gr_clear_all_breakpoints() ((gr_settings->clear_all_breakpoints)())
101 #define gr_checkin() ((gr_settings->checkin)())
103 /* Keep discarding input until we see the prompt.
105 The convention for dealing with the prompt is that you
107 o *then* wait for the prompt.
109 Thus the last thing that a procedure does with the serial line
110 will be an gr_expect_prompt(). Exception: resume does not
111 wait for the prompt, because the terminal is being handed over
112 to the inferior. However, the next thing which happens after that
113 is a bug_wait which does wait for the prompt.
114 Note that this includes abnormal exit, e.g. error(). This is
115 necessary to prevent getting into states from which we can't
118 #define gr_expect_prompt() sr_expect(gr_get_prompt())
120 int gr_multi_scan (char *list[], int passthrough);
121 int sr_get_hex_digit (int ignore_space);
122 int sr_pollchar (void);
123 int sr_readchar (void);
124 int sr_timed_read (char *buf, int n);
125 long sr_get_hex_word (void);
126 void gr_close (int quitting);
127 void gr_create_inferior (char *execfile, char *args, char **env);
128 void gr_detach (char *args, int from_tty);
129 void gr_files_info (struct target_ops *ops);
130 void gr_generic_checkin (void);
132 void gr_mourn (void);
133 void gr_prepare_to_store (void);
134 void sr_expect (char *string);
135 void sr_get_hex_byte (char *byt);
136 void sr_scan_args (char *proto, char *args);
137 void sr_write (char *a, int l);
138 void sr_write_cr (char *s);
140 void gr_open (char *args, int from_tty, struct gr_settings *gr_settings);
141 void gr_load_image (char *, int from_tty);
142 #endif /* REMOTE_UTILS_H */