* breakpoint.c, breakpoint.h (breakpoint_init_inferior): New function
[deliverable/binutils-gdb.git] / gdb / remote-utils.h
CommitLineData
c6f494e8
RP
1/* Generic support for remote debugging interfaces.
2
3 Copyright 1993 Free Software Foundation, Inc.
4
5This file is part of GDB.
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program; if not, write to the Free Software
19Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
20
21#ifndef REMOTE_UTILS_H
22#define REMOTE_UTILS_H
23
b70b042d 24#include "serial.h"
c6f494e8
RP
25#include "target.h"
26#include "dcache.h"
27
28/* Stuff that should be shared (and handled consistently) among the various
29 remote targets. */
30
31struct _sr_settings {
32 /* Debugging level. 0 is off, and non-zero values mean to print
33 some debug information (higher values, more information). */
34 unsigned int debug;
35
36 /* Baud rate specified for talking to remote target systems via a
37 serial port. */
38 unsigned int baud_rate;
39
40 unsigned int timeout;
41
42 int retries;
43
44 char *device;
45 serial_t desc;
46
47};
48
49extern struct _sr_settings sr_settings;
50
51/* get and set debug value. */
52#define sr_get_debug() (sr_settings.debug)
53#define sr_set_debug(newval) (sr_settings.debug = (newval))
54
55/* get and set baud rate. */
56#define sr_get_baud_rate() (sr_settings.baud_rate)
57#define sr_set_baud_rate(newval) (sr_settings.baud_rate = (newval))
58
59/* get and set timeout. */
60#define sr_get_timeout() (sr_settings.timeout)
61#define sr_set_timeout(newval) (sr_settings.timeout = (newval))
62
63/* get and set device. */
64#define sr_get_device() (sr_settings.device)
65#define sr_set_device(newval) \
66{ \
67 if (sr_settings.device) free(sr_settings.device); \
68 sr_settings.device = (newval); \
69}
70
71/* get and set descriptor value. */
72#define sr_get_desc() (sr_settings.desc)
73#define sr_set_desc(newval) (sr_settings.desc = (newval))
74
75/* get and set retries. */
76#define sr_get_retries() (sr_settings.retries)
77#define sr_set_retries(newval) (sr_settings.retries = (newval))
78
79#define sr_is_open() (sr_settings.desc != NULL)
80
81#define sr_check_open() { if (!sr_is_open()) \
82 error ("Remote device not open"); }
83
84struct gr_settings {
85 /* This is our data cache. */
86 DCACHE *dcache;
87 char *prompt;
88 struct target_ops *ops;
89 int (*clear_all_breakpoints)PARAMS((void));
90 memxferfunc readfunc;
91 memxferfunc writefunc;
92 void (*checkin)PARAMS((void));
93};
94
95extern struct gr_settings *gr_settings;
96
97/* get and set dcache. */
98#define gr_get_dcache() (gr_settings->dcache)
99#define gr_set_dcache(newval) (gr_settings->dcache = (newval))
100
101/* get and set prompt. */
102#define gr_get_prompt() (gr_settings->prompt)
103#define gr_set_prompt(newval) (gr_settings->prompt = (newval))
104
105/* get and set ops. */
106#define gr_get_ops() (gr_settings->ops)
107#define gr_set_ops(newval) (gr_settings->ops = (newval))
108
109#define gr_clear_all_breakpoints() ((gr_settings->clear_all_breakpoints)())
110#define gr_checkin() ((gr_settings->checkin)())
111
112/* Keep discarding input until we see the prompt.
113
114 The convention for dealing with the prompt is that you
115 o give your command
116 o *then* wait for the prompt.
117
118 Thus the last thing that a procedure does with the serial line
119 will be an gr_expect_prompt(). Exception: resume does not
120 wait for the prompt, because the terminal is being handed over
121 to the inferior. However, the next thing which happens after that
122 is a bug_wait which does wait for the prompt.
123 Note that this includes abnormal exit, e.g. error(). This is
124 necessary to prevent getting into states from which we can't
125 recover. */
126
127#define gr_expect_prompt() sr_expect(gr_get_prompt())
128
129int gr_fetch_word PARAMS((CORE_ADDR addr));
130int gr_multi_scan PARAMS((char *list[], int passthrough));
131int sr_get_hex_digit PARAMS((int ignore_space));
132int sr_pollchar PARAMS((void));
133int sr_readchar PARAMS((void));
134int sr_timed_read PARAMS((char *buf, int n));
135long sr_get_hex_word PARAMS((void));
136void gr_close PARAMS((int quitting));
137void gr_create_inferior PARAMS((char *execfile, char *args, char **env));
138void gr_detach PARAMS((char *args, int from_tty));
139void gr_files_info PARAMS((struct target_ops *ops));
140void gr_generic_checkin PARAMS((void));
141void gr_kill PARAMS((void));
142void gr_mourn PARAMS((void));
143void gr_prepare_to_store PARAMS((void));
144void gr_store_word PARAMS((CORE_ADDR addr, int word));
145void sr_expect PARAMS((char *string));
146void sr_get_hex_byte PARAMS((char *byt));
147void sr_scan_args PARAMS((char *proto, char *args));
148void sr_write PARAMS((char *a, int l));
149void sr_write_cr PARAMS((char *s));
150
151void gr_open PARAMS((char *args, int from_tty,
152 struct gr_settings *gr_settings));
153
154
155#endif /* REMOTE_UTILS_H */
This page took 0.031111 seconds and 4 git commands to generate.