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