da907fbd1969efa542023309b7f621ba3157ceff
[binutils-gdb.git] / gdb / doc / gdbint.texinfo
1 \input texinfo
2 @setfilename gdbint.info
3 @c $Id$
4
5 @ifinfo
6 @format
7 START-INFO-DIR-ENTRY
8 * Gdb-Internals: (gdbint). The GNU debugger's internals.
9 END-INFO-DIR-ENTRY
10 @end format
11 @end ifinfo
12
13 @ifinfo
14 This file documents the internals of the GNU debugger GDB.
15
16 Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
17 Contributed by Cygnus Support. Written by John Gilmore.
18
19 Permission is granted to make and distribute verbatim copies of
20 this manual provided the copyright notice and this permission notice
21 are preserved on all copies.
22
23 @ignore
24 Permission is granted to process this file through Tex and print the
25 results, provided the printed document carries copying permission
26 notice identical to this one except for the removal of this paragraph
27 (this paragraph not being relevant to the printed manual).
28
29 @end ignore
30 Permission is granted to copy or distribute modified versions of this
31 manual under the terms of the GPL (for which purpose this text may be
32 regarded as a program in the language TeX).
33 @end ifinfo
34
35 @setchapternewpage off
36 @settitle GDB Internals
37 @titlepage
38 @title{Working in GDB}
39 @subtitle{A guide to the internals of the GNU debugger}
40 @author John Gilmore
41 @author Cygnus Support
42 @page
43 @tex
44 \def\$#1${{#1}} % Kluge: collect RCS revision info without $...$
45 \xdef\manvers{\$Revision$} % For use in headers, footers too
46 {\parskip=0pt
47 \hfill Cygnus Support\par
48 \hfill \manvers\par
49 \hfill \TeX{}info \texinfoversion\par
50 }
51 @end tex
52
53 @vskip 0pt plus 1filll
54 Copyright @copyright{} 1990, 1991, 1992 Free Software Foundation, Inc.
55
56 Permission is granted to make and distribute verbatim copies of
57 this manual provided the copyright notice and this permission notice
58 are preserved on all copies.
59
60 @end titlepage
61
62 @node Top
63 @top
64 This documents the internals of the GNU debugger, GDB. It is a
65 collection of miscellaneous information with little form at this point.
66 Mostly, it is a repository into which you can put information about
67 GDB as you discover it (or as you design changes to GDB).
68
69 @menu
70 * README:: The README File
71 * New Architectures:: Defining a New Host or Target Architecture
72 * Config:: Adding a New Configuration
73 * Host:: Adding a New Host
74 * Native:: Adding a New Native Configuration
75 * Target:: Adding a New Target
76 * Languages:: Defining New Source Languages
77 * Releases:: Configuring GDB for Release
78 * Partial Symbol Tables:: How GDB reads symbols quickly at startup
79 * BFD support for GDB:: How BFD and GDB interface
80 * Symbol Reading:: Defining New Symbol Readers
81 * Cleanups:: Cleanups
82 * Wrapping:: Wrapping Output Lines
83 * Frames:: Keeping track of function calls
84 * Coding Style:: Strunk and White for GDB maintainers
85 * Clean Design:: Frank Lloyd Wright for GDB maintainers
86 * Submitting Patches:: How to get your changes into GDB releases
87 * Host Conditionals:: What features exist in the host
88 * Target Conditionals:: What features exist in the target
89 * Native Conditionals:: Conditionals for when host and target are same
90 * Obsolete Conditionals:: Conditionals that don't exist any more
91
92 @end menu
93
94 @node README
95 @chapter The @file{README} File
96
97 Check the @file{README} file, it often has useful information that does not
98 appear anywhere else in the directory.
99
100
101 @node New Architectures
102 @chapter Defining a New Host or Target Architecture
103
104 When building support for a new host and/or target, much of the work you
105 need to do is handled by specifying configuration files;
106 @pxref{Config,,Adding a New Configuration}. Further work can be
107 divided into ``host-dependent'' (@pxref{Host,,Adding a New Host}) and
108 ``target-dependent'' (@pxref{Target,,Adding a New Target}). The
109 following discussion is meant to explain the difference between hosts
110 and targets.
111
112 @heading What is considered ``host-dependent'' versus ``target-dependent''?
113
114 @dfn{Host} refers to attributes of the system where GDB runs.
115 @dfn{Target} refers to the system where the program being debugged
116 executes. In most cases they are the same machine, in which case
117 a third type of @dfn{Native} attributes come into play.
118
119 Defines and include files needed to build on the host are host support.
120 Examples are tty support, system defined types, host byte order, host
121 float format.
122
123 Defines and information needed to handle the target format are target
124 dependent. Examples are the stack frame format, instruction set,
125 breakpoint instruction, registers, and how to set up and tear down the stack
126 to call a function.
127
128 Information that is only needed when the host and target are the same,
129 is native dependent. One example is Unix child process support; if the
130 host and target are not the same, doing a fork to start the target
131 process is a bad idea. The various macros needed for finding the
132 registers in the @code{upage}, running @code{ptrace}, and such are all in the
133 native-dependent files.
134
135 Another example of native-dependent code is support for features
136 that are really part of the target environment, but which require
137 @code{#include} files that are only available on the host system.
138 Core file handling and @code{setjmp} handling are two common cases.
139
140 When you want to make GDB work ``native'' on a particular
141 machine, you have to include all three kinds of information.
142
143 The dependent information in GDB is organized into files by naming
144 conventions.
145
146 Host-Dependent Files
147 @table @file
148 @item config/*.mh
149 Sets Makefile parameters
150 @item xm-*.h
151 Global #include's and #define's and definitions
152 @item *-xdep.c
153 Global variables and functions
154 @end table
155
156 Native-Dependent Files
157 @table @file
158 @item config/*.mh
159 Sets Makefile parameters (for @emph{both} host and native)
160 @item nm-*.h
161 #include's and #define's and definitions. This file
162 is only included by the small number of modules that need it,
163 so beware of doing feature-test #define's from its macros.
164 @item *-nat.c
165 global variables and functions
166 @end table
167
168 Target-Dependent Files
169 @table @file
170 @item config/*.mt
171 Sets Makefile parameters
172 @item tm-*.h
173 Global #include's and #define's and definitions
174 @item *-tdep.c
175 Global variables and functions
176 @end table
177
178 At this writing, most supported hosts have had their host and native
179 dependencies sorted out properly. There are a few stragglers, which
180 can be recognized by the absence of NATDEPFILES lines in their
181 @file{config/*.mh}.
182
183 @node Config
184 @chapter Adding a New Configuration
185
186 Most of the work in making GDB compile on a new machine is in specifying
187 the configuration of the machine. This is done in a dizzying variety of
188 header files and configuration scripts, which we hope to make more
189 sensible soon. Let's say your new host is called an @var{xxx} (e.g.
190 @samp{sun4}), and its full three-part configuration name is
191 @code{@var{xarch}-@var{xvend}-@var{xos}} (e.g. @samp{sparc-sun-sunos4}). In
192 particular:
193
194 In the top level directory, edit @file{config.sub} and add @var{xarch},
195 @var{xvend}, and @var{xos} to the lists of supported architectures,
196 vendors, and operating systems near the bottom of the file. Also, add
197 @var{xxx} as an alias that maps to
198 @code{@var{xarch}-@var{xvend}-@var{xos}}. You can test your changes by
199 running
200
201 @example
202 ./config.sub @var{xxx}
203 @end example
204 @noindent
205 and
206 @example
207 ./config.sub @code{@var{xarch}-@var{xvend}-@var{xos}}
208 @end example
209 @noindent
210 which should both respond with @code{@var{xarch}-@var{xvend}-@var{xos}}
211 and no error messages.
212
213 Now, go to the @file{bfd} directory and
214 create a new file @file{bfd/hosts/h-@var{xxx}.h}. Examine the
215 other @file{h-*.h} files as templates, and create one that brings in the
216 right include files for your system, and defines any host-specific
217 macros needed by BFD, the Binutils, GNU LD, or the Opcodes directories.
218 (They all share the bfd @file{hosts} directory and the @file{configure.host}
219 file.)
220
221 Then edit @file{bfd/configure.host}. Add a line to recognize your
222 @code{@var{xarch}-@var{xvend}-@var{xos}} configuration, and set
223 @code{my_host} to @var{xxx} when you recognize it. This will cause your
224 file @file{h-@var{xxx}.h} to be linked to @file{sysdep.h} at configuration
225 time. When creating the line that recognizes your configuration,
226 only match the fields that you really need to match; e.g. don't match
227 match the architecture or manufacturer if the OS is sufficient
228 to distinguish the configuration that your @file{h-@var{xxx}.h} file supports.
229 Don't match the manufacturer name unless you really need to.
230 This should make future ports easier.
231
232 Also, if this host requires any changes to the Makefile, create a file
233 @file{bfd/config/@var{xxx}.mh}, which includes the required lines.
234
235 It's possible that the @file{libiberty} and @file{readline} directories
236 won't need any changes for your configuration, but if they do, you can
237 change the @file{configure.in} file there to recognize your system and
238 map to an @file{mh-@var{xxx}} file. Then add @file{mh-@var{xxx}}
239 to the @file{config/} subdirectory, to set any makefile variables you
240 need. The only current options in there are things like @samp{-DSYSV}.
241 (This @file{mh-@var{xxx}} naming convention differs from elsewhere
242 in GDB, by historical accident. It should be cleaned up so that all
243 such files are called @file{@var{xxx}.mh}.)
244
245 Aha! Now to configure GDB itself! Edit
246 @file{gdb/configure.in} to recognize your system and set @code{gdb_host}
247 to @var{xxx}, and (unless your desired target is already available) also
248 set @code{gdb_target} to something appropriate (for instance,
249 @var{xxx}). To handle new hosts, modify the segment after the comment
250 @samp{# per-host}; to handle new targets, modify after @samp{#
251 per-target}.
252 @c Would it be simpler to just use different per-host and per-target
253 @c *scripts*, and call them from {configure} ?
254
255 Finally, you'll need to specify and define GDB's host-, native-, and
256 target-dependent @file{.h} and @file{.c} files used for your
257 configuration; the next two chapters discuss those.
258
259
260 @node Host
261 @chapter Adding a New Host
262
263 Once you have specified a new configuration for your host
264 (@pxref{Config,,Adding a New Configuration}), there are three remaining
265 pieces to making GDB work on a new machine. First, you have to make it
266 host on the new machine (compile there, handle that machine's terminals
267 properly, etc). If you will be cross-debugging to some other kind of
268 system that's already supported, you are done.
269
270 If you want to use GDB to debug programs that run on the new machine,
271 you have to get it to understand the machine's object files, symbol
272 files, and interfaces to processes; @pxref{Target,,Adding a New Target}
273 and @pxref{Native,,Adding a New Native Configuration}
274
275 Several files control GDB's configuration for host systems:
276
277 @table @file
278 @item gdb/config/mh-@var{xxx}
279 Specifies Makefile fragments needed when hosting on machine @var{xxx}.
280 In particular, this lists the required machine-dependent object files,
281 by defining @samp{XDEPFILES=@dots{}}. Also
282 specifies the header file which describes host @var{xxx}, by defining
283 @samp{XM_FILE= xm-@var{xxx}.h}. You can also define @samp{CC},
284 @samp{REGEX} and @samp{REGEX1}, @samp{SYSV_DEFINE}, @samp{XM_CFLAGS},
285 @samp{XM_ADD_FILES}, @samp{XM_CLIBS}, @samp{XM_CDEPS},
286 etc.; see @file{Makefile.in}.
287
288 @item gdb/xm-@var{xxx}.h
289 (@file{xm.h} is a link to this file, created by configure).
290 Contains C macro definitions describing the host system environment,
291 such as byte order, host C compiler and library, ptrace support,
292 and core file structure. Crib from existing @file{xm-*.h} files
293 to create a new one.
294
295 @item gdb/@var{xxx}-xdep.c
296 Contains any miscellaneous C code required for this machine
297 as a host. On many machines it doesn't exist at all. If it does
298 exist, put @file{@var{xxx}-xdep.o} into the @code{XDEPFILES} line
299 in @file{gdb/config/mh-@var{xxx}}.
300 @end table
301
302 @subheading Generic Host Support Files
303
304 There are some ``generic'' versions of routines that can be used by
305 various systems. These can be customized in various ways by macros
306 defined in your @file{xm-@var{xxx}.h} file. If these routines work for
307 the @var{xxx} host, you can just include the generic file's name (with
308 @samp{.o}, not @samp{.c}) in @code{XDEPFILES}.
309
310 Otherwise, if your machine needs custom support routines, you will need
311 to write routines that perform the same functions as the generic file.
312 Put them into @code{@var{xxx}-xdep.c}, and put @code{@var{xxx}-xdep.o}
313 into @code{XDEPFILES}.
314
315 @table @file
316 @item ser-bsd.c
317 This contains serial line support for Berkeley-derived Unix systems.
318
319 @item ser-go32.c
320 This contains serial line support for 32-bit programs running under DOS
321 using the GO32 execution environment.
322
323 @item ser-termios.c
324 This contains serial line support for System V-derived Unix systems.
325 @end table
326
327 Now, you are now ready to try configuring GDB to compile using your system
328 as its host. From the top level (above @file{bfd}, @file{gdb}, etc), do:
329
330 @example
331 ./configure @var{xxx} +target=vxworks960
332 @end example
333
334 This will configure your system to cross-compile for VxWorks on
335 the Intel 960, which is probably not what you really want, but it's
336 a test case that works at this stage. (You haven't set up to be
337 able to debug programs that run @emph{on} @var{xxx} yet.)
338
339 If this succeeds, you can try building it all with:
340
341 @example
342 make
343 @end example
344
345 Repeat until the program configures, compiles, links, and runs.
346 When run, it won't be able to do much (unless you have a VxWorks/960
347 board on your network) but you will know that the host support is
348 pretty well done.
349
350 Good luck! Comments and suggestions about this section are particularly
351 welcome; send them to @samp{bug-gdb@@prep.ai.mit.edu}.
352
353 @node Native
354 @chapter Adding a New Native Configuration
355
356 If you are making GDB run native on the @var{xxx} machine, you have
357 plenty more work to do. Several files control GDB's configuration for
358 native support:
359
360 @table @file
361 @item gdb/config/@var{xxx}.mh
362 Specifies Makefile fragments needed when hosting @emph{or native}
363 on machine @var{xxx}.
364 In particular, this lists the required native-dependent object files,
365 by defining @samp{NATDEPFILES=@dots{}}. Also
366 specifies the header file which describes native support on @var{xxx},
367 by defining @samp{NM_FILE= nm-@var{xxx}.h}.
368 You can also define @samp{NAT_CFLAGS},
369 @samp{NAT_ADD_FILES}, @samp{NAT_CLIBS}, @samp{NAT_CDEPS},
370 etc.; see @file{Makefile.in}.
371
372 @item gdb/nm-@var{xxx}.h
373 (@file{nm.h} is a link to this file, created by configure).
374 Contains C macro definitions describing the native system environment,
375 such as child process control and core file support.
376 Crib from existing @file{nm-*.h} files to create a new one.
377
378 @item gdb/@var{xxx}-nat.c
379 Contains any miscellaneous C code required for this native support
380 of this machine. On some machines it doesn't exist at all.
381 @end table
382
383 @subheading Generic Native Support Files
384
385 There are some ``generic'' versions of routines that can be used by
386 various systems. These can be customized in various ways by macros
387 defined in your @file{nm-@var{xxx}.h} file. If these routines work for
388 the @var{xxx} host, you can just include the generic file's name (with
389 @samp{.o}, not @samp{.c}) in @code{NATDEPFILES}.
390
391 Otherwise, if your machine needs custom support routines, you will need
392 to write routines that perform the same functions as the generic file.
393 Put them into @code{@var{xxx}-nat.c}, and put @code{@var{xxx}-nat.o}
394 into @code{NATDEPFILES}.
395
396 @table @file
397
398 @item inftarg.c
399 This contains the @emph{target_ops vector} that supports Unix child
400 processes on systems which use ptrace and wait to control the child.
401
402 @item procfs.c
403 This contains the @emph{target_ops vector} that supports Unix child
404 processes on systems which use /proc to control the child.
405
406 @item fork-child.c
407 This does the low-level grunge that uses Unix system calls
408 to do a "fork and exec" to start up a child process.
409
410 @item infptrace.c
411 This is the low level interface to inferior processes for systems
412 using the Unix @code{ptrace} call in a vanilla way.
413
414 @item coredep.c::fetch_core_registers()
415 Support for reading registers out of a core file. This routine calls
416 @code{register_addr()}, see below.
417 Now that BFD is used to read core files, virtually all machines should
418 use @code{coredep.c}, and should just provide @code{fetch_core_registers} in
419 @code{@var{xxx}-nat.c} (or @code{REGISTER_U_ADDR} in @code{nm-@var{xxx}.h}).
420
421 @item coredep.c::register_addr()
422 If your @code{nm-@var{xxx}.h} file defines the macro
423 @code{REGISTER_U_ADDR(addr, blockend, regno)}, it should be defined to
424 set @code{addr} to the offset within the @samp{user}
425 struct of GDB register number @code{regno}. @code{blockend} is the
426 offset within the ``upage'' of @code{u.u_ar0}.
427 If @code{REGISTER_U_ADDR} is defined,
428 @file{coredep.c} will define the @code{register_addr()} function and use
429 the macro in it. If you do not define @code{REGISTER_U_ADDR}, but you
430 are using the standard @code{fetch_core_registers()}, you will need to
431 define your own version of @code{register_addr()}, put it into your
432 @code{@var{xxx}-nat.c} file, and be sure @code{@var{xxx}-nat.o} is in
433 the @code{NATDEPFILES} list. If you have your own
434 @code{fetch_core_registers()}, you may not need a separate
435 @code{register_addr()}. Many custom @code{fetch_core_registers()}
436 implementations simply locate the registers themselves.@refill
437 @end table
438
439 When making GDB run native on a new operating system,
440 to make it possible to debug
441 core files, you will need to either write specific code for parsing your
442 OS's core files, or customize @file{bfd/trad-core.c}. First, use
443 whatever @code{#include} files your machine uses to define the struct of
444 registers that is accessible (possibly in the u-area) in a core file
445 (rather than @file{machine/reg.h}), and an include file that defines whatever
446 header exists on a core file (e.g. the u-area or a @samp{struct core}). Then
447 modify @code{trad_unix_core_file_p()} to use these values to set up the
448 section information for the data segment, stack segment, any other
449 segments in the core file (perhaps shared library contents or control
450 information), ``registers'' segment, and if there are two discontiguous
451 sets of registers (e.g. integer and float), the ``reg2'' segment. This
452 section information basically delimits areas in the core file in a
453 standard way, which the section-reading routines in BFD know how to seek
454 around in.
455
456 Then back in GDB, you need a matching routine called
457 @code{fetch_core_registers()}. If you can use the generic one, it's in
458 @file{coredep.c}; if not, it's in your @file{@var{xxx}-nat.c} file.
459 It will be passed a char pointer to the entire ``registers'' segment,
460 its length, and a zero; or a char pointer to the entire ``regs2''
461 segment, its length, and a 2. The routine should suck out the supplied
462 register values and install them into GDB's ``registers'' array.
463 (@xref{New Architectures,,Defining a New Host or Target Architecture},
464 for more info about this.)
465
466 If your system uses @file{/proc} to control processes, and uses ELF
467 format core files, then you may be able to use the same routines
468 for reading the registers out of processes and out of core files.
469
470 @node Target
471 @chapter Adding a New Target
472
473 For a new target called @var{ttt}, first specify the configuration as
474 described in @ref{Config,,Adding a New Configuration}. If your new
475 target is the same as your new host, you've probably already done that.
476
477 A variety of files specify attributes of the GDB target environment:
478
479 @table @file
480 @item gdb/config/@var{ttt}.mt
481 Contains a Makefile fragment specific to this target.
482 Specifies what object files are needed for target @var{ttt}, by
483 defining @samp{TDEPFILES=@dots{}}.
484 Also specifies the header file which describes @var{ttt}, by defining
485 @samp{TM_FILE= tm-@var{ttt}.h}. You can also define @samp{TM_CFLAGS},
486 @samp{TM_CLIBS}, @samp{TM_CDEPS},
487 and other Makefile variables here; see @file{Makefile.in}.
488
489 @item gdb/tm-@var{ttt}.h
490 (@file{tm.h} is a link to this file, created by configure).
491 Contains macro definitions about the target machine's
492 registers, stack frame format and instructions.
493 Crib from existing @file{tm-*.h} files when building a new one.
494
495 @item gdb/@var{ttt}-tdep.c
496 Contains any miscellaneous code required for this target machine.
497 On some machines it doesn't exist at all. Sometimes the macros
498 in @file{tm-@var{ttt}.h} become very complicated, so they are
499 implemented as functions here instead, and the macro is simply
500 defined to call the function.
501
502 @item gdb/exec.c
503 Defines functions for accessing files that are
504 executable on the target system. These functions open and examine an
505 exec file, extract data from one, write data to one, print information
506 about one, etc. Now that executable files are handled with BFD, every
507 target should be able to use the generic exec.c rather than its
508 own custom code.
509
510 @item gdb/@var{arch}-pinsn.c
511 Prints (disassembles) the target machine's instructions.
512 This file is usually shared with other target machines which use the
513 same processor, which is why it is @file{@var{arch}-pinsn.c} rather
514 than @file{@var{ttt}-pinsn.c}.
515
516 @item gdb/@var{arch}-opcode.h
517 Contains some large initialized
518 data structures describing the target machine's instructions.
519 This is a bit strange for a @file{.h} file, but it's OK since
520 it is only included in one place. @file{@var{arch}-opcode.h} is shared
521 between the debugger and the assembler, if the GNU assembler has been
522 ported to the target machine.
523
524 @item gdb/tm-@var{arch}.h
525 This often exists to describe the basic layout of the target machine's
526 processor chip (registers, stack, etc).
527 If used, it is included by @file{tm-@var{xxx}.h}. It can
528 be shared among many targets that use the same processor.
529
530 @item gdb/@var{arch}-tdep.c
531 Similarly, there are often common subroutines that are shared by all
532 target machines that use this particular architecture.
533 @end table
534
535 When adding support for a new target machine, there are various areas
536 of support that might need change, or might be OK.
537
538 If you are using an existing object file format (a.out or COFF),
539 there is probably little to be done. See @file{bfd/doc/bfd.texinfo}
540 for more information on writing new a.out or COFF versions.
541
542 If you need to add a new object file format, you are beyond the scope
543 of this document right now. Look at the structure of the a.out
544 and COFF support, build a transfer vector (@code{xvec}) for your new format,
545 and start populating it with routines. Add it to the list in
546 @file{bfd/targets.c}.
547
548 If you are adding a new operating system for an existing CPU chip, add a
549 @file{tm-@var{xos}.h} file that describes the operating system
550 facilities that are unusual (extra symbol table info; the breakpoint
551 instruction needed; etc). Then write a
552 @file{tm-@var{xarch}-@var{xos}.h} that just @code{#include}s
553 @file{tm-@var{xarch}.h} and @file{tm-@var{xos}.h}. (Now that we have
554 three-part configuration names, this will probably get revised to
555 separate the @var{xos} configuration from the @var{xarch}
556 configuration.)
557
558
559 @node Languages
560 @chapter Adding a Source Language to GDB
561
562 To add other languages to GDB's expression parser, follow the following steps:
563
564 @table @emph
565 @item Create the expression parser.
566
567 This should reside in a file @file{@var{lang}-exp.y}. Routines for building
568 parsed expressions into a @samp{union exp_element} list are in @file{parse.c}.
569
570 Since we can't depend upon everyone having Bison, and YACC produces
571 parsers that define a bunch of global names, the following lines
572 @emph{must} be included at the top of the YACC parser, to prevent
573 the various parsers from defining the same global names:
574
575 @example
576 #define yyparse @var{lang}_parse
577 #define yylex @var{lang}_lex
578 #define yyerror @var{lang}_error
579 #define yylval @var{lang}_lval
580 #define yychar @var{lang}_char
581 #define yydebug @var{lang}_debug
582 #define yypact @var{lang}_pact
583 #define yyr1 @var{lang}_r1
584 #define yyr2 @var{lang}_r2
585 #define yydef @var{lang}_def
586 #define yychk @var{lang}_chk
587 #define yypgo @var{lang}_pgo
588 #define yyact @var{lang}_act
589 #define yyexca @var{lang}_exca
590 #define yyerrflag @var{lang}_errflag
591 #define yynerrs @var{lang}_nerrs
592 @end example
593
594 At the bottom of your parser, define a @code{struct language_defn} and
595 initialize it with the right values for your language. Define an
596 @code{initialize_@var{lang}} routine and have it call
597 @samp{add_language(@var{lang}_language_defn)} to tell the rest of GDB
598 that your language exists. You'll need some other supporting variables
599 and functions, which will be used via pointers from your
600 @code{@var{lang}_language_defn}. See the declaration of @code{struct
601 language_defn} in @file{language.h}, and the other @file{*-exp.y} files,
602 for more information.
603
604 @item Add any evaluation routines, if necessary
605
606 If you need new opcodes (that represent the operations of the language),
607 add them to the enumerated type in @file{expression.h}. Add support
608 code for these operations in @code{eval.c:evaluate_subexp()}. Add cases
609 for new opcodes in two functions from @file{parse.c}:
610 @code{prefixify_subexp()} and @code{length_of_subexp()}. These compute
611 the number of @code{exp_element}s that a given operation takes up.
612
613 @item Update some existing code
614
615 Add an enumerated identifier for your language to the enumerated type
616 @code{enum language} in @file{defs.h}.
617
618 Update the routines in @file{language.c} so your language is included. These
619 routines include type predicates and such, which (in some cases) are
620 language dependent. If your language does not appear in the switch
621 statement, an error is reported.
622
623 Also included in @file{language.c} is the code that updates the variable
624 @code{current_language}, and the routines that translate the
625 @code{language_@var{lang}} enumerated identifier into a printable
626 string.
627
628 Update the function @code{_initialize_language} to include your language. This
629 function picks the default language upon startup, so is dependent upon
630 which languages that GDB is built for.
631
632 Update @code{allocate_symtab} in @file{symfile.c} and/or symbol-reading
633 code so that the language of each symtab (source file) is set properly.
634 This is used to determine the language to use at each stack frame level.
635 Currently, the language is set based upon the extension of the source
636 file. If the language can be better inferred from the symbol
637 information, please set the language of the symtab in the symbol-reading
638 code.
639
640 Add helper code to @code{expprint.c:print_subexp()} to handle any new
641 expression opcodes you have added to @file{expression.h}. Also, add the
642 printed representations of your operators to @code{op_print_tab}.
643
644 @item Add a place of call
645
646 Add a call to @code{@var{lang}_parse()} and @code{@var{lang}_error} in
647 @code{parse.c:parse_exp_1()}.
648
649 @item Use macros to trim code
650
651 The user has the option of building GDB for some or all of the
652 languages. If the user decides to build GDB for the language
653 @var{lang}, then every file dependent on @file{language.h} will have the
654 macro @code{_LANG_@var{lang}} defined in it. Use @code{#ifdef}s to
655 leave out large routines that the user won't need if he or she is not
656 using your language.
657
658 Note that you do not need to do this in your YACC parser, since if GDB
659 is not build for @var{lang}, then @file{@var{lang}-exp.tab.o} (the
660 compiled form of your parser) is not linked into GDB at all.
661
662 See the file @file{configure.in} for how GDB is configured for different
663 languages.
664
665 @item Edit @file{Makefile.in}
666
667 Add dependencies in @file{Makefile.in}. Make sure you update the macro
668 variables such as @code{HFILES} and @code{OBJS}, otherwise your code may
669 not get linked in, or, worse yet, it may not get @code{tar}red into the
670 distribution!
671 @end table
672
673
674 @node Releases
675 @chapter Configuring GDB for Release
676
677 From the top level directory (containing @file{gdb}, @file{bfd},
678 @file{libiberty}, and so on):
679 @example
680 make -f Makefile.in gdb.tar.Z
681 @end example
682
683 This will properly configure, clean, rebuild any files that are
684 distributed pre-built (e.g. @file{c-exp.tab.c} or @file{refcard.ps}),
685 and will then make a tarfile. (If the top level directory has already
686 beenn configured, you can just do @code{make gdb.tar.Z} instead.)
687
688 This procedure requires:
689 @itemize @bullet
690 @item symbolic links
691 @item @code{makeinfo} (texinfo2 level)
692 @item @TeX{}
693 @item @code{dvips}
694 @item @code{yacc} or @code{bison}
695 @end itemize
696 @noindent
697 @dots{} and the usual slew of utilities (@code{sed}, @code{tar}, etc.).
698
699 @subheading TEMPORARY RELEASE PROCEDURE FOR DOCUMENTATION
700
701 @file{gdb.texinfo} is currently marked up using the texinfo-2 macros,
702 which are not yet a default for anything (but we have to start using
703 them sometime).
704
705 For making paper, the only thing this implies is the right generation of
706 @file{texinfo.tex} needs to be included in the distribution.
707
708 For making info files, however, rather than duplicating the texinfo2
709 distribution, generate @file{gdb-all.texinfo} locally, and include the files
710 @file{gdb.info*} in the distribution. Note the plural; @code{makeinfo} will
711 split the document into one overall file and five or so included files.
712
713
714 @node Partial Symbol Tables
715 @chapter Partial Symbol Tables
716
717 GDB has three types of symbol tables.
718
719 @itemize @bullet
720 @item full symbol tables (symtabs). These contain the main
721 information about symbols and addresses.
722 @item partial symbol tables (psymtabs). These contain enough
723 information to know when to read the corresponding
724 part of the full symbol table.
725 @item minimal symbol tables (msymtabs). These contain information
726 gleaned from non-debugging symbols.
727 @end itemize
728
729 This section describes partial symbol tables.
730
731 A psymtab is constructed by doing a very quick pass over an executable
732 file's debugging information. Small amounts of information are
733 extracted -- enough to identify which parts of the symbol table will
734 need to be re-read and fully digested later, when the user needs the
735 information. The speed of this pass causes GDB to start up very
736 quickly. Later, as the detailed rereading occurs, it occurs in small
737 pieces, at various times, and the delay therefrom is mostly invisible to
738 the user. (@xref{Symbol Reading}.)
739
740 The symbols that show up in a file's psymtab should be, roughly, those
741 visible to the debugger's user when the program is not running code from
742 that file. These include external symbols and types, static
743 symbols and types, and enum values declared at file scope.
744
745 The psymtab also contains the range of instruction addresses that the
746 full symbol table would represent.
747
748 The idea is that there are only two ways for the user (or much of
749 the code in the debugger) to reference a symbol:
750
751 @itemize @bullet
752
753 @item by its address
754 (e.g. execution stops at some address which is inside a function
755 in this file). The address will be noticed to be in the
756 range of this psymtab, and the full symtab will be read in.
757 @code{find_pc_function}, @code{find_pc_line}, and other @code{find_pc_@dots{}}
758 functions handle this.
759
760 @item by its name
761 (e.g. the user asks to print a variable, or set a breakpoint on a
762 function). Global names and file-scope names will be found in the
763 psymtab, which will cause the symtab to be pulled in. Local names will
764 have to be qualified by a global name, or a file-scope name, in which
765 case we will have already read in the symtab as we evaluated the
766 qualifier. Or, a local symbol can be referenced when
767 we are "in" a local scope, in which case the first case applies.
768 @code{lookup_symbol} does most of the work here.
769
770 @end itemize
771
772 The only reason that psymtabs exist is to cause a symtab to be read in
773 at the right moment. Any symbol that can be elided from a psymtab,
774 while still causing that to happen, should not appear in it. Since
775 psymtabs don't have the idea of scope, you can't put local symbols in
776 them anyway. Psymtabs don't have the idea of the type of a symbol,
777 either, so types need not appear, unless they will be referenced by
778 name.
779
780 It is a bug for GDB to behave one way when only a psymtab has been read,
781 and another way if the corresponding symtab has been read in. Such
782 bugs are typically caused by a psymtab that does not contain all the
783 visible symbols, or which has the wrong instruction address ranges.
784
785 The psymtab for a particular section of a symbol-file (objfile)
786 could be thrown away after the symtab has been read in. The symtab
787 should always be searched before the psymtab, so the psymtab will
788 never be used (in a bug-free environment). Currently,
789 psymtabs are allocated on an obstack, and all the psymbols themselves
790 are allocated in a pair of large arrays on an obstack, so there is
791 little to be gained by trying to free them unless you want to do a lot
792 more work.
793
794 @node BFD support for GDB
795 @chapter Binary File Descriptor Library Support for GDB
796
797 BFD provides support for GDB in several ways:
798
799 @table @emph
800 @item identifying executable and core files
801 BFD will identify a variety of file types, including a.out, coff, and
802 several variants thereof, as well as several kinds of core files.
803
804 @item access to sections of files
805 BFD parses the file headers to determine the names, virtual addresses,
806 sizes, and file locations of all the various named sections in files
807 (such as the text section or the data section). GDB simply calls
808 BFD to read or write section X at byte offset Y for length Z.
809
810 @item specialized core file support
811 BFD provides routines to determine the failing command name stored
812 in a core file, the signal with which the program failed, and whether
813 a core file matches (i.e. could be a core dump of) a particular executable
814 file.
815
816 @item locating the symbol information
817 GDB uses an internal interface of BFD to determine where to find the
818 symbol information in an executable file or symbol-file. GDB itself
819 handles the reading of symbols, since BFD does not ``understand'' debug
820 symbols, but GDB uses BFD's cached information to find the symbols,
821 string table, etc.
822 @end table
823
824 @c The interface for symbol reading is described in @ref{Symbol
825 @c Reading,,Symbol Reading}.
826
827
828 @node Symbol Reading
829 @chapter Symbol Reading
830
831 GDB reads symbols from "symbol files". The usual symbol file is the
832 file containing the program which gdb is debugging. GDB can be directed
833 to use a different file for symbols (with the ``symbol-file''
834 command), and it can also read more symbols via the ``add-file'' and ``load''
835 commands, or while reading symbols from shared libraries.
836
837 Symbol files are initially opened by @file{symfile.c} using the BFD
838 library. BFD identifies the type of the file by examining its header.
839 @code{symfile_init} then uses this identification to locate a
840 set of symbol-reading functions.
841
842 Symbol reading modules identify themselves to GDB by calling
843 @code{add_symtab_fns} during their module initialization. The argument
844 to @code{add_symtab_fns} is a @code{struct sym_fns} which contains
845 the name (or name prefix) of the symbol format, the length of the prefix,
846 and pointers to four functions. These functions are called at various
847 times to process symbol-files whose identification matches the specified
848 prefix.
849
850 The functions supplied by each module are:
851
852 @table @code
853 @item @var{xxx}_symfile_init(struct sym_fns *sf)
854
855 Called from @code{symbol_file_add} when we are about to read a new
856 symbol file. This function should clean up any internal state
857 (possibly resulting from half-read previous files, for example)
858 and prepare to read a new symbol file. Note that the symbol file
859 which we are reading might be a new "main" symbol file, or might
860 be a secondary symbol file whose symbols are being added to the
861 existing symbol table.
862
863 The argument to @code{@var{xxx}_symfile_init} is a newly allocated
864 @code{struct sym_fns} whose @code{bfd} field contains the BFD
865 for the new symbol file being read. Its @code{private} field
866 has been zeroed, and can be modified as desired. Typically,
867 a struct of private information will be @code{malloc}'d, and
868 a pointer to it will be placed in the @code{private} field.
869
870 There is no result from @code{@var{xxx}_symfile_init}, but it can call
871 @code{error} if it detects an unavoidable problem.
872
873 @item @var{xxx}_new_init()
874
875 Called from @code{symbol_file_add} when discarding existing symbols.
876 This function need only handle
877 the symbol-reading module's internal state; the symbol table data
878 structures visible to the rest of GDB will be discarded by
879 @code{symbol_file_add}. It has no arguments and no result.
880 It may be called after @code{@var{xxx}_symfile_init}, if a new symbol
881 table is being read, or may be called alone if all symbols are
882 simply being discarded.
883
884 @item @var{xxx}_symfile_read(struct sym_fns *sf, CORE_ADDR addr, int mainline)
885
886 Called from @code{symbol_file_add} to actually read the symbols from a
887 symbol-file into a set of psymtabs or symtabs.
888
889 @code{sf} points to the struct sym_fns originally passed to
890 @code{@var{xxx}_sym_init} for possible initialization. @code{addr} is the
891 offset between the file's specified start address and its true address
892 in memory. @code{mainline} is 1 if this is the main symbol table being
893 read, and 0 if a secondary symbol file (e.g. shared library or
894 dynamically loaded file) is being read.@refill
895 @end table
896
897 In addition, if a symbol-reading module creates psymtabs when
898 @var{xxx}_symfile_read is called, these psymtabs will contain a pointer to
899 a function @code{@var{xxx}_psymtab_to_symtab}, which can be called from
900 any point in the GDB symbol-handling code.
901
902 @table @code
903 @item @var{xxx}_psymtab_to_symtab (struct partial_symtab *pst)
904
905 Called from @code{psymtab_to_symtab} (or the PSYMTAB_TO_SYMTAB
906 macro) if the psymtab has not already been read in and had its
907 @code{pst->symtab} pointer set. The argument is the psymtab
908 to be fleshed-out into a symtab. Upon return, pst->readin
909 should have been set to 1, and pst->symtab should contain a
910 pointer to the new corresponding symtab, or zero if there
911 were no symbols in that part of the symbol file.
912 @end table
913
914
915 @node Cleanups
916 @chapter Cleanups
917
918 Cleanups are a structured way to deal with things that need to be done
919 later. When your code does something (like @code{malloc} some memory, or open
920 a file) that needs to be undone later (e.g. free the memory or close
921 the file), it can make a cleanup. The cleanup will be done at some
922 future point: when the command is finished, when an error occurs, or
923 when your code decides it's time to do cleanups.
924
925 You can also discard cleanups, that is, throw them away without doing
926 what they say. This is only done if you ask that it be done.
927
928 Syntax:
929
930 @table @code
931 @item struct cleanup *@var{old_chain};
932 Declare a variable which will hold a cleanup chain handle.
933
934 @item @var{old_chain} = make_cleanup (@var{function}, @var{arg});
935 Make a cleanup which will cause @var{function} to be called with @var{arg}
936 (a @code{char *}) later. The result, @var{old_chain}, is a handle that can be
937 passed to @code{do_cleanups} or @code{discard_cleanups} later. Unless you are
938 going to call @code{do_cleanups} or @code{discard_cleanups} yourself,
939 you can ignore the result from @code{make_cleanup}.
940
941
942 @item do_cleanups (@var{old_chain});
943 Perform all cleanups done since @code{make_cleanup} returned @var{old_chain}.
944 E.g.:
945 @example
946 make_cleanup (a, 0);
947 old = make_cleanup (b, 0);
948 do_cleanups (old);
949 @end example
950 @noindent
951 will call @code{b()} but will not call @code{a()}. The cleanup that calls @code{a()} will remain
952 in the cleanup chain, and will be done later unless otherwise discarded.@refill
953
954 @item discard_cleanups (@var{old_chain});
955 Same as @code{do_cleanups} except that it just removes the cleanups from the
956 chain and does not call the specified functions.
957
958 @end table
959
960 Some functions, e.g. @code{fputs_filtered()} or @code{error()}, specify that they
961 ``should not be called when cleanups are not in place''. This means
962 that any actions you need to reverse in the case of an error or
963 interruption must be on the cleanup chain before you call these functions,
964 since they might never return to your code (they @samp{longjmp} instead).
965
966
967 @node Wrapping
968 @chapter Wrapping Output Lines
969
970 Output that goes through @code{printf_filtered} or @code{fputs_filtered} or
971 @code{fputs_demangled} needs only to have calls to @code{wrap_here} added
972 in places that would be good breaking points. The utility routines
973 will take care of actually wrapping if the line width is exceeded.
974
975 The argument to @code{wrap_here} is an indentation string which is printed
976 @emph{only} if the line breaks there. This argument is saved away and used
977 later. It must remain valid until the next call to @code{wrap_here} or
978 until a newline has been printed through the @code{*_filtered} functions.
979 Don't pass in a local variable and then return!
980
981 It is usually best to call @code{wrap_here()} after printing a comma or space.
982 If you call it before printing a space, make sure that your indentation
983 properly accounts for the leading space that will print if the line wraps
984 there.
985
986 Any function or set of functions that produce filtered output must finish
987 by printing a newline, to flush the wrap buffer, before switching to
988 unfiltered (``@code{printf}'') output. Symbol reading routines that print
989 warnings are a good example.
990
991
992 @node Frames
993 @chapter Frames
994
995 A frame is a construct that GDB uses to keep track of calling and called
996 functions.
997
998 @table @code
999 @item FRAME_FP
1000 in the machine description has no meaning to the machine-independent
1001 part of GDB, except that it is used when setting up a new frame from
1002 scratch, as follows:
1003
1004 @example
1005 create_new_frame (read_register (FP_REGNUM), read_pc ()));
1006 @end example
1007
1008 Other than that, all the meaning imparted to @code{FP_REGNUM} is imparted by
1009 the machine-dependent code. So, @code{FP_REGNUM} can have any value that
1010 is convenient for the code that creates new frames. (@code{create_new_frame}
1011 calls @code{INIT_EXTRA_FRAME_INFO} if it is defined; that is where you should
1012 use the @code{FP_REGNUM} value, if your frames are nonstandard.)
1013
1014 @item FRAME_CHAIN
1015 Given a GDB frame, determine the address of the calling function's
1016 frame. This will be used to create a new GDB frame struct, and then
1017 @code{INIT_EXTRA_FRAME_INFO} and @code{INIT_FRAME_PC} will be called for
1018 the new frame.
1019 @end table
1020
1021 @node Coding Style
1022 @chapter Coding Style
1023
1024 GDB is generally written using the GNU coding standards, as described in
1025 @file{standards.texi}, which you can get from the Free Software
1026 Foundation. There are some additional considerations for GDB maintainers
1027 that reflect the unique environment and style of GDB maintenance.
1028 If you follow these guidelines, GDB will be more consistent and easier
1029 to maintain.
1030
1031 GDB's policy on the use of prototypes is that prototypes are used
1032 to @emph{declare} functions but never to @emph{define} them. Simple
1033 macros are used in the declarations, so that a non-ANSI compiler can
1034 compile GDB without trouble. The simple macro calls are used like
1035 this:
1036
1037 @example @code
1038 extern int
1039 memory_remove_breakpoint PARAMS ((CORE_ADDR, char *));
1040 @end example
1041
1042 Note the double parentheses around the parameter types. This allows
1043 an arbitrary number of parameters to be described, without freaking
1044 out the C preprocessor. When the function has no parameters, it
1045 should be described like:
1046
1047 @example @code
1048 void
1049 noprocess PARAMS ((void));
1050 @end example
1051
1052 The @code{PARAMS} macro expands to its argument in ANSI C, or to a simple
1053 @code{()} in traditional C.
1054
1055 All external functions should have a @code{PARAMS} declaration in a
1056 header file that callers include. All static functions should have such
1057 a declaration near the top of their source file.
1058
1059 We don't have a gcc option that will properly check that these rules
1060 have been followed, but it's GDB policy, and we periodically check it
1061 using the tools available (plus manual labor), and clean up any remnants.
1062
1063 @node Clean Design
1064 @chapter Clean Design
1065
1066 In addition to getting the syntax right, there's the little question of
1067 semantics. Some things are done in certain ways in GDB because long
1068 experience has shown that the more obvious ways caused various kinds of
1069 trouble. In particular:
1070
1071 @table @bullet
1072 @item
1073 You can't assume the byte order of anything that comes from a
1074 target (including @var{value}s, object files, and instructions). Such
1075 things must be byte-swapped using @code{SWAP_HOST_AND_TARGET} in GDB,
1076 or one of the swap routines defined in @file{bfd.h}, such as @code{bfd_get_32}.
1077
1078 @item
1079 You can't assume that you know what interface is being used to talk to
1080 the target system. All references to the target must go through the
1081 current @code{target_ops} vector.
1082
1083 @item
1084 You can't assume that the host and target machines are the same machine
1085 (except in the ``native'' support modules).
1086 In particular, you can't assume that the target machine's header files
1087 will be available on the host machine. Target code must bring along its
1088 own header files -- written from scratch or explicitly donated by their
1089 owner, to avoid copyright problems.
1090
1091 @item
1092 Insertion of new @code{#ifdef}'s will be frowned upon.
1093
1094 @item
1095 New @code{#ifdef}'s which test for specific compilers or manufacturers
1096 or operating systems are unacceptable. All @code{#ifdef}'s should test
1097 for features. The information about which configurations contain which
1098 features should be segregated into the configuration files. Experience
1099 has proven far too often that a feature unique to one particular system
1100 often creeps into other systems; and that a conditional based on
1101 some predefined macro for your current system will become worthless
1102 over time, as new versions of your system come out that behave differently
1103 with regard to this feature.
1104
1105 @item
1106 Adding code that handles specific architectures, operating systems, target
1107 interfaces, or hosts, is not acceptable in generic code. If a hook
1108 is needed at that point, invent a generic hook and define it for your
1109 configuration, with something like:
1110
1111 @example
1112 #ifdef WRANGLE_SIGNALS
1113 WRANGLE_SIGNALS (signo);
1114 #endif
1115 @end example
1116
1117 In your host, target, or native configuration file, as appropriate,
1118 define @code{WRANGLE_SIGNALS} to do the machine-dependent thing. Take
1119 a bit of care in defining the hook, so that it can be used by other
1120 ports in the future, if they need a hook in the same place.
1121
1122 @item
1123 @emph{Do} write code that doesn't depend on the sizes of C data types,
1124 the format of the host's floating point numbers, the alignment of anything,
1125 or the order of evaluation of expressions. In short, follow good
1126 programming practices for writing portable C code.
1127
1128 @end table
1129
1130 @node Submitting Patches
1131 @chapter Submitting Patches
1132
1133 Thanks for thinking of offering your changes back to the community of
1134 GDB users. In general we like to get well designed enhancements.
1135 Thanks also for checking in advance about the best way to transfer the
1136 changes.
1137
1138 The two main problems with getting your patches in are,
1139
1140 @table @bullet
1141 @item
1142 The GDB maintainers will only install "cleanly designed" patches.
1143 You may not always agree on what is clean design.
1144 @pxref{Coding Style}, @pxref{Clean Design}.
1145
1146 @item
1147 If the maintainers don't have time to put the patch in when it
1148 arrives, or if there is any question about a patch, it
1149 goes into a large queue with everyone else's patches and
1150 bug reports
1151 @end table
1152
1153 I don't know how to get past these problems except by continuing to try.
1154
1155 There are two issues here -- technical and legal.
1156
1157 The legal issue is that to incorporate substantial changes requires a
1158 copyright assignment from you and/or your employer, granting ownership of the changes to
1159 the Free Software Foundation. You can get the standard document for
1160 doing this by sending mail to @code{gnu@prep.ai.mit.edu} and asking for it.
1161 I recommend that people write in "All programs owned by the
1162 Free Software Foundation" as "NAME OF PROGRAM", so that changes in
1163 many programs (not just GDB, but GAS, Emacs, GCC, etc) can be
1164 contributed with only one piece of legalese pushed through the
1165 bureacracy and filed with the FSF. I can't start merging changes until
1166 this paperwork is received by the FSF (their rules, which I follow since
1167 I maintain it for them).
1168
1169 Technically, the easiest way to receive changes is to receive each
1170 feature as a small context diff or unidiff, suitable for "patch".
1171 Each message sent to me should include the changes to C code and
1172 header files for a single feature, plus ChangeLog entries for each
1173 directory where files were modified, and diffs for any changes needed
1174 to the manuals (gdb/doc/gdb.texi or gdb/doc/gdbint.texi). If there
1175 are a lot of changes for a single feature, they can be split down
1176 into multiple messages.
1177
1178 In this way, if I read and like the feature, I can add it to the
1179 sources with a single patch command, do some testing, and check it in.
1180 If you leave out the ChangeLog, I have to write one. If you leave
1181 out the doc, I have to puzzle out what needs documenting. Etc.
1182
1183 The reason to send each change in a separate message is that I will
1184 not install some of the changes. They'll be returned to you with
1185 questions or comments. If I'm doing my job, my message back to you
1186 will say what you have to fix in order to make the change acceptable.
1187 The reason to have separate messages for separate features is so
1188 that other changes (which I @emph{am} willing to accept) can be installed
1189 while one or more changes are being reworked. If multiple features
1190 are sent in a single message, I tend to not put in the effort to sort
1191 out the acceptable changes from the unacceptable, so none of the
1192 features get installed until all are acceptable.
1193
1194 If this sounds painful or authoritarian, well, it is. But I get a lot
1195 of bug reports and a lot of patches, and most of them don't get
1196 installed because I don't have the time to finish the job that the bug
1197 reporter or the contributor could have done. Patches that arrive
1198 complete, working, and well designed, tend to get installed on the day
1199 they arrive. The others go into a queue and get installed if and when
1200 I scan back over the queue -- which can literally take months
1201 sometimes. It's in both our interests to make patch installation easy
1202 -- you get your changes installed, and I make some forward progress on
1203 GDB in a normal 12-hour day (instead of them having to wait until I
1204 have a 14-hour or 16-hour day to spend cleaning up patches before I
1205 can install them).
1206
1207 @node Host Conditionals
1208 @chapter Host Conditionals
1209
1210 When GDB is configured and compiled, various macros are defined or left
1211 undefined, to control compilation based on the attributes of the host
1212 system. These macros and their meanings are:
1213
1214 @emph{NOTE: For now, both host and target conditionals are here.
1215 Eliminate target conditionals from this list as they are identified.}
1216
1217 @table @code
1218 @item ALIGN_SIZE
1219 alloca.c
1220 @item BLOCK_ADDRESS_FUNCTION_RELATIVE
1221 dbxread.c
1222 @item GDBINIT_FILENAME
1223 main.c
1224 @item KERNELDEBUG
1225 tm-hppa.h
1226 @item MEM_FNS_DECLARED
1227 defs.h
1228 @item NO_SYS_FILE
1229 dbxread.c
1230 @item PYRAMID_CONTROL_FRAME_DEBUGGING
1231 pyr-xdep.c
1232 @item SIGWINCH_HANDLER_BODY
1233 utils.c
1234 @item 1
1235 buildsym.c
1236 @item 1
1237 dbxread.c
1238 @item 1
1239 dbxread.c
1240 @item 1
1241 buildsym.c
1242 @item 1
1243 dwarfread.c
1244 @item 1
1245 valops.c
1246 @item 1
1247 valops.c
1248 @item 1
1249 pyr-xdep.c
1250 @item ADDITIONAL_OPTIONS
1251 main.c
1252 @item ADDITIONAL_OPTION_CASES
1253 main.c
1254 @item ADDITIONAL_OPTION_HANDLER
1255 main.c
1256 @item ADDITIONAL_OPTION_HELP
1257 main.c
1258 @item ADDR_BITS_REMOVE
1259 defs.h
1260 @item AIX_BUGGY_PTRACE_CONTINUE
1261 infptrace.c
1262 @item ALIGN_STACK_ON_STARTUP
1263 main.c
1264 @item ALTOS
1265 altos-xdep.c
1266 @item ALTOS_AS
1267 xm-altos.h
1268 @item ASCII_COFF
1269 remote-adapt.c
1270 @item BADMAG
1271 coffread.c
1272 @item BCS
1273 tm-delta88.h
1274 @item BEFORE_MAIN_LOOP_HOOK
1275 main.c
1276 @item BELIEVE_PCC_PROMOTION
1277 coffread.c
1278 @item BELIEVE_PCC_PROMOTION_TYPE
1279 stabsread.c
1280 @item BIG_ENDIAN
1281 defs.h
1282 @item BITS_BIG_ENDIAN
1283 defs.h
1284 @item BKPT_AT_MAIN
1285 solib.c
1286 @item BLOCK_ADDRESS_ABSOLUTE
1287 dbxread.c
1288 @item BPT_VECTOR
1289 tm-68k.h
1290 @item BREAKPOINT
1291 tm-68k.h
1292 @item BREAKPOINT_DEBUG
1293 breakpoint.c
1294 @item BROKEN_LARGE_ALLOCA
1295 Avoid large @code{alloca}'s. For example, on sun's, Large alloca's fail
1296 because the attempt to increase the stack limit in main() fails because
1297 shared libraries are allocated just below the initial stack limit. The
1298 SunOS kernel will not allow the stack to grow into the area occupied by
1299 the shared libraries.
1300 @item BSTRING
1301 regex.c
1302 @item CALL_DUMMY
1303 valops.c
1304 @item CALL_DUMMY_LOCATION
1305 inferior.h
1306 @item CALL_DUMMY_STACK_ADJUST
1307 valops.c
1308 @item CANNOT_FETCH_REGISTER
1309 hppabsd-xdep.c
1310 @item CANNOT_STORE_REGISTER
1311 findvar.c
1312 @item CFRONT_PRODUCER
1313 dwarfread.c
1314 @item CHILD_PREPARE_TO_STORE
1315 inftarg.c
1316 @item CLEAR_DEFERRED_STORES
1317 inflow.c
1318 @item CLEAR_SOLIB
1319 objfiles.c
1320 @item COFF_ENCAPSULATE
1321 hppabsd-tdep.c
1322 @item COFF_FORMAT
1323 symm-tdep.c
1324 @item COFF_NO_LONG_FILE_NAMES
1325 coffread.c
1326 @item CORE_NEEDS_RELOCATION
1327 stack.c
1328 @item CPLUS_MARKER
1329 cplus-dem.c
1330 @item CREATE_INFERIOR_HOOK
1331 infrun.c
1332 @item C_ALLOCA
1333 regex.c
1334 @item C_GLBLREG
1335 coffread.c
1336 @item DAMON
1337 xcoffexec.c
1338 @item DBXREAD_ONLY
1339 partial-stab.h
1340 @item DBX_PARM_SYMBOL_CLASS
1341 stabsread.c
1342 @item DEBUG
1343 remote-adapt.c
1344 @item DEBUG_INFO
1345 partial-stab.h
1346 @item DEBUG_PTRACE
1347 hppabsd-xdep.c
1348 @item DECR_PC_AFTER_BREAK
1349 breakpoint.c
1350 @item DEFAULT_PROMPT
1351 main.c
1352 @item DELTA88
1353 m88k-xdep.c
1354 @item DEV_TTY
1355 symmisc.c
1356 @item DGUX
1357 m88k-xdep.c
1358 @item DISABLE_UNSETTABLE_BREAK
1359 breakpoint.c
1360 @item DONT_USE_REMOTE
1361 remote.c
1362 @item DO_DEFERRED_STORES
1363 infrun.c
1364 @item DO_REGISTERS_INFO
1365 infcmd.c
1366 @item END_OF_TEXT_DEFAULT
1367 dbxread.c
1368 @item EXTERN
1369 buildsym.h
1370 @item EXTRACT_RETURN_VALUE
1371 tm-68k.h
1372 @item EXTRACT_STRUCT_VALUE_ADDRESS
1373 values.c
1374 @item EXTRA_FRAME_INFO
1375 frame.h
1376 @item EXTRA_SYMTAB_INFO
1377 symtab.h
1378 @item FILES_INFO_HOOK
1379 target.c
1380 @item FIXME
1381 coffread.c
1382 @item FLOAT_INFO
1383 infcmd.c
1384 @item FOPEN_RB
1385 defs.h
1386 @item FP0_REGNUM
1387 a68v-xdep.c
1388 @item FPC_REGNUM
1389 mach386-xdep.c
1390 @item FP_REGNUM
1391 parse.c
1392 @item FRAMELESS_FUNCTION_INVOCATION
1393 blockframe.c
1394 @item FRAME_ARGS_ADDRESS_CORRECT
1395 stack.c
1396 @item FRAME_CHAIN_COMBINE
1397 blockframe.c
1398 @item FRAME_CHAIN_VALID
1399 frame.h
1400 @item FRAME_CHAIN_VALID_ALTERNATE
1401 frame.h
1402 @item FRAME_FIND_SAVED_REGS
1403 stack.c
1404 @item FRAME_GET_BASEREG_VALUE
1405 frame.h
1406 @item FRAME_NUM_ARGS
1407 tm-68k.h
1408 @item FRAME_SPECIFICATION_DYADIC
1409 stack.c
1410 @item FUNCTION_EPILOGUE_SIZE
1411 coffread.c
1412 @item F_OK
1413 xm-ultra3.h
1414 @item GCC2_COMPILED_FLAG_SYMBOL
1415 dbxread.c
1416 @item GCC_COMPILED_FLAG_SYMBOL
1417 dbxread.c
1418 @item GCC_MANGLE_BUG
1419 symtab.c
1420 @item GCC_PRODUCER
1421 dwarfread.c
1422 @item GET_SAVED_REGISTER
1423 findvar.c
1424 @item GPLUS_PRODUCER
1425 dwarfread.c
1426 @item GR64_REGNUM
1427 remote-adapt.c
1428 @item GR64_REGNUM
1429 remote-mm.c
1430 @item HANDLE_RBRAC
1431 partial-stab.h
1432 @item HAVE_68881
1433 m68k-tdep.c
1434 @item HAVE_MMAP
1435 In some cases, use the system call @code{mmap} for reading symbol
1436 tables. For some machines this allows for sharing and quick updates.
1437 @item HAVE_REGISTER_WINDOWS
1438 findvar.c
1439 @item HAVE_SIGSETMASK
1440 main.c
1441 @item HAVE_TERMIO
1442 inflow.c
1443 @item HEADER_SEEK_FD
1444 arm-tdep.c
1445 @item HOSTING_ONLY
1446 xm-rtbsd.h
1447 @item HOST_BYTE_ORDER
1448 ieee-float.c
1449 @item HPUX_ASM
1450 xm-hp300hpux.h
1451 @item HPUX_VERSION_5
1452 hp300ux-xdep.c
1453 @item HP_OS_BUG
1454 infrun.c
1455 @item I80960
1456 remote-vx.c
1457 @item IBM6000_HOST
1458 breakpoint.c
1459 @item IBM6000_TARGET
1460 buildsym.c
1461 @item IEEE_DEBUG
1462 ieee-float.c
1463 @item IEEE_FLOAT
1464 valprint.c
1465 @item IGNORE_SYMBOL
1466 dbxread.c
1467 @item INIT_EXTRA_FRAME_INFO
1468 blockframe.c
1469 @item INIT_EXTRA_SYMTAB_INFO
1470 symfile.c
1471 @item INIT_FRAME_PC
1472 blockframe.c
1473 @item INNER_THAN
1474 valops.c
1475 @item INT_MAX
1476 defs.h
1477 @item INT_MIN
1478 defs.h
1479 @item IN_GDB
1480 i960-pinsn.c
1481 @item IN_SIGTRAMP
1482 infrun.c
1483 @item IN_SOLIB_TRAMPOLINE
1484 infrun.c
1485 @item ISATTY
1486 main.c
1487 @item IS_TRAPPED_INTERNALVAR
1488 values.c
1489 @item KERNELDEBUG
1490 dbxread.c
1491 @item KERNEL_DEBUGGING
1492 tm-ultra3.h
1493 @item KERNEL_U_ADDR
1494 Define this to the address of the @code{u} structure (the ``user struct'',
1495 also known as the ``u-page'') in kernel virtual memory. GDB needs to know
1496 this so that it can subtract this address from absolute addresses in
1497 the upage, that are obtained via ptrace or from core files. On systems
1498 that don't need this value, set it to zero.
1499 @item KERNEL_U_ADDR_BSD
1500 Define this to cause GDB to determine the address of @code{u} at runtime,
1501 by using Berkeley-style @code{nlist} on the kernel's image in the root
1502 directory.
1503 @item KERNEL_U_ADDR_HPUX
1504 Define this to cause GDB to determine the address of @code{u} at runtime,
1505 by using HP-style @code{nlist} on the kernel's image in the root
1506 directory.
1507 @item LCC_PRODUCER
1508 dwarfread.c
1509 @item LITTLE_ENDIAN
1510 defs.h
1511 @item LOG_FILE
1512 remote-adapt.c
1513 @item LONGERNAMES
1514 cplus-dem.c
1515 @item LONGEST
1516 defs.h
1517 @item LONG_LONG
1518 defs.h
1519 @item LONG_MAX
1520 defs.h
1521 @item LSEEK_NOT_LINEAR
1522 source.c
1523 @item L_LNNO32
1524 coffread.c
1525 @item L_SET
1526 This macro is used as the argument to lseek (or, most commonly, bfd_seek).
1527 FIXME, it should be replaced by SEEK_SET instead, which is the POSIX equivalent.
1528 @item MACHKERNELDEBUG
1529 hppabsd-tdep.c
1530 @item MAIN
1531 cplus-dem.c
1532 @item MAINTENANCE
1533 dwarfread.c
1534 @item MAINTENANCE_CMDS
1535 breakpoint.c
1536 @item MAINTENANCE_CMDS
1537 maint.c
1538 @item MALLOC_INCOMPATIBLE
1539 Define this if the system's prototype for @code{malloc} differs from the
1540 @sc{ANSI} definition.
1541 @item MIPSEL
1542 mips-tdep.c
1543 @item MMAP_BASE_ADDRESS
1544 When using HAVE_MMAP, the first mapping should go at this address.
1545 @item MMAP_INCREMENT
1546 when using HAVE_MMAP, this is the increment between mappings.
1547 @item MONO
1548 ser-go32.c
1549 @item MOTOROLA
1550 xm-altos.h
1551 @item NAMES_HAVE_UNDERSCORE
1552 coffread.c
1553 @item NBPG
1554 altos-xdep.c
1555 @item NEED_POSIX_SETPGID
1556 infrun.c
1557 @item NEED_TEXT_START_END
1558 exec.c
1559 @item NFAILURES
1560 regex.c
1561 @item NNPC_REGNUM
1562 infrun.c
1563 @item NORETURN
1564 defs.h
1565 @item NOTDEF
1566 regex.c
1567 @item NOTDEF
1568 remote-adapt.c
1569 @item NOTDEF
1570 remote-mm.c
1571 @item NOTICE_SIGNAL_HANDLING_CHANGE
1572 infrun.c
1573 @item NO_DEFINE_SYMBOL
1574 xcoffread.c
1575 @item NO_HIF_SUPPORT
1576 remote-mm.c
1577 @item NO_JOB_CONTROL
1578 signals.h
1579 @item NO_MALLOC_CHECK
1580 utils.c
1581 @item NO_MMALLOC
1582 utils.c
1583 @item NO_MMALLOC
1584 objfiles.c
1585 @item NO_MMALLOC
1586 utils.c
1587 @item NO_SIGINTERRUPT
1588 remote-adapt.c
1589 @item NO_SINGLE_STEP
1590 infptrace.c
1591 @item NO_TYPEDEFS
1592 xcoffread.c
1593 @item NO_TYPEDEFS
1594 xcoffread.c
1595 @item NPC_REGNUM
1596 infcmd.c
1597 @item NS32K_SVC_IMMED_OPERANDS
1598 ns32k-opcode.h
1599 @item NUMERIC_REG_NAMES
1600 mips-tdep.c
1601 @item N_SETV
1602 dbxread.c
1603 @item N_SET_MAGIC
1604 hppabsd-tdep.c
1605 @item NaN
1606 tm-umax.h
1607 @item ONE_PROCESS_WRITETEXT
1608 breakpoint.c
1609 @item O_BINARY
1610 exec.c
1611 @item O_RDONLY
1612 xm-ultra3.h
1613 @item PC
1614 convx-opcode.h
1615 @item PCC_SOL_BROKEN
1616 dbxread.c
1617 @item PC_IN_CALL_DUMMY
1618 inferior.h
1619 @item PC_LOAD_SEGMENT
1620 stack.c
1621 @item PC_REGNUM
1622 parse.c
1623 @item PRINT_RANDOM_SIGNAL
1624 infcmd.c
1625 @item PRINT_REGISTER_HOOK
1626 infcmd.c
1627 @item PRINT_TYPELESS_INTEGER
1628 valprint.c
1629 @item PROCESS_LINENUMBER_HOOK
1630 buildsym.c
1631 @item PROLOGUE_FIRSTLINE_OVERLAP
1632 infrun.c
1633 @item PSIGNAL_IN_SIGNAL_H
1634 defs.h
1635 @item PS_REGNUM
1636 parse.c
1637 @item PTRACE_ARG3_TYPE
1638 inferior.h
1639 @item PTRACE_FP_BUG
1640 mach386-xdep.c
1641 @item PT_ATTACH
1642 hppabsd-xdep.c
1643 @item PT_DETACH
1644 hppabsd-xdep.c
1645 @item PT_KILL
1646 infptrace.c
1647 @item PUSH_ARGUMENTS
1648 valops.c
1649 @item PYRAMID_CONTROL_FRAME_DEBUGGING
1650 pyr-xdep.c
1651 @item PYRAMID_CORE
1652 pyr-xdep.c
1653 @item PYRAMID_PTRACE
1654 pyr-xdep.c
1655 @item REGISTER_BYTES
1656 remote.c
1657 @item REGISTER_NAMES
1658 tm-29k.h
1659 @item REG_STACK_SEGMENT
1660 exec.c
1661 @item REG_STRUCT_HAS_ADDR
1662 findvar.c
1663 @item RE_NREGS
1664 regex.h
1665 @item R_FP
1666 dwarfread.c
1667 @item R_OK
1668 xm-altos.h
1669 @item SDB_REG_TO_REGNUM
1670 coffread.c
1671 @item SEEK_END
1672 state.c
1673 @item SEEK_SET
1674 state.c
1675 @item SEM
1676 coffread.c
1677 @item SET_STACK_LIMIT_HUGE
1678 When defined, stack limits will be raised to their maximum. Use this
1679 if your host supports @code{setrlimit} and you have trouble with
1680 @code{stringtab} in @file{dbxread.c}.
1681
1682 Also used in @file{fork-child.c} to return stack limits before child
1683 processes are forked.
1684 @item SHELL_COMMAND_CONCAT
1685 infrun.c
1686 @item SHELL_FILE
1687 infrun.c
1688 @item SHIFT_INST_REGS
1689 breakpoint.c
1690 @item SIGN_EXTEND_CHAR
1691 regex.c
1692 @item SIGTRAP_STOP_AFTER_LOAD
1693 infrun.c
1694 @item SKIP_PROLOGUE
1695 tm-68k.h
1696 @item SKIP_PROLOGUE_FRAMELESS_P
1697 blockframe.c
1698 @item SKIP_TRAMPOLINE_CODE
1699 infrun.c
1700 @item SOLIB_ADD
1701 core.c
1702 @item SOLIB_CREATE_INFERIOR_HOOK
1703 infrun.c
1704 @item SOME_NAMES_HAVE_DOT
1705 minsyms.c
1706 @item SP_REGNUM
1707 parse.c
1708 @item STAB_REG_TO_REGNUM
1709 stabsread.h
1710 @item STACK_ALIGN
1711 valops.c
1712 @item STACK_DIRECTION
1713 alloca.c
1714 @item START_INFERIOR_TRAPS_EXPECTED
1715 infrun.c
1716 @item STOP_SIGNAL
1717 main.c
1718 @item STORE_RETURN_VALUE
1719 tm-68k.h
1720 @item SUN4_COMPILER_FEATURE
1721 infrun.c
1722 @item SUN_FIXED_LBRAC_BUG
1723 dbxread.c
1724 @item SVR4_SHARED_LIBS
1725 solib.c
1726 @item SWITCH_ENUM_BUG
1727 regex.c
1728 @item SYM1
1729 tm-ultra3.h
1730 @item SYMBOL_RELOADING_DEFAULT
1731 symfile.c
1732 @item SYNTAX_TABLE
1733 regex.c
1734 @item Sword
1735 regex.c
1736 @item TDESC
1737 infrun.c
1738 @item TIOCGETC
1739 inflow.c
1740 @item TIOCGLTC
1741 inflow.c
1742 @item TIOCGPGRP
1743 inflow.c
1744 @item TIOCLGET
1745 inflow.c
1746 @item TIOCLSET
1747 inflow.c
1748 @item TIOCNOTTY
1749 inflow.c
1750 @item TM_FILE_OVERRIDE
1751 defs.h
1752 @item T_ARG
1753 coffread.c
1754 @item T_VOID
1755 coffread.c
1756 @item UINT_MAX
1757 defs.h
1758 @item UPAGES
1759 altos-xdep.c
1760 @item USER
1761 m88k-tdep.c
1762 @item USE_GAS
1763 xm-news.h
1764 @item USE_O_NOCTTY
1765 inflow.c
1766 @item USE_STRUCT_CONVENTION
1767 values.c
1768 @item USG
1769 Means that System V (prior to SVR4) include files are in use.
1770 (FIXME: This symbol is abused in @file{infrun.c}, @file{regex.c},
1771 @file{remote-nindy.c}, and @file{utils.c} for other things, at the moment.)
1772 @item USIZE
1773 xm-m88k.h
1774 @item U_FPSTATE
1775 i386-xdep.c
1776 @item VARIABLES_INSIDE_BLOCK
1777 dbxread.c
1778 @item WRS_ORIG
1779 remote-vx.c
1780 @item _LANG_c
1781 language.c
1782 @item _LANG_m2
1783 language.c
1784 @item __GNUC__
1785 news-xdep.c
1786 @item __GO32__
1787 inflow.c
1788 @item __HAVE_68881__
1789 m68k-stub.c
1790 @item __HPUX_ASM__
1791 xm-hp300hpux.h
1792 @item __INT_VARARGS_H
1793 printcmd.c
1794 @item __not_on_pyr_yet
1795 pyr-xdep.c
1796 @item alloca
1797 defs.h
1798 @item const
1799 defs.h
1800 @item GOULD_PN
1801 gould-pinsn.c
1802 @item emacs
1803 alloca.c
1804 @item hp800
1805 xm-hppabsd.h
1806 @item hpux
1807 hppabsd-core.c
1808 @item lint
1809 valarith.c
1810 @item longest_to_int
1811 defs.h
1812 @item mc68020
1813 m68k-stub.c
1814 @item notdef
1815 gould-pinsn.c
1816 @item ns32k_opcodeT
1817 ns32k-opcode.h
1818 @item sgi
1819 mips-tdep.c
1820 @item sparc
1821 regex.c
1822 @item static
1823 alloca.c
1824 @item sun
1825 m68k-tdep.c
1826 @item sun386
1827 tm-sun386.h
1828 @item test
1829 regex.c
1830 @item ultrix
1831 xm-mips.h
1832 @item volatile
1833 defs.h
1834 @item x_name
1835 coffread.c
1836 @item x_zeroes
1837 coffread.c
1838 @end table
1839
1840 @node Target Conditionals
1841 @chapter Target Conditionals
1842
1843 When GDB is configured and compiled, various macros are defined or left
1844 undefined, to control compilation based on the attributes of the target
1845 system. These macros and their meanings are:
1846
1847 @emph{NOTE: For now, both host and target conditionals are here.
1848 Eliminate host conditionals from this list as they are identified.}
1849
1850 @table @code
1851 @item PUSH_DUMMY_FRAME
1852 Used in @samp{call_function_by_hand} to create an artificial stack frame.
1853 @item POP_FRAME
1854 Used in @samp{call_function_by_hand} to remove an artificial stack frame.
1855 @item ALIGN_SIZE
1856 alloca.c
1857 @item BLOCK_ADDRESS_FUNCTION_RELATIVE
1858 dbxread.c
1859 @item GDBINIT_FILENAME
1860 main.c
1861 @item KERNELDEBUG
1862 tm-hppa.h
1863 @item MEM_FNS_DECLARED
1864 defs.h
1865 @item NO_SYS_FILE
1866 dbxread.c
1867 @item PYRAMID_CONTROL_FRAME_DEBUGGING
1868 pyr-xdep.c
1869 @item SIGWINCH_HANDLER_BODY
1870 utils.c
1871 @item ADDITIONAL_OPTIONS
1872 main.c
1873 @item ADDITIONAL_OPTION_CASES
1874 main.c
1875 @item ADDITIONAL_OPTION_HANDLER
1876 main.c
1877 @item ADDITIONAL_OPTION_HELP
1878 main.c
1879 @item ADDR_BITS_REMOVE
1880 defs.h
1881 @item ALIGN_STACK_ON_STARTUP
1882 main.c
1883 @item ALTOS
1884 altos-xdep.c
1885 @item ALTOS_AS
1886 xm-altos.h
1887 @item ASCII_COFF
1888 remote-adapt.c
1889 @item BADMAG
1890 coffread.c
1891 @item BCS
1892 tm-delta88.h
1893 @item BEFORE_MAIN_LOOP_HOOK
1894 main.c
1895 @item BELIEVE_PCC_PROMOTION
1896 coffread.c
1897 @item BELIEVE_PCC_PROMOTION_TYPE
1898 stabsread.c
1899 @item BIG_ENDIAN
1900 defs.h
1901 @item BITS_BIG_ENDIAN
1902 defs.h
1903 @item BKPT_AT_MAIN
1904 solib.c
1905 @item BLOCK_ADDRESS_ABSOLUTE
1906 dbxread.c
1907 @item BPT_VECTOR
1908 tm-68k.h
1909 @item BREAKPOINT
1910 tm-68k.h
1911 @item BREAKPOINT_DEBUG
1912 breakpoint.c
1913 @item BSTRING
1914 regex.c
1915 @item CALL_DUMMY
1916 valops.c
1917 @item CALL_DUMMY_LOCATION
1918 inferior.h
1919 @item CALL_DUMMY_STACK_ADJUST
1920 valops.c
1921 @item CANNOT_FETCH_REGISTER
1922 hppabsd-xdep.c
1923 @item CANNOT_STORE_REGISTER
1924 findvar.c
1925 @item CFRONT_PRODUCER
1926 dwarfread.c
1927 @item CHILD_PREPARE_TO_STORE
1928 inftarg.c
1929 @item CLEAR_DEFERRED_STORES
1930 inflow.c
1931 @item CLEAR_SOLIB
1932 objfiles.c
1933 @item COFF_ENCAPSULATE
1934 hppabsd-tdep.c
1935 @item COFF_FORMAT
1936 symm-tdep.c
1937 @item COFF_NO_LONG_FILE_NAMES
1938 coffread.c
1939 @item CORE_NEEDS_RELOCATION
1940 stack.c
1941 @item CPLUS_MARKER
1942 cplus-dem.c
1943 @item CREATE_INFERIOR_HOOK
1944 infrun.c
1945 @item C_ALLOCA
1946 regex.c
1947 @item C_GLBLREG
1948 coffread.c
1949 @item DAMON
1950 xcoffexec.c
1951 @item DBXREAD_ONLY
1952 partial-stab.h
1953 @item DBX_PARM_SYMBOL_CLASS
1954 stabsread.c
1955 @item DEBUG
1956 remote-adapt.c
1957 @item DEBUG_INFO
1958 partial-stab.h
1959 @item DEBUG_PTRACE
1960 hppabsd-xdep.c
1961 @item DECR_PC_AFTER_BREAK
1962 breakpoint.c
1963 @item DEFAULT_PROMPT
1964 main.c
1965 @item DELTA88
1966 m88k-xdep.c
1967 @item DEV_TTY
1968 symmisc.c
1969 @item DGUX
1970 m88k-xdep.c
1971 @item DISABLE_UNSETTABLE_BREAK
1972 breakpoint.c
1973 @item DONT_USE_REMOTE
1974 remote.c
1975 @item DO_DEFERRED_STORES
1976 infrun.c
1977 @item DO_REGISTERS_INFO
1978 infcmd.c
1979 @item END_OF_TEXT_DEFAULT
1980 dbxread.c
1981 @item EXTERN
1982 buildsym.h
1983 @item EXTRACT_RETURN_VALUE
1984 tm-68k.h
1985 @item EXTRACT_STRUCT_VALUE_ADDRESS
1986 values.c
1987 @item EXTRA_FRAME_INFO
1988 frame.h
1989 @item EXTRA_SYMTAB_INFO
1990 symtab.h
1991 @item FILES_INFO_HOOK
1992 target.c
1993 @item FIXME
1994 coffread.c
1995 @item FLOAT_INFO
1996 infcmd.c
1997 @item FOPEN_RB
1998 defs.h
1999 @item FP0_REGNUM
2000 a68v-xdep.c
2001 @item FPC_REGNUM
2002 mach386-xdep.c
2003 @item FP_REGNUM
2004 parse.c
2005 @item FPU
2006 Unused? 6-oct-92 rich@@cygnus.com. FIXME.
2007 @item FRAMELESS_FUNCTION_INVOCATION
2008 blockframe.c
2009 @item FRAME_ARGS_ADDRESS_CORRECT
2010 stack.c
2011 @item FRAME_CHAIN_COMBINE
2012 blockframe.c
2013 @item FRAME_CHAIN_VALID
2014 frame.h
2015 @item FRAME_CHAIN_VALID_ALTERNATE
2016 frame.h
2017 @item FRAME_FIND_SAVED_REGS
2018 stack.c
2019 @item FRAME_GET_BASEREG_VALUE
2020 frame.h
2021 @item FRAME_NUM_ARGS
2022 tm-68k.h
2023 @item FRAME_SPECIFICATION_DYADIC
2024 stack.c
2025 @item FUNCTION_EPILOGUE_SIZE
2026 coffread.c
2027 @item F_OK
2028 xm-ultra3.h
2029 @item GCC2_COMPILED_FLAG_SYMBOL
2030 dbxread.c
2031 @item GCC_COMPILED_FLAG_SYMBOL
2032 dbxread.c
2033 @item GCC_MANGLE_BUG
2034 symtab.c
2035 @item GCC_PRODUCER
2036 dwarfread.c
2037 @item GDB_TARGET_IS_HPPA
2038 This determines whether horrible kludge code in dbxread.c and partial-stab.h
2039 is used to mangle multiple-symbol-table files from HPPA's. This should all
2040 be ripped out, and a scheme like elfread.c used.
2041 @item GDB_TARGET_IS_MACH386
2042 mach386-xdep.c
2043 @item GDB_TARGET_IS_SUN3
2044 a68v-xdep.c
2045 @item GDB_TARGET_IS_SUN386
2046 sun386-xdep.c
2047 @item GET_LONGJMP_TARGET
2048 For most machines, this is a target-dependent parameter. On the DECstation
2049 and the Iris, this is a native-dependent parameter, since <setjmp.h> is
2050 needed to define it.
2051
2052 This macro determines the target PC address that longjmp() will jump
2053 to, assuming that we have just stopped at a longjmp breakpoint. It
2054 takes a CORE_ADDR * as argument, and stores the target PC value through
2055 this pointer. It examines the current state of the machine as needed.
2056 @item GET_SAVED_REGISTER
2057 findvar.c
2058 @item GPLUS_PRODUCER
2059 dwarfread.c
2060 @item GR64_REGNUM
2061 remote-adapt.c
2062 @item GR64_REGNUM
2063 remote-mm.c
2064 @item HANDLE_RBRAC
2065 partial-stab.h
2066 @item HAVE_68881
2067 m68k-tdep.c
2068 @item HAVE_REGISTER_WINDOWS
2069 findvar.c
2070 @item HAVE_SIGSETMASK
2071 main.c
2072 @item HAVE_TERMIO
2073 inflow.c
2074 @item HEADER_SEEK_FD
2075 arm-tdep.c
2076 @item HOSTING_ONLY
2077 xm-rtbsd.h
2078 @item HOST_BYTE_ORDER
2079 ieee-float.c
2080 @item HPUX_ASM
2081 xm-hp300hpux.h
2082 @item HPUX_VERSION_5
2083 hp300ux-xdep.c
2084 @item HP_OS_BUG
2085 infrun.c
2086 @item I80960
2087 remote-vx.c
2088 @item IBM6000_HOST
2089 breakpoint.c
2090 @item IBM6000_TARGET
2091 buildsym.c
2092 @item IEEE_DEBUG
2093 ieee-float.c
2094 @item IEEE_FLOAT
2095 valprint.c
2096 @item IGNORE_SYMBOL
2097 dbxread.c
2098 @item INIT_EXTRA_FRAME_INFO
2099 blockframe.c
2100 @item INIT_EXTRA_SYMTAB_INFO
2101 symfile.c
2102 @item INIT_FRAME_PC
2103 blockframe.c
2104 @item INNER_THAN
2105 valops.c
2106 @item INT_MAX
2107 defs.h
2108 @item INT_MIN
2109 defs.h
2110 @item IN_GDB
2111 i960-pinsn.c
2112 @item IN_SIGTRAMP
2113 infrun.c
2114 @item IN_SOLIB_TRAMPOLINE
2115 infrun.c
2116 @item ISATTY
2117 main.c
2118 @item IS_TRAPPED_INTERNALVAR
2119 values.c
2120 @item KERNELDEBUG
2121 dbxread.c
2122 @item KERNEL_DEBUGGING
2123 tm-ultra3.h
2124 @item LCC_PRODUCER
2125 dwarfread.c
2126 @item LITTLE_ENDIAN
2127 defs.h
2128 @item LOG_FILE
2129 remote-adapt.c
2130 @item LONGERNAMES
2131 cplus-dem.c
2132 @item LONGEST
2133 defs.h
2134 @item LONG_LONG
2135 defs.h
2136 @item LONG_MAX
2137 defs.h
2138 @item L_LNNO32
2139 coffread.c
2140 @item MACHKERNELDEBUG
2141 hppabsd-tdep.c
2142 @item MAIN
2143 cplus-dem.c
2144 @item MAINTENANCE
2145 dwarfread.c
2146 @item MAINTENANCE_CMDS
2147 breakpoint.c
2148 @item MAINTENANCE_CMDS
2149 maint.c
2150 @item MIPSEL
2151 mips-tdep.c
2152 @item MOTOROLA
2153 xm-altos.h
2154 @item NAMES_HAVE_UNDERSCORE
2155 coffread.c
2156 @item NBPG
2157 altos-xdep.c
2158 @item NEED_POSIX_SETPGID
2159 infrun.c
2160 @item NEED_TEXT_START_END
2161 exec.c
2162 @item NFAILURES
2163 regex.c
2164 @item NNPC_REGNUM
2165 infrun.c
2166 @item NORETURN
2167 defs.h
2168 @item NOTDEF
2169 regex.c
2170 @item NOTDEF
2171 remote-adapt.c
2172 @item NOTDEF
2173 remote-mm.c
2174 @item NOTICE_SIGNAL_HANDLING_CHANGE
2175 infrun.c
2176 @item NO_DEFINE_SYMBOL
2177 xcoffread.c
2178 @item NO_HIF_SUPPORT
2179 remote-mm.c
2180 @item NO_JOB_CONTROL
2181 signals.h
2182 @item NO_MALLOC_CHECK
2183 utils.c
2184 @item NO_MMALLOC
2185 utils.c
2186 @item NO_MMALLOC
2187 objfiles.c
2188 @item NO_MMALLOC
2189 utils.c
2190 @item NO_SIGINTERRUPT
2191 remote-adapt.c
2192 @item NO_SINGLE_STEP
2193 infptrace.c
2194 @item NO_TYPEDEFS
2195 xcoffread.c
2196 @item NO_TYPEDEFS
2197 xcoffread.c
2198 @item NPC_REGNUM
2199 infcmd.c
2200 @item NS32K_SVC_IMMED_OPERANDS
2201 ns32k-opcode.h
2202 @item NUMERIC_REG_NAMES
2203 mips-tdep.c
2204 @item N_SETV
2205 dbxread.c
2206 @item N_SET_MAGIC
2207 hppabsd-tdep.c
2208 @item NaN
2209 tm-umax.h
2210 @item ONE_PROCESS_WRITETEXT
2211 breakpoint.c
2212 @item PC
2213 convx-opcode.h
2214 @item PCC_SOL_BROKEN
2215 dbxread.c
2216 @item PC_IN_CALL_DUMMY
2217 inferior.h
2218 @item PC_LOAD_SEGMENT
2219 stack.c
2220 @item PC_REGNUM
2221 parse.c
2222 @item PRINT_RANDOM_SIGNAL
2223 infcmd.c
2224 @item PRINT_REGISTER_HOOK
2225 infcmd.c
2226 @item PRINT_TYPELESS_INTEGER
2227 valprint.c
2228 @item PROCESS_LINENUMBER_HOOK
2229 buildsym.c
2230 @item PROLOGUE_FIRSTLINE_OVERLAP
2231 infrun.c
2232 @item PSIGNAL_IN_SIGNAL_H
2233 defs.h
2234 @item PS_REGNUM
2235 parse.c
2236 @item PTRACE_ARG3_TYPE
2237 inferior.h
2238 @item PTRACE_FP_BUG
2239 mach386-xdep.c
2240 @item PUSH_ARGUMENTS
2241 valops.c
2242 @item REGISTER_BYTES
2243 remote.c
2244 @item REGISTER_NAMES
2245 tm-29k.h
2246 @item REG_STACK_SEGMENT
2247 exec.c
2248 @item REG_STRUCT_HAS_ADDR
2249 findvar.c
2250 @item RE_NREGS
2251 regex.h
2252 @item R_FP
2253 dwarfread.c
2254 @item R_OK
2255 xm-altos.h
2256 @item SDB_REG_TO_REGNUM
2257 coffread.c
2258 @item SEEK_END
2259 state.c
2260 @item SEEK_SET
2261 state.c
2262 @item SEM
2263 coffread.c
2264 @item SET_STACK_LIMIT_HUGE
2265 infrun.c
2266 @item SHELL_COMMAND_CONCAT
2267 infrun.c
2268 @item SHELL_FILE
2269 infrun.c
2270 @item SHIFT_INST_REGS
2271 breakpoint.c
2272 @item SIGN_EXTEND_CHAR
2273 regex.c
2274 @item SIGTRAP_STOP_AFTER_LOAD
2275 infrun.c
2276 @item SKIP_PROLOGUE
2277 tm-68k.h
2278 @item SKIP_PROLOGUE_FRAMELESS_P
2279 blockframe.c
2280 @item SKIP_TRAMPOLINE_CODE
2281 infrun.c
2282 @item SOLIB_ADD
2283 core.c
2284 @item SOLIB_CREATE_INFERIOR_HOOK
2285 infrun.c
2286 @item SOME_NAMES_HAVE_DOT
2287 minsyms.c
2288 @item SP_REGNUM
2289 parse.c
2290 @item STAB_REG_TO_REGNUM
2291 stabsread.h
2292 @item STACK_ALIGN
2293 valops.c
2294 @item STACK_DIRECTION
2295 alloca.c
2296 @item START_INFERIOR_TRAPS_EXPECTED
2297 infrun.c
2298 @item STOP_SIGNAL
2299 main.c
2300 @item STORE_RETURN_VALUE
2301 tm-68k.h
2302 @item SUN4_COMPILER_FEATURE
2303 infrun.c
2304 @item SUN_FIXED_LBRAC_BUG
2305 dbxread.c
2306 @item SVR4_SHARED_LIBS
2307 solib.c
2308 @item SWITCH_ENUM_BUG
2309 regex.c
2310 @item SYM1
2311 tm-ultra3.h
2312 @item SYMBOL_RELOADING_DEFAULT
2313 symfile.c
2314 @item SYNTAX_TABLE
2315 regex.c
2316 @item Sword
2317 regex.c
2318 @item TARGET_BYTE_ORDER
2319 defs.h
2320 @item TARGET_CHAR_BIT
2321 defs.h
2322 @item TARGET_COMPLEX_BIT
2323 defs.h
2324 @item TARGET_DOUBLE_BIT
2325 defs.h
2326 @item TARGET_DOUBLE_COMPLEX_BIT
2327 defs.h
2328 @item TARGET_FLOAT_BIT
2329 defs.h
2330 @item TARGET_INT_BIT
2331 defs.h
2332 @item TARGET_LONG_BIT
2333 defs.h
2334 @item TARGET_LONG_DOUBLE_BIT
2335 defs.h
2336 @item TARGET_LONG_LONG_BIT
2337 defs.h
2338 @item TARGET_PTR_BIT
2339 defs.h
2340 @item TARGET_SHORT_BIT
2341 defs.h
2342 @item TDESC
2343 infrun.c
2344 @item TM_FILE_OVERRIDE
2345 defs.h
2346 @item T_ARG
2347 coffread.c
2348 @item T_VOID
2349 coffread.c
2350 @item UINT_MAX
2351 defs.h
2352 @item USER
2353 m88k-tdep.c
2354 @item USE_GAS
2355 xm-news.h
2356 @item USE_STRUCT_CONVENTION
2357 values.c
2358 @item USIZE
2359 xm-m88k.h
2360 @item U_FPSTATE
2361 i386-xdep.c
2362 @item VARIABLES_INSIDE_BLOCK
2363 dbxread.c
2364 @item WRS_ORIG
2365 remote-vx.c
2366 @item _LANG_c
2367 language.c
2368 @item _LANG_m2
2369 language.c
2370 @item __GO32__
2371 inflow.c
2372 @item __HAVE_68881__
2373 m68k-stub.c
2374 @item __HPUX_ASM__
2375 xm-hp300hpux.h
2376 @item __INT_VARARGS_H
2377 printcmd.c
2378 @item __not_on_pyr_yet
2379 pyr-xdep.c
2380 @item GOULD_PN
2381 gould-pinsn.c
2382 @item emacs
2383 alloca.c
2384 @item hp800
2385 xm-hppabsd.h
2386 @item hpux
2387 hppabsd-core.c
2388 @item longest_to_int
2389 defs.h
2390 @item mc68020
2391 m68k-stub.c
2392 @item ns32k_opcodeT
2393 ns32k-opcode.h
2394 @item sgi
2395 mips-tdep.c
2396 @item sparc
2397 regex.c
2398 @item static
2399 alloca.c
2400 @item sun
2401 m68k-tdep.c
2402 @item sun386
2403 tm-sun386.h
2404 @item test
2405 regex.c
2406 @item x_name
2407 coffread.c
2408 @item x_zeroes
2409 coffread.c
2410 @end table
2411
2412 @node Native Conditionals
2413 @chapter Native Conditionals
2414
2415 When GDB is configured and compiled, various macros are defined or left
2416 undefined, to control compilation when the host and target systems
2417 are the same. These macros should be defined (or left undefined)
2418 in @file{nm-@var{system}.h}.
2419
2420 @table @code
2421 @item ATTACH_DETACH
2422 If defined, then gdb will include support for the @code{attach} and
2423 @code{detach} commands.
2424 @item FETCH_INFERIOR_REGISTERS
2425 Define this if the native-dependent code will provide its
2426 own routines
2427 @code{fetch_inferior_registers} and @code{store_inferior_registers} in
2428 @file{@var{HOST}-nat.c}.
2429 If this symbol is @emph{not} defined, and @file{infptrace.c}
2430 is included in this configuration, the default routines in
2431 @file{infptrace.c} are used for these functions.
2432 @item GET_LONGJMP_TARGET
2433 For most machines, this is a target-dependent parameter. On the DECstation
2434 and the Iris, this is a native-dependent parameter, since <setjmp.h> is
2435 needed to define it.
2436
2437 This macro determines the target PC address that longjmp() will jump
2438 to, assuming that we have just stopped at a longjmp breakpoint. It
2439 takes a CORE_ADDR * as argument, and stores the target PC value through
2440 this pointer. It examines the current state of the machine as needed.
2441 @item PROC_NAME_FMT
2442 Defines the format for the name of a @file{/proc} device. Should be
2443 defined in @file{nm.h} @emph{only} in order to override the default
2444 definition in @file{procfs.c}.
2445 @item REGISTER_U_ADDR
2446 Defines the offset of the registers in the ``u area''; @pxref{Host}.
2447 @item USE_PROC_FS
2448 This determines whether small routines in @file{*-tdep.c}, which
2449 translate register values
2450 between GDB's internal representation and the /proc representation,
2451 are compiled.
2452 @item U_REGS_OFFSET
2453 This is the offset of the registers in the upage. It need only be
2454 defined if the generic ptrace register access routines in
2455 @file{infptrace.c} are being used (that is,
2456 @file{infptrace.c} is configured in, and
2457 @code{FETCH_INFERIOR_REGISTERS} is not defined). If the default value
2458 from @file{infptrace.c} is good enough, leave it undefined.
2459
2460 The default value means that u.u_ar0 @emph{points to} the location of the
2461 registers. I'm guessing that @code{#define U_REGS_OFFSET 0} means that
2462 u.u_ar0 @emph{is} the location of the registers.
2463 @end table
2464
2465 @node Obsolete Conditionals
2466 @chapter Obsolete Conditionals
2467
2468 Fragments of old code in GDB sometimes reference or set the following
2469 configuration macros. They should not be used by new code, and
2470 old uses should be removed as those parts of the debugger are
2471 otherwise touched.
2472
2473 @table @code
2474 @item STACK_END_ADDR
2475 This macro used to define where the end of the stack appeared, for use
2476 in interpreting core file formats that don't record this address in the
2477 core file itself. This information is now configured in BFD, and GDB
2478 gets the info portably from there. The values in GDB's configuration
2479 files should be moved into BFD configuration files (if needed there),
2480 and deleted from all of GDB's config files.
2481
2482 Any @file{@var{foo}-xdep.c} file that references STACK_END_ADDR
2483 is so old that it has never been converted to use BFD. Now that's old!
2484 @end table
2485 @contents
2486 @bye