OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [doc/] [gdbint.info-2] - Blame information for rev 1775

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
This is gdbint.info, produced by makeinfo version 4.1 from
2
./gdbint.texinfo.
3
 
4
INFO-DIR-SECTION Programming & development tools.
5
START-INFO-DIR-ENTRY
6
* Gdb-Internals: (gdbint).      The GNU debugger's internals.
7
END-INFO-DIR-ENTRY
8
 
9
   This file documents the internals of the GNU debugger GDB.
10
Copyright 1990,1991,1992,1993,1994,1996,1998,1999,2000,2001,2002
11
Free Software Foundation, Inc.  Contributed by Cygnus Solutions.
12
Written by John Gilmore.  Second Edition by Stan Shebs.
13
 
14
   Permission is granted to copy, distribute and/or modify this document
15
under the terms of the GNU Free Documentation License, Version 1.1 or
16
any later version published by the Free Software Foundation; with no
17
Invariant Sections, with the Front-Cover Texts being "A GNU Manual,"
18
and with the Back-Cover Texts as in (a) below.
19
 
20
   (a) The FSF's Back-Cover Text is: "You have freedom to copy and
21
modify this GNU Manual, like GNU software.  Copies published by the Free
22
Software Foundation raise funds for GNU development."
23
 
24

25
File: gdbint.info,  Node: libgdb,  Next: Symbol Handling,  Prev: User Interface,  Up: Top
26
 
27
libgdb
28
******
29
 
30
libgdb 1.0
31
==========
32
 
33
   `libgdb' 1.0 was an abortive project of years ago.  The theory was
34
to provide an API to GDB's functionality.
35
 
36
libgdb 2.0
37
==========
38
 
39
   `libgdb' 2.0 is an ongoing effort to update GDB so that is better
40
able to support graphical and other environments.
41
 
42
   Since `libgdb' development is on-going, its architecture is still
43
evolving.  The following components have so far been identified:
44
 
45
   * Observer - `gdb-events.h'.
46
 
47
   * Builder - `ui-out.h'
48
 
49
   * Event Loop - `event-loop.h'
50
 
51
   * Library - `gdb.h'
52
 
53
   The model that ties these components together is described below.
54
 
55
The `libgdb' Model
56
==================
57
 
58
   A client of `libgdb' interacts with the library in two ways.
59
 
60
   * As an observer (using `gdb-events') receiving notifications from
61
     `libgdb' of any internal state changes (break point changes, run
62
     state, etc).
63
 
64
   * As a client querying `libgdb' (using the `ui-out' builder) to
65
     obtain various status values from GDB.
66
 
67
   Since `libgdb' could have multiple clients (e.g. a GUI supporting
68
the existing GDB CLI), those clients must co-operate when controlling
69
`libgdb'.  In particular, a client must ensure that `libgdb' is idle
70
(i.e. no other client is using `libgdb') before responding to a
71
`gdb-event' by making a query.
72
 
73
CLI support
74
===========
75
 
76
   At present GDB's CLI is very much entangled in with the core of
77
`libgdb'.  Consequently, a client wishing to include the CLI in their
78
interface needs to carefully co-ordinate its own and the CLI's
79
requirements.
80
 
81
   It is suggested that the client set `libgdb' up to be bi-modal
82
(alternate between CLI and client query modes).  The notes below sketch
83
out the theory:
84
 
85
   * The client registers itself as an observer of `libgdb'.
86
 
87
   * The client create and install `cli-out' builder using its own
88
     versions of the `ui-file' `gdb_stderr', `gdb_stdtarg' and
89
     `gdb_stdout' streams.
90
 
91
   * The client creates a separate custom `ui-out' builder that is only
92
     used while making direct queries to `libgdb'.
93
 
94
   When the client receives input intended for the CLI, it simply
95
passes it along.  Since the `cli-out' builder is installed by default,
96
all the CLI output in response to that command is routed (pronounced
97
rooted) through to the client controlled `gdb_stdout' et. al. streams.
98
At the same time, the client is kept abreast of internal changes by
99
virtue of being a `libgdb' observer.
100
 
101
   The only restriction on the client is that it must wait until
102
`libgdb' becomes idle before initiating any queries (using the client's
103
custom builder).
104
 
105
`libgdb' components
106
===================
107
 
108
Observer - `gdb-events.h'
109
-------------------------
110
 
111
   `gdb-events' provides the client with a very raw mechanism that can
112
be used to implement an observer.  At present it only allows for one
113
observer and that observer must, internally, handle the need to delay
114
the processing of any event notifications until after `libgdb' has
115
finished the current command.
116
 
117
Builder - `ui-out.h'
118
--------------------
119
 
120
   `ui-out' provides the infrastructure necessary for a client to
121
create a builder.  That builder is then passed down to `libgdb' when
122
doing any queries.
123
 
124
Event Loop - `event-loop.h'
125
---------------------------
126
 
127
   `event-loop', currently non-re-entrant, provides a simple event
128
loop.  A client would need to either plug its self into this loop or,
129
implement a new event-loop that GDB would use.
130
 
131
   The event-loop will eventually be made re-entrant.  This is so that
132
{No value for `GDB'} can better handle the problem of some commands
133
blocking instead of returning.
134
 
135
Library - `gdb.h'
136
-----------------
137
 
138
   `libgdb' is the most obvious component of this system.  It provides
139
the query interface.  Each function is parameterized by a `ui-out'
140
builder.  The result of the query is constructed using that builder
141
before the query function returns.
142
 
143

144
File: gdbint.info,  Node: Symbol Handling,  Next: Language Support,  Prev: libgdb,  Up: Top
145
 
146
Symbol Handling
147
***************
148
 
149
   Symbols are a key part of GDB's operation.  Symbols include
150
variables, functions, and types.
151
 
152
Symbol Reading
153
==============
154
 
155
   GDB reads symbols from "symbol files".  The usual symbol file is the
156
file containing the program which GDB is debugging.  GDB can be
157
directed to use a different file for symbols (with the `symbol-file'
158
command), and it can also read more symbols via the `add-file' and
159
`load' commands, or while reading symbols from shared libraries.
160
 
161
   Symbol files are initially opened by code in `symfile.c' using the
162
BFD library (*note Support Libraries::).  BFD identifies the type of
163
the file by examining its header.  `find_sym_fns' then uses this
164
identification to locate a set of symbol-reading functions.
165
 
166
   Symbol-reading modules identify themselves to GDB by calling
167
`add_symtab_fns' during their module initialization.  The argument to
168
`add_symtab_fns' is a `struct sym_fns' which contains the name (or name
169
prefix) of the symbol format, the length of the prefix, and pointers to
170
four functions.  These functions are called at various times to process
171
symbol files whose identification matches the specified prefix.
172
 
173
   The functions supplied by each module are:
174
 
175
`XYZ_symfile_init(struct sym_fns *sf)'
176
     Called from `symbol_file_add' when we are about to read a new
177
     symbol file.  This function should clean up any internal state
178
     (possibly resulting from half-read previous files, for example)
179
     and prepare to read a new symbol file.  Note that the symbol file
180
     which we are reading might be a new "main" symbol file, or might
181
     be a secondary symbol file whose symbols are being added to the
182
     existing symbol table.
183
 
184
     The argument to `XYZ_symfile_init' is a newly allocated `struct
185
     sym_fns' whose `bfd' field contains the BFD for the new symbol
186
     file being read.  Its `private' field has been zeroed, and can be
187
     modified as desired.  Typically, a struct of private information
188
     will be `malloc''d, and a pointer to it will be placed in the
189
     `private' field.
190
 
191
     There is no result from `XYZ_symfile_init', but it can call
192
     `error' if it detects an unavoidable problem.
193
 
194
`XYZ_new_init()'
195
     Called from `symbol_file_add' when discarding existing symbols.
196
     This function needs only handle the symbol-reading module's
197
     internal state; the symbol table data structures visible to the
198
     rest of GDB will be discarded by `symbol_file_add'.  It has no
199
     arguments and no result.  It may be called after
200
     `XYZ_symfile_init', if a new symbol table is being read, or may be
201
     called alone if all symbols are simply being discarded.
202
 
203
`XYZ_symfile_read(struct sym_fns *sf, CORE_ADDR addr, int mainline)'
204
     Called from `symbol_file_add' to actually read the symbols from a
205
     symbol-file into a set of psymtabs or symtabs.
206
 
207
     `sf' points to the `struct sym_fns' originally passed to
208
     `XYZ_sym_init' for possible initialization.  `addr' is the offset
209
     between the file's specified start address and its true address in
210
     memory.  `mainline' is 1 if this is the main symbol table being
211
     read, and 0 if a secondary symbol file (e.g. shared library or
212
     dynamically loaded file) is being read.
213
 
214
   In addition, if a symbol-reading module creates psymtabs when
215
XYZ_symfile_read is called, these psymtabs will contain a pointer to a
216
function `XYZ_psymtab_to_symtab', which can be called from any point in
217
the GDB symbol-handling code.
218
 
219
`XYZ_psymtab_to_symtab (struct partial_symtab *pst)'
220
     Called from `psymtab_to_symtab' (or the `PSYMTAB_TO_SYMTAB' macro)
221
     if the psymtab has not already been read in and had its
222
     `pst->symtab' pointer set.  The argument is the psymtab to be
223
     fleshed-out into a symtab.  Upon return, `pst->readin' should have
224
     been set to 1, and `pst->symtab' should contain a pointer to the
225
     new corresponding symtab, or zero if there were no symbols in that
226
     part of the symbol file.
227
 
228
Partial Symbol Tables
229
=====================
230
 
231
   GDB has three types of symbol tables:
232
 
233
   * Full symbol tables ("symtabs").  These contain the main
234
     information about symbols and addresses.
235
 
236
   * Partial symbol tables ("psymtabs").  These contain enough
237
     information to know when to read the corresponding part of the full
238
     symbol table.
239
 
240
   * Minimal symbol tables ("msymtabs").  These contain information
241
     gleaned from non-debugging symbols.
242
 
243
   This section describes partial symbol tables.
244
 
245
   A psymtab is constructed by doing a very quick pass over an
246
executable file's debugging information.  Small amounts of information
247
are extracted--enough to identify which parts of the symbol table will
248
need to be re-read and fully digested later, when the user needs the
249
information.  The speed of this pass causes GDB to start up very
250
quickly.  Later, as the detailed rereading occurs, it occurs in small
251
pieces, at various times, and the delay therefrom is mostly invisible to
252
the user.
253
 
254
   The symbols that show up in a file's psymtab should be, roughly,
255
those visible to the debugger's user when the program is not running
256
code from that file.  These include external symbols and types, static
257
symbols and types, and `enum' values declared at file scope.
258
 
259
   The psymtab also contains the range of instruction addresses that the
260
full symbol table would represent.
261
 
262
   The idea is that there are only two ways for the user (or much of the
263
code in the debugger) to reference a symbol:
264
 
265
   * By its address (e.g. execution stops at some address which is
266
     inside a function in this file).  The address will be noticed to
267
     be in the range of this psymtab, and the full symtab will be read
268
     in.  `find_pc_function', `find_pc_line', and other `find_pc_...'
269
     functions handle this.
270
 
271
   * By its name (e.g. the user asks to print a variable, or set a
272
     breakpoint on a function).  Global names and file-scope names will
273
     be found in the psymtab, which will cause the symtab to be pulled
274
     in.  Local names will have to be qualified by a global name, or a
275
     file-scope name, in which case we will have already read in the
276
     symtab as we evaluated the qualifier.  Or, a local symbol can be
277
     referenced when we are "in" a local scope, in which case the first
278
     case applies.  `lookup_symbol' does most of the work here.
279
 
280
   The only reason that psymtabs exist is to cause a symtab to be read
281
in at the right moment.  Any symbol that can be elided from a psymtab,
282
while still causing that to happen, should not appear in it.  Since
283
psymtabs don't have the idea of scope, you can't put local symbols in
284
them anyway.  Psymtabs don't have the idea of the type of a symbol,
285
either, so types need not appear, unless they will be referenced by
286
name.
287
 
288
   It is a bug for GDB to behave one way when only a psymtab has been
289
read, and another way if the corresponding symtab has been read in.
290
Such bugs are typically caused by a psymtab that does not contain all
291
the visible symbols, or which has the wrong instruction address ranges.
292
 
293
   The psymtab for a particular section of a symbol file (objfile)
294
could be thrown away after the symtab has been read in.  The symtab
295
should always be searched before the psymtab, so the psymtab will never
296
be used (in a bug-free environment).  Currently, psymtabs are allocated
297
on an obstack, and all the psymbols themselves are allocated in a pair
298
of large arrays on an obstack, so there is little to be gained by
299
trying to free them unless you want to do a lot more work.
300
 
301
Types
302
=====
303
 
304
Fundamental Types (e.g., `FT_VOID', `FT_BOOLEAN').
305
--------------------------------------------------
306
 
307
   These are the fundamental types that GDB uses internally.
308
Fundamental types from the various debugging formats (stabs, ELF, etc)
309
are mapped into one of these.  They are basically a union of all
310
fundamental types that GDB knows about for all the languages that GDB
311
knows about.
312
 
313
Type Codes (e.g., `TYPE_CODE_PTR', `TYPE_CODE_ARRAY').
314
------------------------------------------------------
315
 
316
   Each time GDB builds an internal type, it marks it with one of these
317
types.  The type may be a fundamental type, such as `TYPE_CODE_INT', or
318
a derived type, such as `TYPE_CODE_PTR' which is a pointer to another
319
type.  Typically, several `FT_*' types map to one `TYPE_CODE_*' type,
320
and are distinguished by other members of the type struct, such as
321
whether the type is signed or unsigned, and how many bits it uses.
322
 
323
Builtin Types (e.g., `builtin_type_void', `builtin_type_char').
324
---------------------------------------------------------------
325
 
326
   These are instances of type structs that roughly correspond to
327
fundamental types and are created as global types for GDB to use for
328
various ugly historical reasons.  We eventually want to eliminate
329
these.  Note for example that `builtin_type_int' initialized in
330
`gdbtypes.c' is basically the same as a `TYPE_CODE_INT' type that is
331
initialized in `c-lang.c' for an `FT_INTEGER' fundamental type.  The
332
difference is that the `builtin_type' is not associated with any
333
particular objfile, and only one instance exists, while `c-lang.c'
334
builds as many `TYPE_CODE_INT' types as needed, with each one
335
associated with some particular objfile.
336
 
337
Object File Formats
338
===================
339
 
340
a.out
341
-----
342
 
343
   The `a.out' format is the original file format for Unix.  It
344
consists of three sections: `text', `data', and `bss', which are for
345
program code, initialized data, and uninitialized data, respectively.
346
 
347
   The `a.out' format is so simple that it doesn't have any reserved
348
place for debugging information.  (Hey, the original Unix hackers used
349
`adb', which is a machine-language debugger!)  The only debugging
350
format for `a.out' is stabs, which is encoded as a set of normal
351
symbols with distinctive attributes.
352
 
353
   The basic `a.out' reader is in `dbxread.c'.
354
 
355
COFF
356
----
357
 
358
   The COFF format was introduced with System V Release 3 (SVR3) Unix.
359
COFF files may have multiple sections, each prefixed by a header.  The
360
number of sections is limited.
361
 
362
   The COFF specification includes support for debugging.  Although this
363
was a step forward, the debugging information was woefully limited.  For
364
instance, it was not possible to represent code that came from an
365
included file.
366
 
367
   The COFF reader is in `coffread.c'.
368
 
369
ECOFF
370
-----
371
 
372
   ECOFF is an extended COFF originally introduced for Mips and Alpha
373
workstations.
374
 
375
   The basic ECOFF reader is in `mipsread.c'.
376
 
377
XCOFF
378
-----
379
 
380
   The IBM RS/6000 running AIX uses an object file format called XCOFF.
381
The COFF sections, symbols, and line numbers are used, but debugging
382
symbols are `dbx'-style stabs whose strings are located in the `.debug'
383
section (rather than the string table).  For more information, see
384
*Note Top: (stabs)Top.
385
 
386
   The shared library scheme has a clean interface for figuring out what
387
shared libraries are in use, but the catch is that everything which
388
refers to addresses (symbol tables and breakpoints at least) needs to be
389
relocated for both shared libraries and the main executable.  At least
390
using the standard mechanism this can only be done once the program has
391
been run (or the core file has been read).
392
 
393
PE
394
--
395
 
396
   Windows 95 and NT use the PE ("Portable Executable") format for their
397
executables.  PE is basically COFF with additional headers.
398
 
399
   While BFD includes special PE support, GDB needs only the basic COFF
400
reader.
401
 
402
ELF
403
---
404
 
405
   The ELF format came with System V Release 4 (SVR4) Unix.  ELF is
406
similar to COFF in being organized into a number of sections, but it
407
removes many of COFF's limitations.
408
 
409
   The basic ELF reader is in `elfread.c'.
410
 
411
SOM
412
---
413
 
414
   SOM is HP's object file and debug format (not to be confused with
415
IBM's SOM, which is a cross-language ABI).
416
 
417
   The SOM reader is in `hpread.c'.
418
 
419
Other File Formats
420
------------------
421
 
422
   Other file formats that have been supported by GDB include Netware
423
Loadable Modules (`nlmread.c').
424
 
425
Debugging File Formats
426
======================
427
 
428
   This section describes characteristics of debugging information that
429
are independent of the object file format.
430
 
431
stabs
432
-----
433
 
434
   `stabs' started out as special symbols within the `a.out' format.
435
Since then, it has been encapsulated into other file formats, such as
436
COFF and ELF.
437
 
438
   While `dbxread.c' does some of the basic stab processing, including
439
for encapsulated versions, `stabsread.c' does the real work.
440
 
441
COFF
442
----
443
 
444
   The basic COFF definition includes debugging information.  The level
445
of support is minimal and non-extensible, and is not often used.
446
 
447
Mips debug (Third Eye)
448
----------------------
449
 
450
   ECOFF includes a definition of a special debug format.
451
 
452
   The file `mdebugread.c' implements reading for this format.
453
 
454
DWARF 1
455
-------
456
 
457
   DWARF 1 is a debugging format that was originally designed to be
458
used with ELF in SVR4 systems.
459
 
460
   The DWARF 1 reader is in `dwarfread.c'.
461
 
462
DWARF 2
463
-------
464
 
465
   DWARF 2 is an improved but incompatible version of DWARF 1.
466
 
467
   The DWARF 2 reader is in `dwarf2read.c'.
468
 
469
SOM
470
---
471
 
472
   Like COFF, the SOM definition includes debugging information.
473
 
474
Adding a New Symbol Reader to GDB
475
=================================
476
 
477
   If you are using an existing object file format (`a.out', COFF, ELF,
478
etc), there is probably little to be done.
479
 
480
   If you need to add a new object file format, you must first add it to
481
BFD.  This is beyond the scope of this document.
482
 
483
   You must then arrange for the BFD code to provide access to the
484
debugging symbols.  Generally GDB will have to call swapping routines
485
from BFD and a few other BFD internal routines to locate the debugging
486
information.  As much as possible, GDB should not depend on the BFD
487
internal data structures.
488
 
489
   For some targets (e.g., COFF), there is a special transfer vector
490
used to call swapping routines, since the external data structures on
491
various platforms have different sizes and layouts.  Specialized
492
routines that will only ever be implemented by one object file format
493
may be called directly.  This interface should be described in a file
494
`bfd/libXYZ.h', which is included by GDB.
495
 
496

497
File: gdbint.info,  Node: Language Support,  Next: Host Definition,  Prev: Symbol Handling,  Up: Top
498
 
499
Language Support
500
****************
501
 
502
   GDB's language support is mainly driven by the symbol reader,
503
although it is possible for the user to set the source language
504
manually.
505
 
506
   GDB chooses the source language by looking at the extension of the
507
file recorded in the debug info; `.c' means C, `.f' means Fortran, etc.
508
It may also use a special-purpose language identifier if the debug
509
format supports it, like with DWARF.
510
 
511
Adding a Source Language to GDB
512
===============================
513
 
514
   To add other languages to GDB's expression parser, follow the
515
following steps:
516
 
517
_Create the expression parser._
518
     This should reside in a file `LANG-exp.y'.  Routines for building
519
     parsed expressions into a `union exp_element' list are in
520
     `parse.c'.
521
 
522
     Since we can't depend upon everyone having Bison, and YACC produces
523
     parsers that define a bunch of global names, the following lines
524
     *must* be included at the top of the YACC parser, to prevent the
525
     various parsers from defining the same global names:
526
 
527
          #define yyparse         LANG_parse
528
          #define yylex           LANG_lex
529
          #define yyerror         LANG_error
530
          #define yylval          LANG_lval
531
          #define yychar          LANG_char
532
          #define yydebug         LANG_debug
533
          #define yypact          LANG_pact
534
          #define yyr1            LANG_r1
535
          #define yyr2            LANG_r2
536
          #define yydef           LANG_def
537
          #define yychk           LANG_chk
538
          #define yypgo           LANG_pgo
539
          #define yyact           LANG_act
540
          #define yyexca          LANG_exca
541
          #define yyerrflag       LANG_errflag
542
          #define yynerrs         LANG_nerrs
543
 
544
     At the bottom of your parser, define a `struct language_defn' and
545
     initialize it with the right values for your language.  Define an
546
     `initialize_LANG' routine and have it call
547
     `add_language(LANG_language_defn)' to tell the rest of GDB that
548
     your language exists.  You'll need some other supporting variables
549
     and functions, which will be used via pointers from your
550
     `LANG_language_defn'.  See the declaration of `struct
551
     language_defn' in `language.h', and the other `*-exp.y' files, for
552
     more information.
553
 
554
_Add any evaluation routines, if necessary_
555
     If you need new opcodes (that represent the operations of the
556
     language), add them to the enumerated type in `expression.h'.  Add
557
     support code for these operations in the `evaluate_subexp' function
558
     defined in the file `eval.c'.  Add cases for new opcodes in two
559
     functions from `parse.c': `prefixify_subexp' and
560
     `length_of_subexp'.  These compute the number of `exp_element's
561
     that a given operation takes up.
562
 
563
_Update some existing code_
564
     Add an enumerated identifier for your language to the enumerated
565
     type `enum language' in `defs.h'.
566
 
567
     Update the routines in `language.c' so your language is included.
568
     These routines include type predicates and such, which (in some
569
     cases) are language dependent.  If your language does not appear
570
     in the switch statement, an error is reported.
571
 
572
     Also included in `language.c' is the code that updates the variable
573
     `current_language', and the routines that translate the
574
     `language_LANG' enumerated identifier into a printable string.
575
 
576
     Update the function `_initialize_language' to include your
577
     language.  This function picks the default language upon startup,
578
     so is dependent upon which languages that GDB is built for.
579
 
580
     Update `allocate_symtab' in `symfile.c' and/or symbol-reading code
581
     so that the language of each symtab (source file) is set properly.
582
     This is used to determine the language to use at each stack frame
583
     level.  Currently, the language is set based upon the extension of
584
     the source file.  If the language can be better inferred from the
585
     symbol information, please set the language of the symtab in the
586
     symbol-reading code.
587
 
588
     Add helper code to `print_subexp' (in `expprint.c') to handle any
589
     new expression opcodes you have added to `expression.h'.  Also,
590
     add the printed representations of your operators to
591
     `op_print_tab'.
592
 
593
_Add a place of call_
594
     Add a call to `LANG_parse()' and `LANG_error' in `parse_exp_1'
595
     (defined in `parse.c').
596
 
597
_Use macros to trim code_
598
     The user has the option of building GDB for some or all of the
599
     languages.  If the user decides to build GDB for the language
600
     LANG, then every file dependent on `language.h' will have the
601
     macro `_LANG_LANG' defined in it.  Use `#ifdef's to leave out
602
     large routines that the user won't need if he or she is not using
603
     your language.
604
 
605
     Note that you do not need to do this in your YACC parser, since if
606
     GDB is not build for LANG, then `LANG-exp.tab.o' (the compiled
607
     form of your parser) is not linked into GDB at all.
608
 
609
     See the file `configure.in' for how GDB is configured for
610
     different languages.
611
 
612
_Edit `Makefile.in'_
613
     Add dependencies in `Makefile.in'.  Make sure you update the macro
614
     variables such as `HFILES' and `OBJS', otherwise your code may not
615
     get linked in, or, worse yet, it may not get `tar'red into the
616
     distribution!
617
 
618

619
File: gdbint.info,  Node: Host Definition,  Next: Target Architecture Definition,  Prev: Language Support,  Up: Top
620
 
621
Host Definition
622
***************
623
 
624
   With the advent of Autoconf, it's rarely necessary to have host
625
definition machinery anymore.  The following information is provided,
626
mainly, as an historical reference.
627
 
628
Adding a New Host
629
=================
630
 
631
   GDB's host configuration support normally happens via Autoconf.  New
632
host-specific definitions should not be needed.  Older hosts GDB still
633
use the host-specific definitions and files listed below, but these
634
mostly exist for historical reasons, and will eventually disappear.
635
 
636
`gdb/config/ARCH/XYZ.mh'
637
     This file once contained both host and native configuration
638
     information (*note Native Debugging::) for the machine XYZ.  The
639
     host configuration information is now handed by Autoconf.
640
 
641
     Host configuration information included a definition of
642
     `XM_FILE=xm-XYZ.h' and possibly definitions for `CC',
643
     `SYSV_DEFINE', `XM_CFLAGS', `XM_ADD_FILES', `XM_CLIBS',
644
     `XM_CDEPS', etc.; see `Makefile.in'.
645
 
646
     New host only configurations do not need this file.
647
 
648
`gdb/config/ARCH/xm-XYZ.h'
649
     This file once contained definitions and includes required when
650
     hosting gdb on machine XYZ.  Those definitions and includes are now
651
     handled by Autoconf.
652
 
653
     New host and native configurations do not need this file.
654
 
655
     _Maintainer's note: Some hosts continue to use the `xm-xyz.h' file
656
     to define the macros HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT and
657
     HOST_LONG_DOUBLE_FORMAT.  That code also needs to be replaced with
658
     either an Autoconf or run-time test._
659
 
660
Generic Host Support Files
661
--------------------------
662
 
663
   There are some "generic" versions of routines that can be used by
664
various systems.  These can be customized in various ways by macros
665
defined in your `xm-XYZ.h' file.  If these routines work for the XYZ
666
host, you can just include the generic file's name (with `.o', not
667
`.c') in `XDEPFILES'.
668
 
669
   Otherwise, if your machine needs custom support routines, you will
670
need to write routines that perform the same functions as the generic
671
file.  Put them into `XYZ-xdep.c', and put `XYZ-xdep.o' into
672
`XDEPFILES'.
673
 
674
`ser-unix.c'
675
     This contains serial line support for Unix systems.  This is always
676
     included, via the makefile variable `SER_HARDWIRE'; override this
677
     variable in the `.mh' file to avoid it.
678
 
679
`ser-go32.c'
680
     This contains serial line support for 32-bit programs running
681
     under DOS, using the DJGPP (a.k.a. GO32) execution environment.
682
 
683
`ser-tcp.c'
684
     This contains generic TCP support using sockets.
685
 
686
Host Conditionals
687
=================
688
 
689
   When GDB is configured and compiled, various macros are defined or
690
left undefined, to control compilation based on the attributes of the
691
host system.  These macros and their meanings (or if the meaning is not
692
documented here, then one of the source files where they are used is
693
indicated) are:
694
 
695
`GDBINIT_FILENAME'
696
     The default name of GDB's initialization file (normally
697
     `.gdbinit').
698
 
699
`NO_STD_REGS'
700
     This macro is deprecated.
701
 
702
`NO_SYS_FILE'
703
     Define this if your system does not have a `'.
704
 
705
`SIGWINCH_HANDLER'
706
     If your host defines `SIGWINCH', you can define this to be the name
707
     of a function to be called if `SIGWINCH' is received.
708
 
709
`SIGWINCH_HANDLER_BODY'
710
     Define this to expand into code that will define the function
711
     named by the expansion of `SIGWINCH_HANDLER'.
712
 
713
`ALIGN_STACK_ON_STARTUP'
714
     Define this if your system is of a sort that will crash in
715
     `tgetent' if the stack happens not to be longword-aligned when
716
     `main' is called.  This is a rare situation, but is known to occur
717
     on several different types of systems.
718
 
719
`CRLF_SOURCE_FILES'
720
     Define this if host files use `\r\n' rather than `\n' as a line
721
     terminator.  This will cause source file listings to omit `\r'
722
     characters when printing and it will allow `\r\n' line endings of
723
     files which are "sourced" by gdb.  It must be possible to open
724
     files in binary mode using `O_BINARY' or, for fopen, `"rb"'.
725
 
726
`DEFAULT_PROMPT'
727
     The default value of the prompt string (normally `"(gdb) "').
728
 
729
`DEV_TTY'
730
     The name of the generic TTY device, defaults to `"/dev/tty"'.
731
 
732
`FCLOSE_PROVIDED'
733
     Define this if the system declares `fclose' in the headers included
734
     in `defs.h'.  This isn't needed unless your compiler is unusually
735
     anal.
736
 
737
`FOPEN_RB'
738
     Define this if binary files are opened the same way as text files.
739
 
740
`GETENV_PROVIDED'
741
     Define this if the system declares `getenv' in its headers included
742
     in `defs.h'.  This isn't needed unless your compiler is unusually
743
     anal.
744
 
745
`HAVE_MMAP'
746
     In some cases, use the system call `mmap' for reading symbol
747
     tables.  For some machines this allows for sharing and quick
748
     updates.
749
 
750
`HAVE_TERMIO'
751
     Define this if the host system has `termio.h'.
752
 
753
`INT_MAX'
754
`INT_MIN'
755
`LONG_MAX'
756
`UINT_MAX'
757
`ULONG_MAX'
758
     Values for host-side constants.
759
 
760
`ISATTY'
761
     Substitute for isatty, if not available.
762
 
763
`LONGEST'
764
     This is the longest integer type available on the host.  If not
765
     defined, it will default to `long long' or `long', depending on
766
     `CC_HAS_LONG_LONG'.
767
 
768
`CC_HAS_LONG_LONG'
769
     Define this if the host C compiler supports `long long'.  This is
770
     set by the `configure' script.
771
 
772
`PRINTF_HAS_LONG_LONG'
773
     Define this if the host can handle printing of long long integers
774
     via the printf format conversion specifier `ll'.  This is set by
775
     the `configure' script.
776
 
777
`HAVE_LONG_DOUBLE'
778
     Define this if the host C compiler supports `long double'.  This is
779
     set by the `configure' script.
780
 
781
`PRINTF_HAS_LONG_DOUBLE'
782
     Define this if the host can handle printing of long double
783
     float-point numbers via the printf format conversion specifier
784
     `Lg'.  This is set by the `configure' script.
785
 
786
`SCANF_HAS_LONG_DOUBLE'
787
     Define this if the host can handle the parsing of long double
788
     float-point numbers via the scanf format conversion specifier
789
     `Lg'.  This is set by the `configure' script.
790
 
791
`LSEEK_NOT_LINEAR'
792
     Define this if `lseek (n)' does not necessarily move to byte number
793
     `n' in the file.  This is only used when reading source files.  It
794
     is normally faster to define `CRLF_SOURCE_FILES' when possible.
795
 
796
`L_SET'
797
     This macro is used as the argument to `lseek' (or, most commonly,
798
     `bfd_seek').  FIXME, should be replaced by SEEK_SET instead, which
799
     is the POSIX equivalent.
800
 
801
`MMAP_BASE_ADDRESS'
802
     When using HAVE_MMAP, the first mapping should go at this address.
803
 
804
`MMAP_INCREMENT'
805
     when using HAVE_MMAP, this is the increment between mappings.
806
 
807
`NORETURN'
808
     If defined, this should be one or more tokens, such as `volatile',
809
     that can be used in both the declaration and definition of
810
     functions to indicate that they never return.  The default is
811
     already set correctly if compiling with GCC.  This will almost
812
     never need to be defined.
813
 
814
`ATTR_NORETURN'
815
     If defined, this should be one or more tokens, such as
816
     `__attribute__ ((noreturn))', that can be used in the declarations
817
     of functions to indicate that they never return.  The default is
818
     already set correctly if compiling with GCC.  This will almost
819
     never need to be defined.
820
 
821
`USE_GENERIC_DUMMY_FRAMES'
822
     Define this to 1 if the target is using the generic inferior
823
     function call code.  See `blockframe.c' for more information.
824
 
825
`USE_MMALLOC'
826
     GDB will use the `mmalloc' library for memory allocation for
827
     symbol reading if this symbol is defined.  Be careful defining it
828
     since there are systems on which `mmalloc' does not work for some
829
     reason.  One example is the DECstation, where its RPC library can't
830
     cope with our redefinition of `malloc' to call `mmalloc'.  When
831
     defining `USE_MMALLOC', you will also have to set `MMALLOC' in the
832
     Makefile, to point to the `mmalloc' library.  This define is set
833
     when you configure with `--with-mmalloc'.
834
 
835
`NO_MMCHECK'
836
     Define this if you are using `mmalloc', but don't want the overhead
837
     of checking the heap with `mmcheck'.  Note that on some systems,
838
     the C runtime makes calls to `malloc' prior to calling `main', and
839
     if `free' is ever called with these pointers after calling
840
     `mmcheck' to enable checking, a memory corruption abort is certain
841
     to occur.  These systems can still use `mmalloc', but must define
842
     `NO_MMCHECK'.
843
 
844
`MMCHECK_FORCE'
845
     Define this to 1 if the C runtime allocates memory prior to
846
     `mmcheck' being called, but that memory is never freed so we don't
847
     have to worry about it triggering a memory corruption abort.  The
848
     default is 0, which means that `mmcheck' will only install the heap
849
     checking functions if there has not yet been any memory allocation
850
     calls, and if it fails to install the functions, GDB will issue a
851
     warning.  This is currently defined if you configure using
852
     `--with-mmalloc'.
853
 
854
`NO_SIGINTERRUPT'
855
     Define this to indicate that `siginterrupt' is not available.
856
 
857
`SEEK_CUR'
858
`SEEK_SET'
859
     Define these to appropriate value for the system `lseek', if not
860
     already defined.
861
 
862
`STOP_SIGNAL'
863
     This is the signal for stopping GDB.  Defaults to `SIGTSTP'.
864
     (Only redefined for the Convex.)
865
 
866
`USE_O_NOCTTY'
867
     Define this if the interior's tty should be opened with the
868
     `O_NOCTTY' flag.  (FIXME: This should be a native-only flag, but
869
     `inflow.c' is always linked in.)
870
 
871
`USG'
872
     Means that System V (prior to SVR4) include files are in use.
873
     (FIXME: This symbol is abused in `infrun.c', `regex.c',
874
     `remote-nindy.c', and `utils.c' for other things, at the moment.)
875
 
876
`lint'
877
     Define this to help placate `lint' in some situations.
878
 
879
`volatile'
880
     Define this to override the defaults of `__volatile__' or `/**/'.
881
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.