3 <title>GDB Internals
</title>
4 <meta http-equiv=
"Content-Type" content=
"text/html">
5 <meta name=
"description" content=
"GDB Internals">
6 <meta name=
"generator" content=
"makeinfo 4.3">
7 <link href=
"http://www.gnu.org/software/texinfo/" rel=
"generator-home">
12 Node:
<a name=
"Host%20Definition">Host Definition
</a>,
13 Next:
<a rel=
"next" accesskey=
"n" href=
"Target-Architecture-Definition.html#Target%20Architecture%20Definition">Target Architecture Definition
</a>,
14 Previous:
<a rel=
"previous" accesskey=
"p" href=
"Language-Support.html#Language%20Support">Language Support
</a>,
15 Up:
<a rel=
"up" accesskey=
"u" href=
"index.html#Top">Top
</a>
19 <h2 class=
"chapter">Host Definition
</h2>
21 <p>With the advent of Autoconf, it's rarely necessary to have host
22 definition machinery anymore. The following information is provided,
23 mainly, as an historical reference.
25 <h3 class=
"section">Adding a New Host
</h3>
27 GDB's host configuration support normally happens via Autoconf.
28 New host-specific definitions should not be needed. Older hosts
29 GDB still use the host-specific definitions and files listed
30 below, but these mostly exist for historical reasons, and will
34 <dt><code>gdb/config/
</code><var>arch
</var><code>/
</code><var>xyz
</var><code>.mh
</code>
35 <dd>This file once contained both host and native configuration information
36 (see
<a href=
"Native-Debugging.html#Native%20Debugging">Native Debugging
</a>) for the machine
<var>xyz
</var>. The host
37 configuration information is now handed by Autoconf.
39 <p>Host configuration information included a definition of
40 <code>XM_FILE=xm-
</code><var>xyz
</var><code>.h
</code> and possibly definitions for
<code>CC
</code>,
41 <code>SYSV_DEFINE
</code>,
<code>XM_CFLAGS
</code>,
<code>XM_ADD_FILES
</code>,
42 <code>XM_CLIBS
</code>,
<code>XM_CDEPS
</code>, etc.; see
<code>Makefile.in
</code>.
44 <p>New host only configurations do not need this file.
46 <br><dt><code>gdb/config/
</code><var>arch
</var><code>/xm-
</code><var>xyz
</var><code>.h
</code>
47 <dd>This file once contained definitions and includes required when hosting
48 gdb on machine
<var>xyz
</var>. Those definitions and includes are now
51 <p>New host and native configurations do not need this file.
53 <p><em>Maintainer's note: Some hosts continue to use the
</em><code>xm-xyz.h
</code><em>
54 file to define the macros
</em><var>HOST_FLOAT_FORMAT
</var><em>,
55 </em><var>HOST_DOUBLE_FORMAT
</var><em> and
</em><var>HOST_LONG_DOUBLE_FORMAT
</var><em>. That code
56 also needs to be replaced with either an Autoconf or run-time test.
</em>
60 <h4 class=
"subheading">Generic Host Support Files
</h4>
62 <p>There are some
"generic" versions of routines that can be used by
63 various systems. These can be customized in various ways by macros
64 defined in your
<code>xm-
</code><var>xyz
</var><code>.h
</code> file. If these routines work for
65 the
<var>xyz
</var> host, you can just include the generic file's name (with
66 <code>.o
</code>, not
<code>.c
</code>) in
<code>XDEPFILES
</code>.
68 <p>Otherwise, if your machine needs custom support routines, you will need
69 to write routines that perform the same functions as the generic file.
70 Put them into
<code></code><var>xyz
</var><code>-xdep.c
</code>, and put
<code></code><var>xyz
</var><code>-xdep.o
</code>
71 into
<code>XDEPFILES
</code>.
74 <dt><code>ser-unix.c
</code>
75 <dd>This contains serial line support for Unix systems. This is always
76 included, via the makefile variable
<code>SER_HARDWIRE
</code>; override this
77 variable in the
<code>.mh
</code> file to avoid it.
79 <br><dt><code>ser-go32.c
</code>
80 <dd>This contains serial line support for
32-bit programs running under DOS,
81 using the DJGPP (a.k.a. GO32) execution environment.
83 <br><dt><code>ser-tcp.c
</code>
84 <dd>This contains generic TCP support using sockets.
87 <h3 class=
"section">Host Conditionals
</h3>
89 <p>When GDB is configured and compiled, various macros are
90 defined or left undefined, to control compilation based on the
91 attributes of the host system. These macros and their meanings (or if
92 the meaning is not documented here, then one of the source files where
93 they are used is indicated) are:
96 <dt><code>GDBINIT_FILENAME
</code>
97 <dd>The default name of GDB's initialization file (normally
98 <code>.gdbinit
</code>).
100 <br><dt><code>NO_STD_REGS
</code>
101 <dd>This macro is deprecated.
103 <br><dt><code>NO_SYS_FILE
</code>
104 <dd>Define this if your system does not have a
<code><sys/file.h
></code>.
106 <br><dt><code>SIGWINCH_HANDLER
</code>
107 <dd>If your host defines
<code>SIGWINCH
</code>, you can define this to be the name
108 of a function to be called if
<code>SIGWINCH
</code> is received.
110 <br><dt><code>SIGWINCH_HANDLER_BODY
</code>
111 <dd>Define this to expand into code that will define the function named by
112 the expansion of
<code>SIGWINCH_HANDLER
</code>.
114 <br><dt><code>ALIGN_STACK_ON_STARTUP
</code>
115 <dd>Define this if your system is of a sort that will crash in
116 <code>tgetent
</code> if the stack happens not to be longword-aligned when
117 <code>main
</code> is called. This is a rare situation, but is known to occur
118 on several different types of systems.
120 <br><dt><code>CRLF_SOURCE_FILES
</code>
121 <dd>Define this if host files use
<code>\r\n
</code> rather than
<code>\n
</code> as a
122 line terminator. This will cause source file listings to omit
<code>\r
</code>
123 characters when printing and it will allow
<code>\r\n
</code> line endings of files
124 which are
"sourced" by gdb. It must be possible to open files in binary
125 mode using
<code>O_BINARY
</code> or, for fopen,
<code>"rb"</code>.
127 <br><dt><code>DEFAULT_PROMPT
</code>
128 <dd>The default value of the prompt string (normally
<code>"(gdb) "</code>).
130 <br><dt><code>DEV_TTY
</code>
131 <dd>The name of the generic TTY device, defaults to
<code>"/dev/tty"</code>.
133 <br><dt><code>FCLOSE_PROVIDED
</code>
134 <dd>Define this if the system declares
<code>fclose
</code> in the headers included
135 in
<code>defs.h
</code>. This isn't needed unless your compiler is unusually
138 <br><dt><code>FOPEN_RB
</code>
139 <dd>Define this if binary files are opened the same way as text files.
141 <br><dt><code>GETENV_PROVIDED
</code>
142 <dd>Define this if the system declares
<code>getenv
</code> in its headers included
143 in
<code>defs.h
</code>. This isn't needed unless your compiler is unusually
146 <br><dt><code>HAVE_MMAP
</code>
147 <dd>In some cases, use the system call
<code>mmap
</code> for reading symbol
148 tables. For some machines this allows for sharing and quick updates.
150 <br><dt><code>HAVE_TERMIO
</code>
151 <dd>Define this if the host system has
<code>termio.h
</code>.
153 <br><dt><code>INT_MAX
</code>
154 <dd><dt><code>INT_MIN
</code>
155 <dd><dt><code>LONG_MAX
</code>
156 <dd><dt><code>UINT_MAX
</code>
157 <dd><dt><code>ULONG_MAX
</code>
158 <dd>Values for host-side constants.
160 <br><dt><code>ISATTY
</code>
161 <dd>Substitute for isatty, if not available.
163 <br><dt><code>LONGEST
</code>
164 <dd>This is the longest integer type available on the host. If not defined,
165 it will default to
<code>long long
</code> or
<code>long
</code>, depending on
166 <code>CC_HAS_LONG_LONG
</code>.
168 <br><dt><code>CC_HAS_LONG_LONG
</code>
169 <dd>Define this if the host C compiler supports
<code>long long
</code>. This is set
170 by the
<code>configure
</code> script.
172 <br><dt><code>PRINTF_HAS_LONG_LONG
</code>
173 <dd>Define this if the host can handle printing of long long integers via
174 the printf format conversion specifier
<code>ll
</code>. This is set by the
175 <code>configure
</code> script.
177 <br><dt><code>HAVE_LONG_DOUBLE
</code>
178 <dd>Define this if the host C compiler supports
<code>long double
</code>. This is
179 set by the
<code>configure
</code> script.
181 <br><dt><code>PRINTF_HAS_LONG_DOUBLE
</code>
182 <dd>Define this if the host can handle printing of long double float-point
183 numbers via the printf format conversion specifier
<code>Lg
</code>. This is
184 set by the
<code>configure
</code> script.
186 <br><dt><code>SCANF_HAS_LONG_DOUBLE
</code>
187 <dd>Define this if the host can handle the parsing of long double
188 float-point numbers via the scanf format conversion specifier
189 <code>Lg
</code>. This is set by the
<code>configure
</code> script.
191 <br><dt><code>LSEEK_NOT_LINEAR
</code>
192 <dd>Define this if
<code>lseek (n)
</code> does not necessarily move to byte number
193 <code>n
</code> in the file. This is only used when reading source files. It
194 is normally faster to define
<code>CRLF_SOURCE_FILES
</code> when possible.
196 <br><dt><code>L_SET
</code>
197 <dd>This macro is used as the argument to
<code>lseek
</code> (or, most commonly,
198 <code>bfd_seek
</code>). FIXME, should be replaced by SEEK_SET instead,
199 which is the POSIX equivalent.
201 <br><dt><code>MMAP_BASE_ADDRESS
</code>
202 <dd>When using HAVE_MMAP, the first mapping should go at this address.
204 <br><dt><code>MMAP_INCREMENT
</code>
205 <dd>when using HAVE_MMAP, this is the increment between mappings.
207 <br><dt><code>NORETURN
</code>
208 <dd>If defined, this should be one or more tokens, such as
<code>volatile
</code>,
209 that can be used in both the declaration and definition of functions to
210 indicate that they never return. The default is already set correctly
211 if compiling with GCC. This will almost never need to be defined.
213 <br><dt><code>ATTR_NORETURN
</code>
214 <dd>If defined, this should be one or more tokens, such as
215 <code>__attribute__ ((noreturn))
</code>, that can be used in the declarations
216 of functions to indicate that they never return. The default is already
217 set correctly if compiling with GCC. This will almost never need to be
220 <br><dt><code>USE_GENERIC_DUMMY_FRAMES
</code>
221 <dd>Define this to
1 if the target is using the generic inferior function
222 call code. See
<code>blockframe.c
</code> for more information.
224 <br><dt><code>USE_MMALLOC
</code>
225 <dd>GDB will use the
<code>mmalloc
</code> library for memory allocation
226 for symbol reading if this symbol is defined. Be careful defining it
227 since there are systems on which
<code>mmalloc
</code> does not work for some
228 reason. One example is the DECstation, where its RPC library can't
229 cope with our redefinition of
<code>malloc
</code> to call
<code>mmalloc
</code>.
230 When defining
<code>USE_MMALLOC
</code>, you will also have to set
231 <code>MMALLOC
</code> in the Makefile, to point to the
<code>mmalloc
</code> library. This
232 define is set when you configure with
<code>--with-mmalloc
</code>.
234 <br><dt><code>NO_MMCHECK
</code>
235 <dd>Define this if you are using
<code>mmalloc
</code>, but don't want the overhead
236 of checking the heap with
<code>mmcheck
</code>. Note that on some systems,
237 the C runtime makes calls to
<code>malloc
</code> prior to calling
<code>main
</code>, and if
238 <code>free
</code> is ever called with these pointers after calling
239 <code>mmcheck
</code> to enable checking, a memory corruption abort is certain
240 to occur. These systems can still use
<code>mmalloc
</code>, but must define
241 <code>NO_MMCHECK
</code>.
243 <br><dt><code>MMCHECK_FORCE
</code>
244 <dd>Define this to
1 if the C runtime allocates memory prior to
245 <code>mmcheck
</code> being called, but that memory is never freed so we don't
246 have to worry about it triggering a memory corruption abort. The
247 default is
0, which means that
<code>mmcheck
</code> will only install the heap
248 checking functions if there has not yet been any memory allocation
249 calls, and if it fails to install the functions, GDB will issue a
250 warning. This is currently defined if you configure using
251 <code>--with-mmalloc
</code>.
253 <br><dt><code>NO_SIGINTERRUPT
</code>
254 <dd>Define this to indicate that
<code>siginterrupt
</code> is not available.
256 <br><dt><code>SEEK_CUR
</code>
257 <dd><dt><code>SEEK_SET
</code>
258 <dd>Define these to appropriate value for the system
<code>lseek
</code>, if not already
261 <br><dt><code>STOP_SIGNAL
</code>
262 <dd>This is the signal for stopping GDB. Defaults to
263 <code>SIGTSTP
</code>. (Only redefined for the Convex.)
265 <br><dt><code>USE_O_NOCTTY
</code>
266 <dd>Define this if the interior's tty should be opened with the
<code>O_NOCTTY
</code>
267 flag. (FIXME: This should be a native-only flag, but
<code>inflow.c
</code> is
270 <br><dt><code>USG
</code>
271 <dd>Means that System V (prior to SVR4) include files are in use. (FIXME:
272 This symbol is abused in
<code>infrun.c
</code>,
<code>regex.c
</code>,
273 <code>remote-nindy.c
</code>, and
<code>utils.c
</code> for other things, at the
276 <br><dt><code>lint
</code>
277 <dd>Define this to help placate
<code>lint
</code> in some situations.
279 <br><dt><code>volatile
</code>
280 <dd>Define this to override the defaults of
<code>__volatile__
</code> or