Move stdio.h to common-defs.h
[external/binutils.git] / gdb / gdbserver / server.h
1 /* Common definitions for remote server for GDB.
2    Copyright (C) 1993-2014 Free Software Foundation, Inc.
3
4    This file is part of GDB.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
18
19 #ifndef SERVER_H
20 #define SERVER_H
21
22 #include "common-defs.h"
23
24 #ifdef __MINGW32CE__
25 #include "wincecompat.h"
26 #endif
27
28 #include "libiberty.h"
29 #include "ansidecl.h"
30 #include "version.h"
31
32 #include <stdarg.h>
33 #include <stdlib.h>
34 #ifdef HAVE_ERRNO_H
35 #include <errno.h>
36 #endif
37 #include <setjmp.h>
38
39 /* For gnulib's PATH_MAX.  */
40 #include "pathmax.h"
41
42 #include <string.h>
43
44 #ifdef HAVE_ALLOCA_H
45 #include <alloca.h>
46 #endif
47 /* On some systems such as MinGW, alloca is declared in malloc.h
48    (there is no alloca.h).  */
49 #if HAVE_MALLOC_H
50 #include <malloc.h>
51 #endif
52
53 #if !HAVE_DECL_STRERROR
54 #ifndef strerror
55 extern char *strerror (int);    /* X3.159-1989  4.11.6.2 */
56 #endif
57 #endif
58
59 #if !HAVE_DECL_PERROR
60 #ifndef perror
61 extern void perror (const char *);
62 #endif
63 #endif
64
65 #if !HAVE_DECL_VASPRINTF
66 extern int vasprintf(char **strp, const char *fmt, va_list ap);
67 #endif
68 #if !HAVE_DECL_VSNPRINTF
69 int vsnprintf(char *str, size_t size, const char *format, va_list ap);
70 #endif
71
72 #ifdef IN_PROCESS_AGENT
73 #  define PROG "ipa"
74 #else
75 #  define PROG "gdbserver"
76 #endif
77
78 /* A type used for binary buffers.  */
79 typedef unsigned char gdb_byte;
80
81 #include "ptid.h"
82 #include "buffer.h"
83 #include "xml-utils.h"
84 #include "gdb_locale.h"
85
86 /* FIXME: This should probably be autoconf'd for.  It's an integer type at
87    least the size of a (void *).  */
88 typedef unsigned long long CORE_ADDR;
89
90 typedef long long LONGEST;
91 typedef unsigned long long ULONGEST;
92
93 #include "regcache.h"
94 #include "gdb/signals.h"
95 #include "gdb_signals.h"
96 #include "target.h"
97 #include "mem-break.h"
98 #include "gdbthread.h"
99 #include "inferiors.h"
100
101 /* Target-specific functions */
102
103 void initialize_low ();
104
105 /* Public variables in server.c */
106
107 extern ptid_t cont_thread;
108 extern ptid_t general_thread;
109
110 extern int server_waiting;
111 extern int debug_hw_points;
112 extern int pass_signals[];
113 extern int program_signals[];
114 extern int program_signals_p;
115
116 extern jmp_buf toplevel;
117
118 extern int disable_packet_vCont;
119 extern int disable_packet_Tthread;
120 extern int disable_packet_qC;
121 extern int disable_packet_qfThreadInfo;
122
123 extern int run_once;
124 extern int multi_process;
125 extern int non_stop;
126
127 extern int disable_randomization;
128
129 #if USE_WIN32API
130 #include <winsock2.h>
131 typedef SOCKET gdb_fildes_t;
132 #else
133 typedef int gdb_fildes_t;
134 #endif
135
136 #include "event-loop.h"
137
138 /* Functions from server.c.  */
139 extern int handle_serial_event (int err, gdb_client_data client_data);
140 extern int handle_target_event (int err, gdb_client_data client_data);
141
142 #include "remote-utils.h"
143
144 #include "common-utils.h"
145 #include "utils.h"
146 #include "debug.h"
147
148 #include "gdb_assert.h"
149
150 /* Maximum number of bytes to read/write at once.  The value here
151    is chosen to fill up a packet (the headers account for the 32).  */
152 #define MAXBUFBYTES(N) (((N)-32)/2)
153
154 /* Buffer sizes for transferring memory, registers, etc.   Set to a constant
155    value to accomodate multiple register formats.  This value must be at least
156    as large as the largest register set supported by gdbserver.  */
157 #define PBUFSIZ 16384
158
159 #endif /* SERVER_H */