use remote-utils facilities for baud_rate
[deliverable/binutils-gdb.git] / gdb / README
CommitLineData
804d23f3
JG
1 README for gdb-4.9 release
2 Updated 10-May-93 by Fred Fish
c45c19f8 3
846058ed 4This is GDB, the GNU source-level debugger, presently running under un*x.
c50c5197 5A summary of new features is in the file `NEWS'.
c45c19f8 6
bd5635a1 7
846058ed
JG
8Unpacking and Installation -- quick overview
9==========================
bd5635a1 10
fbda4193
JG
11In this release, the GDB debugger sources, the generic GNU include
12files, the BFD ("binary file description") library, the readline library,
c50c5197 13and other libraries all have directories of their own underneath
804d23f3 14the gdb-4.9 directory. The idea is that a variety of GNU tools can
fbda4193
JG
15share a common copy of these things. Configuration scripts and
16makefiles exist to cruise up and down this directory tree and
17automatically build all the pieces in the right order.
bd5635a1 18
804d23f3
JG
19When you unpack the gdb-4.9.tar.z or gdb-4.9.tar.Z file, you'll find
20a directory called `gdb-4.9', which contains:
bd5635a1 21
804d23f3
JG
22 Makefile.in config.sub* glob/ opcodes/
23 README configure* include/ readline/
24 bfd/ configure.in libiberty/ texinfo/
25 config/ etc/ mmalloc/
26 config.guess* gdb/ move-if-change*
170d0c85 27
846058ed 28To build GDB, you can just do:
170d0c85 29
804d23f3
JG
30 cd gdb-4.9
31 ./configure
170d0c85 32 make
846058ed 33 cp gdb/gdb /usr/local/bin/gdb (or wherever you want)
170d0c85 34
846058ed 35This will configure and build all the libraries as well as GDB.
804d23f3
JG
36If `configure' can't determine your system type, specify one as its
37argument, e.g. sun4 or decstation.
38
c45c19f8
JG
39If you get compiler warnings during this stage, see the `Reporting Bugs'
40section below; there are a few known problems.
361cc81a 41
c45c19f8 42GDB can be used as a cross-debugger, running on a machine of one type
846058ed
JG
43while debugging a program running on a machine of another type. See below.
44
45
46More Documentation
c50c5197 47******************
846058ed 48
804d23f3
JG
49 The GDB 4 release includes an already-formatted reference card,
50ready for printing with PostScript or GhostScript, in the `gdb'
51subdirectory of the main source directory. (In `gdb-4.9/gdb/refcard.ps'.)
52If you can use PostScript or GhostScript with your printer, you can
53print the reference card immediately with `refcard.ps'.
846058ed 54
c50c5197
JG
55 The release also includes the source for the reference card. You
56can format it, using TeX, by typing:
846058ed 57
575945e3 58 make refcard.dvi
846058ed 59
575945e3
JG
60 The GDB reference card is designed to print in landscape mode on US
61"letter" size paper; that is, on a sheet 11 inches wide by 8.5 inches
62high. You will need to specify this form of printing as an option to
63your DVI output program.
846058ed 64
c50c5197
JG
65 All the documentation for GDB comes as part of the machine-readable
66distribution. The documentation is written in Texinfo format, which is
67a documentation system that uses a single source file to produce both
68on-line information and a printed manual. You can use one of the Info
69formatting commands to create the on-line version of the documentation
70and TeX (or `texi2roff') to typeset the printed version.
846058ed 71
c50c5197
JG
72 GDB includes an already formatted copy of the on-line Info version of
73this manual in the `gdb' subdirectory. The main Info file is
575945e3 74`gdb-VERSION-NUMBER/gdb/gdb.info', and it refers to subordinate files
c50c5197
JG
75matching `gdb.info*' in the same directory. If necessary, you can
76print out these files, or read them with any editor; but they are
77easier to read using the `info' subsystem in GNU Emacs or the
78standalone `info' program, available as part of the GNU Texinfo
79distribution.
846058ed 80
575945e3 81 If you want to format these Info files yourself, you need one of the
c50c5197 82Info formatting programs, such as `texinfo-format-buffer' or `makeinfo'.
846058ed 83
575945e3 84 If you have `makeinfo' installed, and are in the top level GDB
804d23f3 85source directory (`gdb-4.9', in the case of version 4.9), you can make
575945e3 86the Info file by typing:
846058ed 87
575945e3
JG
88 cd gdb
89 make gdb.info
846058ed 90
804d23f3
JG
91 If you want to typeset and print copies of this manual, you need TeX,
92a program to print its DVI output files, and `texinfo.tex', the Texinfo
575945e3
JG
93definitions file.
94
804d23f3 95 TeX is a typesetting program; it does not print files directly, but
575945e3
JG
96produces output files called DVI files. To print a typeset document,
97you need a program to print DVI files. If your system has TeX
98installed, chances are it has such a program. The precise command to
804d23f3
JG
99use depends on your system; `lpr -d' is common; another (for PostScript
100devices) is `dvips'. The DVI print command may require a file name
101without any extension or a `.dvi' extension.
575945e3
JG
102
103 TeX also requires a macro definitions file called `texinfo.tex'.
104This file tells TeX how to typeset a document written in Texinfo
c50c5197
JG
105format. On its own, TeX cannot read, much less typeset a Texinfo file.
106 `texinfo.tex' is distributed with GDB and is located in the
575945e3
JG
107`gdb-VERSION-NUMBER/texinfo' directory.
108
c50c5197
JG
109 If you have TeX and a DVI printer program installed, you can typeset
110and print this manual. First switch to the the `gdb' subdirectory of
804d23f3 111the main source directory (for example, to `gdb-4.9/gdb') and then type:
170d0c85 112
846058ed 113 make gdb.dvi
170d0c85 114
c50c5197 115
846058ed 116Installing GDB
804d23f3 117**************
c45c19f8 118
846058ed
JG
119 GDB comes with a `configure' script that automates the process of
120preparing GDB for installation; you can then use `make' to build the
804d23f3 121`gdb' program.
c45c19f8 122
c50c5197
JG
123 The GDB distribution includes all the source code you need for GDB in
124a single directory, whose name is usually composed by appending the
575945e3
JG
125version number to `gdb'.
126
804d23f3 127 For example, the GDB version 4.9 distribution is in the `gdb-4.9'
575945e3 128directory. That directory contains:
c45c19f8 129
804d23f3 130`gdb-4.9/configure (and supporting files)'
fbda4193 131 script for configuring GDB and all its supporting libraries.
c45c19f8 132
804d23f3 133`gdb-4.9/gdb'
c45c19f8
JG
134 the source specific to GDB itself
135
804d23f3 136`gdb-4.9/bfd'
c50c5197 137 source for the Binary File Descriptor library
c45c19f8 138
804d23f3 139`gdb-4.9/include'
c45c19f8
JG
140 GNU include files
141
804d23f3 142`gdb-4.9/libiberty'
c45c19f8
JG
143 source for the `-liberty' free software library
144
804d23f3 145`gdb-4.9/opcodes'
c50c5197
JG
146 source for the library of opcode tables and disassemblers
147
804d23f3 148`gdb-4.9/readline'
c45c19f8
JG
149 source for the GNU command-line interface
150
804d23f3 151`gdb-4.9/glob'
c50c5197
JG
152 source for the GNU filename pattern-matching subroutine
153
804d23f3 154`gdb-4.9/mmalloc'
c50c5197
JG
155 source for the GNU memory-mapped malloc package
156
804d23f3
JG
157'gdb-4.9/sim'
158 source for some simulators (z8000, H8/300, H8/500, etc)
159
575945e3
JG
160 The simplest way to configure and build GDB is to run `configure'
161from the `gdb-VERSION-NUMBER' source directory, which in this example
804d23f3 162is the `gdb-4.9' directory.
575945e3 163
c50c5197
JG
164 First switch to the `gdb-VERSION-NUMBER' source directory if you are
165not already in it; then run `configure'. Pass the identifier for the
166platform on which GDB will run as an argument.
575945e3
JG
167
168 For example:
c45c19f8 169
804d23f3 170 cd gdb-4.9
c45c19f8
JG
171 ./configure HOST
172 make
173
575945e3
JG
174where HOST is an identifier such as `sun4' or `decstation', that
175identifies the platform where GDB will run.
176
c50c5197
JG
177 Running `configure HOST' followed by `make' builds the `bfd',
178`readline', `mmalloc', and `libiberty' libraries, then `gdb' itself.
179The configured source files, and the binaries, are left in the
180corresponding source directories.
fbda4193
JG
181
182 `configure' is a Bourne-shell (`/bin/sh') script; if your system
183does not recognize this automatically when you run a different shell,
575945e3
JG
184you may need to run `sh' on it explicitly:
185
186 sh configure HOST
fbda4193 187
575945e3 188 If you run `configure' from a directory that contains source
804d23f3
JG
189directories for multiple libraries or programs, such as the `gdb-4.9'
190source directory for version 4.9, `configure' creates configuration
575945e3
JG
191files for every directory level underneath (unless you tell it not to,
192with the `--norecursion' option).
193
194 You can run the `configure' script from any of the subordinate
c50c5197
JG
195directories in the GDB distribution, if you only want to configure that
196subdirectory; but be sure to specify a path to it.
575945e3 197
804d23f3 198 For example, with version 4.9, type the following to configure only
575945e3 199the `bfd' subdirectory:
fbda4193 200
804d23f3 201 cd gdb-4.9/bfd
fbda4193
JG
202 ../configure HOST
203
c50c5197
JG
204 You can install `gdb' anywhere; it has no hardwired paths. However,
205you should make sure that the shell on your path (named by the `SHELL'
206environment variable) is publicly readable. Remember that GDB uses the
207shell to start your program--some systems refuse to let GDB debug child
208processes whose programs are not readable.
c45c19f8 209
c45c19f8 210
804d23f3
JG
211Compiling GDB in another directory
212==================================
846058ed 213
fbda4193 214 If you want to run GDB versions for several host or target machines,
804d23f3 215you need a different `gdb' compiled for each combination of host and
c50c5197
JG
216target. `configure' is designed to make this easy by allowing you to
217generate each configuration in a separate subdirectory, rather than in
218the source directory. If your `make' program handles the `VPATH'
804d23f3
JG
219feature correctly (GNU `make' and SunOS 'make' are two that should),
220running `make' in each of these directories builds the `gdb' program
221specified there.
846058ed 222
575945e3 223 To build `gdb' in a separate directory, run `configure' with the
804d23f3
JG
224`--srcdir' option to specify where to find the source. (You also need
225to specify a path to find `configure' itself from your working
c50c5197
JG
226directory. If the path to `configure' would be the same as the
227argument to `--srcdir', you can leave out the `--srcdir' option; it
228will be assumed.)
c45c19f8 229
804d23f3 230 For example, with version 4.9, you can build GDB in a separate
575945e3 231directory for a Sun 4 like this:
c45c19f8 232
804d23f3 233 cd gdb-4.9
575945e3
JG
234 mkdir ../gdb-sun4
235 cd ../gdb-sun4
804d23f3 236 ../gdb-4.9/configure sun4
575945e3 237 make
c45c19f8 238
575945e3
JG
239 When `configure' builds a configuration using a remote source
240directory, it creates a tree for the binaries with the same structure
241(and using the same names) as the tree under the source directory. In
242the example, you'd find the Sun 4 library `libiberty.a' in the
243directory `gdb-sun4/libiberty', and GDB itself in `gdb-sun4/gdb'.
c45c19f8 244
c50c5197 245 One popular reason to build several GDB configurations in separate
575945e3
JG
246directories is to configure GDB for cross-compiling (where GDB runs on
247one machine--the host--while debugging programs that run on another
248machine--the target). You specify a cross-debugging target by giving
249the `--target=TARGET' option to `configure'.
846058ed 250
fbda4193 251 When you run `make' to build a program or library, you must run it
575945e3
JG
252in a configured directory--whatever directory you were in when you
253called `configure' (or one of its subdirectories).
846058ed 254
804d23f3 255 The `Makefile' that `configure' generates in each source directory
575945e3 256also runs recursively. If you type `make' in a source directory such
804d23f3
JG
257as `gdb-4.9' (or in a separate configured directory configured with
258`--srcdir=PATH/gdb-4.9'), you will build all the required libraries,
259and then build GDB.
c45c19f8 260
575945e3
JG
261 When you have multiple hosts or targets configured in separate
262directories, you can run `make' on them in parallel (for example, if
263they are NFS-mounted on each of the hosts); they will not interfere
264with each other.
fbda4193
JG
265
266
804d23f3
JG
267Specifying names for hosts and targets
268======================================
846058ed
JG
269
270 The specifications used for hosts and targets in the `configure'
271script are based on a three-part naming scheme, but some short
fbda4193
JG
272predefined aliases are also supported. The full naming scheme encodes
273three pieces of information in the following pattern:
846058ed
JG
274
275 ARCHITECTURE-VENDOR-OS
276
c50c5197 277 For example, you can use the alias `sun4' as a HOST argument or in a
804d23f3 278`--target=TARGET' option. The equivalent full name is
fbda4193 279`sparc-sun-sunos4'.
846058ed 280
575945e3
JG
281 The `configure' script accompanying GDB does not provide any query
282facility to list all supported host and target names or aliases.
283`configure' calls the Bourne shell script `config.sub' to map
fbda4193
JG
284abbreviations to full names; you can read the script, if you wish, or
285you can use it to test your guesses on abbreviations--for example:
846058ed
JG
286
287 % sh config.sub sun4
c50c5197 288 sparc-sun-sunos411
846058ed 289 % sh config.sub sun3
c50c5197 290 m68k-sun-sunos411
846058ed 291 % sh config.sub decstation
c50c5197 292 mips-dec-ultrix42
846058ed
JG
293 % sh config.sub hp300bsd
294 m68k-hp-bsd
295 % sh config.sub i386v
c50c5197
JG
296 i386-unknown-sysv
297 % sh config.sub i786v
298 Invalid configuration `i786v': machine `i786v' not recognized
fbda4193 299
575945e3 300`config.sub' is also distributed in the GDB source directory
804d23f3 301(`gdb-4.9', for version 4.9).
fbda4193 302
846058ed 303
804d23f3
JG
304`configure' options
305===================
c45c19f8 306
c50c5197
JG
307 Here is a summary of the `configure' options and arguments that are
308most often useful for building GDB. `configure' also has several other
309options not listed here. *note : (configure.info)What Configure Does,
310for a full explanation of `configure'.
c45c19f8 311
c50c5197
JG
312 configure [--help]
313 [--prefix=DIR]
314 [--srcdir=PATH]
575945e3
JG
315 [--norecursion] [--rm]
316 [--target=TARGET] HOST
c45c19f8 317
575945e3
JG
318You may introduce options with a single `-' rather than `--' if you
319prefer; but you may abbreviate option names if you use `--'.
c45c19f8 320
c50c5197
JG
321`--help'
322 Display a quick summary of how to invoke `configure'.
323
324`-prefix=DIR'
325 Configure the source to install programs and files under directory
326 `DIR'.
c45c19f8 327
575945e3 328`--srcdir=PATH'
c50c5197 329 *Warning: using this option requires GNU `make', or another `make'
804d23f3 330 that compatibly implements the `VPATH' feature.*
575945e3
JG
331 Use this option to make configurations in directories separate
332 from the GDB source directories. Among other things, you can use
c50c5197
JG
333 this to build (or maintain) several configurations simultaneously,
334 in separate directories. `configure' writes configuration
335 specific files in the current directory, but arranges for them to
336 use the source in the directory PATH. `configure' will create
337 directories under the working directory in parallel to the source
338 directories below PATH.
575945e3
JG
339
340`--norecursion'
341 Configure only the directory level where `configure' is executed;
342 do not propagate configuration to subdirectories.
343
344`--rm'
846058ed 345 Remove the configuration that the other arguments specify.
c45c19f8 346
575945e3 347`--target=TARGET'
c50c5197
JG
348 Configure GDB for cross-debugging programs running on the specified
349 TARGET. Without this option, GDB is configured to debug programs
350 that run on the same machine (HOST) as GDB itself.
846058ed
JG
351
352 There is no convenient way to generate a list of all available
353 targets.
c45c19f8
JG
354
355`HOST ...'
575945e3 356 Configure GDB to run on the specified HOST.
846058ed
JG
357
358 There is no convenient way to generate a list of all available
359 hosts.
c45c19f8
JG
360
361`configure' accepts other options, for compatibility with configuring
c50c5197
JG
362other GNU tools recursively; but these are the only options that affect
363GDB or its supporting libraries.
364
bd5635a1 365
c50c5197
JG
366Languages other than C
367=======================
bd5635a1 368
575945e3 369GDB provides some support for debugging C++ progams. Partial Modula-2
804d23f3
JG
370and Chill support is now in GDB. GDB should work with FORTRAN programs.
371(If you have problems, please send a bug report; you may have to refer to
372some FORTRAN variables with a trailing underscore). Pascal programs which
373use sets, subranges, file variables, or nested functions will not
374currently work.
bd5635a1 375
bd5635a1 376
c50c5197
JG
377Kernel debugging
378=================
bd5635a1 379
c45c19f8
JG
380I have't done this myself so I can't really offer any advice.
381Remote debugging over serial lines works fine, but the kernel debugging
c50c5197
JG
382code in here has not been tested in years. Van Jacobson has
383better kernel debugging, but the UC lawyers won't let FSF have it.
bd5635a1 384
bd5635a1 385
c50c5197
JG
386Remote debugging
387=================
bd5635a1 388
c50c5197
JG
389The files m68k-stub.c, i386-stub.c, and sparc-stub.c are examples of
390remote stubs to be used with remote.c. They are designed to run
804d23f3 391standalone on an m68k, i386, or SPARC cpu and communicate properly with
c50c5197 392the remote.c stub over a serial line.
361cc81a 393
170d0c85
RP
394The file rem-multi.shar contains a general stub that can probably
395run on various different flavors of unix to allow debugging over a
361cc81a 396serial line from one machine to another.
bd5635a1 397
fbda4193
JG
398Some working remote interfaces for talking to existing ROM monitors
399are:
804d23f3 400 remote-adapt.c AMD 29000 "Adapt"
fbda4193 401 remote-eb.c AMD 29000 "EBMON"
804d23f3 402 remote-es1800.c Ericsson 1800 monitor
c50c5197 403 remote-hms.c Hitachi Micro Systems H8/300 monitor
804d23f3 404 remote-mips.c MIPS remote debugging protocol
fbda4193 405 remote-mm.c AMD 29000 "minimon"
804d23f3
JG
406 remote-nindy.c Intel 960 "Nindy"
407 remote-sim.c Generalized simulator protocol
408 remote-st2000.c Tandem ST-2000 monitor
409 remote-udi.c AMD 29000 using the AMD "Universal Debug Interface"
410 remote-vx.c VxWorks realtime kernel
411 remote-z8k.c Zilog Z8000 simulator
170d0c85
RP
412
413Remote-vx.c and the vx-share subdirectory contain a remote interface for the
414VxWorks realtime kernel, which communicates over TCP using the Sun
415RPC library. This would be a useful starting point for other remote-
416via-ethernet back ends.
bd5635a1 417
804d23f3
JG
418Remote-udi.c and the 29k-share subdirectory contain a remote interface
419for AMD 29000 programs, which uses the AMD "Universal Debug Interface".
420This allows GDB to talk to software simulators, emulators, and/or bare
421hardware boards, via network or serial interfaces. Note that GDB only
422provides an interface that speaks UDI, not a complete solution. You
423will need something on the other end that also speaks UDI.
424
c45c19f8 425
c50c5197
JG
426Reporting Bugs
427===============
c45c19f8
JG
428
429The correct address for reporting bugs found in gdb is
804d23f3
JG
430"bug-gdb@prep.ai.mit.edu". Please email all bugs, and all requests for
431help with GDB, to that address. Please include the GDB version number
432(e.g. gdb-4.9), and how you configured it (e.g. "sun4" or "mach386
433host, i586-intel-synopsys target"). If you include the banner that GDB
434prints when it starts up, that will give us enough information.
435
436For more information on how/whether to report bugs, see the GDB Bugs
437section of the GDB manual (gdb/doc/gdb.texinfo).
438
439Known bugs:
440
441 * Under Ultrix 4.2 (DECstation-3100), we have seen problems with backtraces
442 after interrupting the inferior out of a read(). The problem is caused by
443 ptrace() returning an incorrect value for register 30. As far as we can
444 tell, this is a kernel problem. Any help with this would be greatly
445 appreciated.
fbda4193 446
804d23f3
JG
447 * On the SPARC GDB reports incorrect values of struct arguments to
448 functions, for the seventh and subsequent arguments. We have been looking
449 at this but no fix is available yet.
fbda4193 450
804d23f3
JG
451 * On DECstations there are warnings about shift counts out of range in
452 various BFD modules. None of them is a cause for alarm, they are actually
453 a result of bugs in the DECstation compiler.
454
455 * On Solaris using the "run" command when the program is already running
456 restarts the program, but may leave a core dump from the previous
457 execution in the current directory. Other SVR4 based systems don't seem
458 to have this problem, using the same gdb source code.
bd5635a1 459
846058ed
JG
460GDB can produce warnings about symbols that it does not understand. By
461default, these warnings are disabled. You can enable them by executing
462`set complaint 10' (which you can put in your ~/.gdbinit if you like).
463I recommend doing this if you are working on a compiler, assembler,
464linker, or gdb, since it will point out problems that you may be able
465to fix. Warnings produced during symbol reading indicate some mismatch
fbda4193 466between the object file and GDB's symbol reading code. In many cases,
846058ed 467it's a mismatch between the specs for the object file format, and what
fbda4193 468the compiler actually outputs or the debugger actually understands.
c45c19f8 469
c45c19f8 470
c50c5197
JG
471X Windows versus GDB
472=====================
bd5635a1 473
804d23f3
JG
474There is an "xxgdb", which seems to work for simple operations,
475which was posted to comp.sources.x.
bd5635a1 476
804d23f3 477For those interested in auto display of source and the availability of
bd5635a1
RP
478an editor while debugging I suggest trying gdb-mode in gnu-emacs
479(Try typing M-x gdb RETURN). Comments on this mode are welcome.
480
c45c19f8 481
c50c5197
JG
482Writing Code for GDB
483=====================
484
804d23f3
JG
485There is a lot of information about writing code for GDB in the
486internals manual, distributed with GDB in gdb/doc/gdbint.texinfo. You
487can read it by hand, print it by using TeX and texinfo, or process it
488into an `info' file for use with Emacs' info mode or the standalone
489`info' program. In particular, see the nodes Getting Started,
490Debugging GDB, New Architectures, Coding Style, Clean Design, and
491Submitting Patches.
492
493If you are pondering writing anything but a short patch, especially
494take note of the information about copyrights in the node Submitting
495Patches. It can take quite a while to get all the paperwork done, so
496we encourage you to start that process as soon as you decide you are
497planning to work on something, or at least well ahead of when you
498think you will be ready to submit the patches.
499
500
501GDB Testsuite
502=============
503
504There is a dejagnu based testsuite available for testing your newly
505built gdb, or for regression testing gdb's with local modifications.
506The testsuite is distributed separately from the base gdb distribution
507for the convenience of people that wish to get either gdb or the testsuite
508separately.
509
510The name of the testsuite is gdb-4.9-testsuite.tar.z. You unpack it in the
511same directory in which you unpacked the base gdb distribution, and it
512will create and populate the directory gdb-4.9/gdb/testsuite.
513
514Running the testsuite requires the prior installation of dejagnu, which
515should be available via ftp. Once dejagnu is installed, you can run
516the tests in one of two ways:
517
518 (1) cd gdb-4.9/gdb (assuming you also unpacked gdb)
519 make check
bd5635a1 520
804d23f3 521or
bd5635a1 522
804d23f3
JG
523 (2) cd gdb-4.9/gdb/testsuite
524 make (builds the test executables)
525 make site.exp (builds the site specific file)
526 runtest -tool gdb GDB=../gdb (or GDB=<somepath> as appropriate)
c45c19f8 527
804d23f3
JG
528The second method gives you slightly more control in case of problems with
529building one or more test executables, in case you wish to remove some
530test executables before running the tests, or if you are using the testsuite
531'standalone', without it being part of the gdb source tree.
846058ed 532
804d23f3 533See the dejagnu documentation for further details.
c45c19f8 534
bd5635a1
RP
535\f
536(this is for editing this file with GNU emacs)
537Local Variables:
538mode: text
539End:
This page took 0.126047 seconds and 4 git commands to generate.