Doco problem with alpha-dec-osf5.1.
[deliverable/binutils-gdb.git] / gdb / README
1 README for gdb-5.1 release
2 Updated 20 October 2001 by Andrew Cagney
3
4 This is GDB, the GNU source-level debugger.
5 A summary of new features is in the file `NEWS'.
6
7 See the GDB home page at http://www.gnu.org/software/gdb/ for up to
8 date release information, mailing list links and archives, etc.
9
10
11 Unpacking and Installation -- quick overview
12 ==========================
13
14 In this release, the GDB debugger sources, the generic GNU include
15 files, the BFD ("binary file description") library, the readline
16 library, and other libraries all have directories of their own
17 underneath the gdb-5.1 directory. The idea is that a variety of GNU
18 tools can share a common copy of these things. Be aware of variation
19 over time--for example don't try to build gdb with a copy of bfd from
20 a release other than the gdb release (such as a binutils release),
21 especially if the releases are more than a few weeks apart.
22 Configuration scripts and makefiles exist to cruise up and down this
23 directory tree and automatically build all the pieces in the right
24 order.
25
26 When you unpack the gdb-5.1.tar.gz file, you'll find a directory
27 called `gdb-5.1', which contains:
28
29 COPYING config.sub intl missing opcodes
30 COPYING.LIB configure libiberty mkinstalldirs readline
31 Makefile.in configure.in libtool.m4 mmalloc sim
32 README djunpack.bat ltcf-c.sh move-if-change symlink-tree
33 bfd etc ltcf-cxx.sh mpw-README texinfo
34 config gdb ltcf-gcj.sh mpw-build.in utils
35 config-ml.in gettext.m4 ltconfig mpw-config.in ylwrap
36 config.guess include ltmain.sh mpw-configure
37 config.if install-sh md5.sum mpw-install
38
39 You can build GDB right in the source directory:
40
41 cd gdb-5.1
42 ./configure
43 make
44 cp gdb/gdb /usr/local/bin/gdb (or wherever you want)
45
46 However, we recommend that an empty directory be used instead.
47 This way you do not clutter your source tree with binary files
48 and will be able to create different builds with different
49 configuration options.
50
51 You can build GDB in any empty build directory:
52
53 mkdir build
54 cd build
55 <full path to your sources>/gdb-5.1/configure
56 make
57 cp gdb/gdb /usr/local/bin/gdb (or wherever you want)
58
59 (Building GDB with DJGPP tools for MS-DOS/MS-Windows is slightly
60 different; see the file gdb-5.1/gdb/config/djgpp/README for details.)
61
62 This will configure and build all the libraries as well as GDB. If
63 `configure' can't determine your system type, specify one as its
64 argument, e.g., `./configure sun4' or `./configure decstation'.
65
66 If you get compiler errors during this stage, see the `Reporting
67 Bugs' section below; there are a few known problems.
68
69 GDB requires an ISO C (ANSI C) compiler. If you do not have an ISO
70 C compiler for your system, you may be able to download and install
71 the GNU CC compiler. It is available via anonymous FTP from the
72 directory `ftp://ftp.gnu.org/pub/gnu/gcc'.
73
74 GDB can be used as a cross-debugger, running on a machine of one
75 type while debugging a program running on a machine of another type.
76 See below.
77
78
79 More Documentation
80 ******************
81
82 All the documentation for GDB comes as part of the machine-readable
83 distribution. The documentation is written in Texinfo format, which
84 is a documentation system that uses a single source file to produce
85 both on-line information and a printed manual. You can use one of the
86 Info formatting commands to create the on-line version of the
87 documentation and TeX (or `texi2roff') to typeset the printed version.
88
89 GDB includes an already formatted copy of the on-line Info version
90 of this manual in the `gdb/doc' subdirectory. The main Info file is
91 `gdb-5.1/gdb/doc/gdb.info', and it refers to subordinate files
92 matching `gdb.info*' in the same directory. If necessary, you can
93 print out these files, or read them with any editor; but they are
94 easier to read using the `info' subsystem in GNU Emacs or the
95 standalone `info' program, available as part of the GNU Texinfo
96 distribution.
97
98 If you want to format these Info files yourself, you need one of the
99 Info formatting programs, such as `texinfo-format-buffer' or
100 `makeinfo'.
101
102 If you have `makeinfo' installed, and are in the top level GDB
103 source directory (`gdb-5.1', in the case of version 5.1), you can make
104 the Info file by typing:
105
106 cd gdb/doc
107 make info
108
109 If you want to typeset and print copies of this manual, you need
110 TeX, a program to print its DVI output files, and `texinfo.tex', the
111 Texinfo definitions file. This file is included in the GDB
112 distribution, in the directory `gdb-5.1/texinfo'.
113
114 TeX is a typesetting program; it does not print files directly, but
115 produces output files called DVI files. To print a typeset document,
116 you need a program to print DVI files. If your system has TeX
117 installed, chances are it has such a program. The precise command to
118 use depends on your system; `lpr -d' is common; another (for PostScript
119 devices) is `dvips'. The DVI print command may require a file name
120 without any extension or a `.dvi' extension.
121
122 TeX also requires a macro definitions file called `texinfo.tex'.
123 This file tells TeX how to typeset a document written in Texinfo
124 format. On its own, TeX cannot read, much less typeset a Texinfo file.
125 `texinfo.tex' is distributed with GDB and is located in the
126 `gdb-5.1/texinfo' directory.
127
128 If you have TeX and a DVI printer program installed, you can typeset
129 and print this manual. First switch to the the `gdb' subdirectory of
130 the main source directory (for example, to `gdb-5.1/gdb') and then type:
131
132 make doc/gdb.dvi
133
134 If you prefer to have the manual in PDF format, type this from the
135 `gdb/doc' subdirectory of the main source directory:
136
137 make gdb.pdf
138
139 For this to work, you will need the PDFTeX package to be installed.
140
141
142 Installing GDB
143 **************
144
145 GDB comes with a `configure' script that automates the process of
146 preparing GDB for installation; you can then use `make' to build the
147 `gdb' program.
148
149 The GDB distribution includes all the source code you need for GDB in
150 a single directory, whose name is usually composed by appending the
151 version number to `gdb'.
152
153 For example, the GDB version 5.1 distribution is in the `gdb-5.1'
154 directory. That directory contains:
155
156 `gdb-5.1/{COPYING,COPYING.LIB}'
157 Standard GNU license files. Please read them.
158
159 `gdb-5.1/bfd'
160 source for the Binary File Descriptor library
161
162 `gdb-5.1/config*'
163 script for configuring GDB, along with other support files
164
165 `gdb-5.1/gdb'
166 the source specific to GDB itself
167
168 `gdb-5.1/include'
169 GNU include files
170
171 `gdb-5.1/libiberty'
172 source for the `-liberty' free software library
173
174 `gdb-5.1/mmalloc'
175 source for the GNU memory-mapped malloc package
176
177 `gdb-5.1/opcodes'
178 source for the library of opcode tables and disassemblers
179
180 `gdb-5.1/readline'
181 source for the GNU command-line interface
182 NOTE: The readline library is compiled for use by GDB, but will
183 not be installed on your system when "make install" is issued.
184
185 `gdb-5.1/sim'
186 source for some simulators (ARM, D10V, SPARC, M32R, MIPS, PPC, V850, etc)
187
188 `gdb-5.1/intl'
189 source for the GNU gettext library, for internationalization.
190 This is slightly modified from the standalone gettext
191 distribution you can get from GNU.
192
193 `gdb-5.1/texinfo'
194 The `texinfo.tex' file, which you need in order to make a printed
195 manual using TeX.
196
197 `gdb-5.1/etc'
198 Coding standards, useful files for editing GDB, and other
199 miscellanea.
200
201 `gdb-5.1/utils'
202 A grab bag of random utilities.
203
204 Note: the following instructions are for building GDB on Unix or
205 Unix-like systems. Instructions for building with DJGPP for
206 MS-DOS/MS-Windows are in the file gdb/config/djgpp/README.
207
208 The simplest way to configure and build GDB is to run `configure'
209 from the `gdb-VERSION-NUMBER' source directory, which in this example
210 is the `gdb-5.1' directory.
211
212 First switch to the `gdb-VERSION-NUMBER' source directory if you are
213 not already in it; then run `configure'.
214
215 For example:
216
217 cd gdb-5.1
218 ./configure
219 make
220
221 Running `configure' followed by `make' builds the `bfd',
222 `readline', `mmalloc', and `libiberty' libraries, then `gdb' itself.
223 The configured source files, and the binaries, are left in the
224 corresponding source directories.
225
226 `configure' is a Bourne-shell (`/bin/sh') script; if your system
227 does not recognize this automatically when you run a different shell,
228 you may need to run `sh' on it explicitly:
229
230 sh configure
231
232 If you run `configure' from a directory that contains source
233 directories for multiple libraries or programs, such as the `gdb-5.1'
234 source directory for version 5.1, `configure' creates configuration
235 files for every directory level underneath (unless you tell it not to,
236 with the `--norecursion' option).
237
238 You can run the `configure' script from any of the subordinate
239 directories in the GDB distribution, if you only want to configure that
240 subdirectory; but be sure to specify a path to it.
241
242 For example, with version 5.1, type the following to configure only
243 the `bfd' subdirectory:
244
245 cd gdb-5.1/bfd
246 ../configure
247
248 You can install `gdb' anywhere; it has no hardwired paths. However,
249 you should make sure that the shell on your path (named by the `SHELL'
250 environment variable) is publicly readable. Remember that GDB uses the
251 shell to start your program--some systems refuse to let GDB debug child
252 processes whose programs are not readable.
253
254
255 Compiling GDB in another directory
256 ==================================
257
258 If you want to run GDB versions for several host or target machines,
259 you need a different `gdb' compiled for each combination of host and
260 target. `configure' is designed to make this easy by allowing you to
261 generate each configuration in a separate subdirectory, rather than in
262 the source directory. If your `make' program handles the `VPATH'
263 feature correctly (GNU `make' and SunOS 'make' are two that should),
264 running `make' in each of these directories builds the `gdb' program
265 specified there.
266
267 To build `gdb' in a separate directory, run `configure' with the
268 `--srcdir' option to specify where to find the source. (You also need
269 to specify a path to find `configure' itself from your working
270 directory. If the path to `configure' would be the same as the
271 argument to `--srcdir', you can leave out the `--srcdir' option; it
272 will be assumed.)
273
274 For example, with version 5.1, you can build GDB in a separate
275 directory for a Sun 4 like this:
276
277 cd gdb-5.1
278 mkdir ../gdb-sun4
279 cd ../gdb-sun4
280 ../gdb-5.1/configure
281 make
282
283 When `configure' builds a configuration using a remote source
284 directory, it creates a tree for the binaries with the same structure
285 (and using the same names) as the tree under the source directory. In
286 the example, you'd find the Sun 4 library `libiberty.a' in the
287 directory `gdb-sun4/libiberty', and GDB itself in `gdb-sun4/gdb'.
288
289 One popular reason to build several GDB configurations in separate
290 directories is to configure GDB for cross-compiling (where GDB runs on
291 one machine--the host--while debugging programs that run on another
292 machine--the target). You specify a cross-debugging target by giving
293 the `--target=TARGET' option to `configure'.
294
295 When you run `make' to build a program or library, you must run it
296 in a configured directory--whatever directory you were in when you
297 called `configure' (or one of its subdirectories).
298
299 The `Makefile' that `configure' generates in each source directory
300 also runs recursively. If you type `make' in a source directory such
301 as `gdb-5.1' (or in a separate configured directory configured with
302 `--srcdir=PATH/gdb-5.1'), you will build all the required libraries,
303 and then build GDB.
304
305 When you have multiple hosts or targets configured in separate
306 directories, you can run `make' on them in parallel (for example, if
307 they are NFS-mounted on each of the hosts); they will not interfere
308 with each other.
309
310
311 Specifying names for hosts and targets
312 ======================================
313
314 The specifications used for hosts and targets in the `configure'
315 script are based on a three-part naming scheme, but some short
316 predefined aliases are also supported. The full naming scheme encodes
317 three pieces of information in the following pattern:
318
319 ARCHITECTURE-VENDOR-OS
320
321 For example, you can use the alias `sun4' as a HOST argument or in a
322 `--target=TARGET' option. The equivalent full name is
323 `sparc-sun-sunos4'.
324
325 The `configure' script accompanying GDB does not provide any query
326 facility to list all supported host and target names or aliases.
327 `configure' calls the Bourne shell script `config.sub' to map
328 abbreviations to full names; you can read the script, if you wish, or
329 you can use it to test your guesses on abbreviations--for example:
330
331 % sh config.sub sun4
332 sparc-sun-sunos4.1.1
333 % sh config.sub sun3
334 m68k-sun-sunos4.1.1
335 % sh config.sub decstation
336 mips-dec-ultrix4.2
337 % sh config.sub hp300bsd
338 m68k-hp-bsd
339 % sh config.sub i386v
340 i386-pc-sysv
341 % sh config.sub i786v
342 Invalid configuration `i786v': machine `i786v' not recognized
343
344 `config.sub' is also distributed in the GDB source directory
345 (`gdb-5.1', for version 5.1).
346
347
348 `configure' options
349 ===================
350
351 Here is a summary of the `configure' options and arguments that are
352 most often useful for building GDB. `configure' also has several other
353 options not listed here. *note : (configure.info)What Configure Does,
354 for a full explanation of `configure'.
355
356 configure [--help]
357 [--prefix=DIR]
358 [--srcdir=PATH]
359 [--norecursion] [--rm]
360 [--enable-build-warnings]
361 [--target=TARGET]
362 [--host=HOST]
363 [HOST]
364
365 You may introduce options with a single `-' rather than `--' if you
366 prefer; but you may abbreviate option names if you use `--'.
367
368 `--help'
369 Display a quick summary of how to invoke `configure'.
370
371 `-prefix=DIR'
372 Configure the source to install programs and files under directory
373 `DIR'.
374
375 `--srcdir=PATH'
376 *Warning: using this option requires GNU `make', or another `make'
377 that compatibly implements the `VPATH' feature.*
378 Use this option to make configurations in directories separate
379 from the GDB source directories. Among other things, you can use
380 this to build (or maintain) several configurations simultaneously,
381 in separate directories. `configure' writes configuration
382 specific files in the current directory, but arranges for them to
383 use the source in the directory PATH. `configure' will create
384 directories under the working directory in parallel to the source
385 directories below PATH.
386
387 `--norecursion'
388 Configure only the directory level where `configure' is executed;
389 do not propagate configuration to subdirectories.
390
391 `--rm'
392 Remove the configuration that the other arguments specify.
393
394 `--enable-build-warnings'
395 When building the GDB sources, ask the compiler to warn about any
396 code which looks even vaguely suspicious. You should only using
397 this feature if you're compiling with GNU CC. It passes the
398 following flags:
399 -Wimplicit
400 -Wreturn-type
401 -Wcomment
402 -Wtrigraphs
403 -Wformat
404 -Wparentheses
405 -Wpointer-arith
406
407 `--target=TARGET'
408 Configure GDB for cross-debugging programs running on the specified
409 TARGET. Without this option, GDB is configured to debug programs
410 that run on the same machine (HOST) as GDB itself.
411
412 There is no convenient way to generate a list of all available
413 targets.
414
415 `--host=HOST'
416 Configure GDB to run on the specified HOST.
417
418 There is no convenient way to generate a list of all available
419 hosts.
420
421 `HOST ...'
422 Same as `--host=HOST'. If you omit this, GDB will guess; it's
423 quite accurate.
424
425 `configure' accepts other options, for compatibility with configuring
426 other GNU tools recursively; but these are the only options that affect
427 GDB or its supporting libraries.
428
429
430 Host/target specific installation notes
431 =======================================
432
433 hppa2.0-hp-hpux10.20
434
435 Due to a problem with libiberty/regex.c, GDB does not build on HP/UX
436 10.20 when using the HP supplied compiler.
437
438 Due to bit rot problems, GDB does not work on HP/UX 10.20 when built
439 with GCC.
440
441
442 hppa2.0w-hp-hpux11.00
443
444 Due to a problem with ltconfig and long argument lines, GDB does not
445 configure on HP/UX 11.00.
446
447
448 alpha-dec-osf5.1
449
450 Due to a problem in GDB's symbol table reader, GDB builds but does not
451 run on this platform. See gdb/237.
452
453
454 Remote debugging
455 =================
456
457 The files m68k-stub.c, i386-stub.c, and sparc-stub.c are examples
458 of remote stubs to be used with remote.c. They are designed to run
459 standalone on an m68k, i386, or SPARC cpu and communicate properly
460 with the remote.c stub over a serial line.
461
462 The directory gdb/gdbserver/ contains `gdbserver', a program that
463 allows remote debugging for Unix applications. gdbserver is only
464 supported for some native configurations, including Sun 3, Sun 4, and
465 Linux.
466
467 There are a number of remote interfaces for talking to existing ROM
468 monitors and other hardware:
469
470 remote-adapt.c AMD 29000 "Adapt"
471 remote-array.c Array Tech RAID controller
472 remote-bug.c Motorola BUG monitor
473 remote-e7000.c Hitachi E7000 ICE
474 remote-eb.c AMD 29000 "EBMON"
475 remote-es.c Ericsson 1800 monitor
476 remote-est.c EST emulator
477 remote-hms.c Hitachi Micro Systems H8/300 monitor
478 remote-mips.c MIPS remote debugging protocol
479 remote-mm.c AMD 29000 "minimon"
480 remote-nindy.c Intel 960 "Nindy"
481 remote-nrom.c NetROM ROM emulator
482 remote-os9k.c PC running OS/9000
483 remote-rdi.c ARM with Angel monitor
484 remote-rdp.c ARM with Demon monitor
485 remote-sds.c PowerPC SDS monitor
486 remote-sim.c Generalized simulator protocol
487 remote-st.c Tandem ST-2000 monitor
488 remote-udi.c AMD 29000 using the AMD "Universal Debug Interface"
489 remote-vx.c VxWorks realtime kernel
490
491 Remote-vx.c and the vx-share subdirectory contain a remote
492 interface for the VxWorks realtime kernel, which communicates over TCP
493 using the Sun RPC library. This would be a useful starting point for
494 other remote- via-ethernet back ends.
495
496 Remote-udi.c and the 29k-share subdirectory contain a remote
497 interface for AMD 29000 programs, which uses the AMD "Universal Debug
498 Interface". This allows GDB to talk to software simulators,
499 emulators, and/or bare hardware boards, via network or serial
500 interfaces. Note that GDB only provides an interface that speaks UDI,
501 not a complete solution. You will need something on the other end
502 that also speaks UDI.
503
504
505 Reporting Bugs
506 ===============
507
508 The correct address for reporting bugs found in gdb is
509 "bug-gdb@gnu.org". Please email all bugs, and all requests for help
510 with GDB, to that address. Please include the GDB version number
511 (e.g., gdb-5.1), and how you configured it (e.g., "sun4" or "mach386
512 host, i586-intel-synopsys target"). Since GDB now supports so many
513 different configurations, it is important that you be precise about
514 this. If at all possible, you should include the actual banner that
515 GDB prints when it starts up, or failing that, the actual configure
516 command that you used when configuring GDB.
517
518 For more information on how/whether to report bugs, see the GDB
519 Bugs section of the GDB manual (gdb/doc/gdb.texinfo) or the
520 gdb/CONTRIBUTE file.
521
522
523 Graphical interface to GDB -- X Windows, MS Windows
524 ==========================
525
526 Several graphical interfaces to GDB are available. You should
527 check:
528
529 http://sourceware.cygnus.com/gdb/#gui
530
531 for an up-to-date list.
532
533 Emacs users will very likely enjoy the Grand Unified Debugger mode;
534 try typing `M-x gdb RET'.
535
536
537 Writing Code for GDB
538 =====================
539
540 There is a lot of information about writing code for GDB in the
541 internals manual, distributed with GDB in gdb/doc/gdbint.texinfo. You
542 can read it by hand, print it by using TeX and texinfo, or process it
543 into an `info' file for use with Emacs' info mode or the standalone
544 `info' program.
545
546 If you are pondering writing anything but a short patch, especially
547 take note of the information about copyrights in the node Submitting
548 Patches. It can take quite a while to get all the paperwork done, so
549 we encourage you to start that process as soon as you decide you are
550 planning to work on something, or at least well ahead of when you
551 think you will be ready to submit the patches.
552
553
554 GDB Testsuite
555 =============
556
557 Included with the GDB distribution is a DejaGNU based testsuite
558 that can either be used to test your newly built GDB, or for
559 regression testing a GDB with local modifications.
560
561 Running the testsuite requires the prior installation of DejaGNU,
562 which is generally available via ftp. The directory
563 ftp://sourceware.cygnus.com/pub/dejagnu/ will contain a recent
564 snapshot. Once DejaGNU is installed, you can run the tests in one of
565 the following ways:
566
567 (1) cd gdb-5.1
568 make check-gdb
569
570 or
571
572 (2) cd gdb-5.1/gdb
573 make check
574
575 or
576
577 (3) cd gdb-5.1/gdb/testsuite
578 make site.exp (builds the site specific file)
579 runtest -tool gdb GDB=../gdb (or GDB=<somepath> as appropriate)
580
581 The last method gives you slightly more control in case of problems
582 with building one or more test executables or if you are using the
583 testsuite `standalone', without it being part of the GDB source tree.
584
585 See the DejaGNU documentation for further details.
586
587 \f
588 (this is for editing this file with GNU emacs)
589 Local Variables:
590 mode: text
591 End:
This page took 0.043847 seconds and 5 git commands to generate.