* top.c (gdb_completer_file_name_break_characters): New variable.
[deliverable/binutils-gdb.git] / gdb / README
CommitLineData
c906108c
SS
1 README for gdb-4.18 release
2 Updated 4 Apr 1999 by Jim Blandy
3
4This is GDB, the GNU source-level debugger.
5A summary of new features is in the file `NEWS'.
6
7a292a7a
SS
7See the GDB home page at http://sourceware.cygnus.com/gdb/ for up to
8date release information, mailing list links and archives, etc.
c906108c
SS
9
10
11Unpacking and Installation -- quick overview
12==========================
13
14In this release, the GDB debugger sources, the generic GNU include
15files, the BFD ("binary file description") library, the readline
16library, and other libraries all have directories of their own
17underneath the gdb-4.18 directory. The idea is that a variety of GNU
18tools can share a common copy of these things. Be aware of variation
19over time--for example don't try to build gdb with a copy of bfd from
20a release other than the gdb release (such as a binutils or gas
21release), especially if the releases are more than a few weeks apart.
22Configuration scripts and makefiles exist to cruise up and down this
23directory tree and automatically build all the pieces in the right
24order.
25
26When you unpack the gdb-4.18.tar.gz file, you'll find a directory
27called `gdb-4.18', which contains:
28
29 COPYING config.sub* libiberty/ opcodes/
30 COPYING.LIB configure* mmalloc/ readline/
31 Makefile.in configure.in move-if-change* sim/
32 README etc/ mpw-README texinfo/
33 bfd/ gdb/ mpw-build.in utils/
34 config/ include/ mpw-config.in
35 config.guess* install.sh* mpw-configure
36
37To build GDB, you can just do:
38
39 cd gdb-4.18
40 ./configure
41 make
42 cp gdb/gdb /usr/local/bin/gdb (or wherever you want)
43
44This will configure and build all the libraries as well as GDB.
45If `configure' can't determine your system type, specify one as its
46argument, e.g., sun4 or decstation.
47
48If you get compiler warnings during this stage, see the `Reporting Bugs'
49section below; there are a few known problems.
50
51GDB requires an ANSI C compiler. If you do not have an ANSI C
52compiler for your system, you may be able to download and install the
53GNU CC compiler. It is available via anonymous FTP from ftp.gnu.org,
54in /pub/gnu/gcc (as a URL, that's ftp://ftp.gnu.org/pub/gnu/gcc).
55
56GDB can be used as a cross-debugger, running on a machine of one type
57while debugging a program running on a machine of another type. See below.
58
59
60More Documentation
61******************
62
63 All the documentation for GDB comes as part of the machine-readable
64distribution. The documentation is written in Texinfo format, which is
65a documentation system that uses a single source file to produce both
66on-line information and a printed manual. You can use one of the Info
67formatting commands to create the on-line version of the documentation
68and TeX (or `texi2roff') to typeset the printed version.
69
70 GDB includes an already formatted copy of the on-line Info version of
71this manual in the `gdb/doc' subdirectory. The main Info file is
72`gdb-4.18/gdb/doc/gdb.info', and it refers to subordinate files matching
73`gdb.info*' in the same directory. If necessary, you can print out
74these files, or read them with any editor; but they are easier to read
75using the `info' subsystem in GNU Emacs or the standalone `info' program,
76available as part of the GNU Texinfo distribution.
77
78 If you want to format these Info files yourself, you need one of the
79Info formatting programs, such as `texinfo-format-buffer' or
80`makeinfo'.
81
82 If you have `makeinfo' installed, and are in the top level GDB
83source directory (`gdb-4.18', in the case of version 4.18), you can make
84the Info file by typing:
85
86 cd gdb/doc
87 make info
88
89 If you want to typeset and print copies of this manual, you need
90TeX, a program to print its DVI output files, and `texinfo.tex', the
91Texinfo definitions file. This file is included in the GDB
92distribution, in the directory `gdb-4.18/texinfo'.
93
94 TeX is a typesetting program; it does not print files directly, but
95produces output files called DVI files. To print a typeset document,
96you need a program to print DVI files. If your system has TeX
97installed, chances are it has such a program. The precise command to
98use depends on your system; `lpr -d' is common; another (for PostScript
99devices) is `dvips'. The DVI print command may require a file name
100without any extension or a `.dvi' extension.
101
102 TeX also requires a macro definitions file called `texinfo.tex'.
103This file tells TeX how to typeset a document written in Texinfo
104format. On its own, TeX cannot read, much less typeset a Texinfo file.
105 `texinfo.tex' is distributed with GDB and is located in the
106`gdb-4.18/texinfo' directory.
107
108 If you have TeX and a DVI printer program installed, you can typeset
109and print this manual. First switch to the the `gdb' subdirectory of
110the main source directory (for example, to `gdb-4.18/gdb') and then type:
111
112 make gdb.dvi
113
114
115Installing GDB
116**************
117
118 GDB comes with a `configure' script that automates the process of
119preparing GDB for installation; you can then use `make' to build the
120`gdb' program.
121
122 The GDB distribution includes all the source code you need for GDB in
123a single directory, whose name is usually composed by appending the
124version number to `gdb'.
125
126 For example, the GDB version 4.18 distribution is in the `gdb-4.18'
127directory. That directory contains:
128
129`gdb-4.18/{COPYING,COPYING.LIB}'
130 Standard GNU license files. Please read them.
131
132`gdb-4.18/bfd'
133 source for the Binary File Descriptor library
134
135`gdb-4.18/config*'
136 script for configuring GDB, along with other support files
137
138`gdb-4.18/gdb'
139 the source specific to GDB itself
140
141`gdb-4.18/include'
142 GNU include files
143
144`gdb-4.18/libiberty'
145 source for the `-liberty' free software library
146
147`gdb-4.18/mmalloc'
148 source for the GNU memory-mapped malloc package
149
150`gdb-4.18/opcodes'
151 source for the library of opcode tables and disassemblers
152
153`gdb-4.18/readline'
154 source for the GNU command-line interface
7a292a7a
SS
155 NOTE: The readline library is compiled for use by GDB, but will
156 not be installed on your system when "make install" is issued.
c906108c
SS
157
158`gdb-4.18/sim'
159 source for some simulators (ARM, D10V, SPARC, M32R, MIPS, PPC, V850, etc)
160
161`gdb-4.18/intl'
162 source for the GNU gettext library, for internationalization.
163 This is slightly modified from the standalone gettext
164 distribution you can get from GNU.
165
166`gdb-4.18/texinfo'
167 The `texinfo.tex' file, which you need in order to make a printed
168 manual using TeX.
169
170`gdb-4.18/etc'
171 Coding standards, useful files for editing GDB, and other
172 miscellanea.
173
174`gdb-4.18/utils'
175 A grab bag of random utilities.
176
177
178 The simplest way to configure and build GDB is to run `configure'
179from the `gdb-VERSION-NUMBER' source directory, which in this example
180is the `gdb-4.18' directory.
181
182 First switch to the `gdb-VERSION-NUMBER' source directory if you are
183not already in it; then run `configure'.
184
185 For example:
186
187 cd gdb-4.18
188 ./configure
189 make
190
191 Running `configure' followed by `make' builds the `bfd',
192`readline', `mmalloc', and `libiberty' libraries, then `gdb' itself.
193The configured source files, and the binaries, are left in the
194corresponding source directories.
195
196 `configure' is a Bourne-shell (`/bin/sh') script; if your system
197does not recognize this automatically when you run a different shell,
198you may need to run `sh' on it explicitly:
199
200 sh configure
201
202 If you run `configure' from a directory that contains source
203directories for multiple libraries or programs, such as the `gdb-4.18'
204source directory for version 4.18, `configure' creates configuration
205files for every directory level underneath (unless you tell it not to,
206with the `--norecursion' option).
207
208 You can run the `configure' script from any of the subordinate
209directories in the GDB distribution, if you only want to configure that
210subdirectory; but be sure to specify a path to it.
211
212 For example, with version 4.18, type the following to configure only
213the `bfd' subdirectory:
214
215 cd gdb-4.18/bfd
216 ../configure
217
218 You can install `gdb' anywhere; it has no hardwired paths. However,
219you should make sure that the shell on your path (named by the `SHELL'
220environment variable) is publicly readable. Remember that GDB uses the
221shell to start your program--some systems refuse to let GDB debug child
222processes whose programs are not readable.
223
224
225Compiling GDB in another directory
226==================================
227
228 If you want to run GDB versions for several host or target machines,
229you need a different `gdb' compiled for each combination of host and
230target. `configure' is designed to make this easy by allowing you to
231generate each configuration in a separate subdirectory, rather than in
232the source directory. If your `make' program handles the `VPATH'
233feature correctly (GNU `make' and SunOS 'make' are two that should),
234running `make' in each of these directories builds the `gdb' program
235specified there.
236
237 To build `gdb' in a separate directory, run `configure' with the
238`--srcdir' option to specify where to find the source. (You also need
239to specify a path to find `configure' itself from your working
240directory. If the path to `configure' would be the same as the
241argument to `--srcdir', you can leave out the `--srcdir' option; it
242will be assumed.)
243
244 For example, with version 4.18, you can build GDB in a separate
245directory for a Sun 4 like this:
246
247 cd gdb-4.18
248 mkdir ../gdb-sun4
249 cd ../gdb-sun4
250 ../gdb-4.18/configure sun4
251 make
252
253 When `configure' builds a configuration using a remote source
254directory, it creates a tree for the binaries with the same structure
255(and using the same names) as the tree under the source directory. In
256the example, you'd find the Sun 4 library `libiberty.a' in the
257directory `gdb-sun4/libiberty', and GDB itself in `gdb-sun4/gdb'.
258
259 One popular reason to build several GDB configurations in separate
260directories is to configure GDB for cross-compiling (where GDB runs on
261one machine--the host--while debugging programs that run on another
262machine--the target). You specify a cross-debugging target by giving
263the `--target=TARGET' option to `configure'.
264
265 When you run `make' to build a program or library, you must run it
266in a configured directory--whatever directory you were in when you
267called `configure' (or one of its subdirectories).
268
269 The `Makefile' that `configure' generates in each source directory
270also runs recursively. If you type `make' in a source directory such
271as `gdb-4.18' (or in a separate configured directory configured with
272`--srcdir=PATH/gdb-4.18'), you will build all the required libraries,
273and then build GDB.
274
275 When you have multiple hosts or targets configured in separate
276directories, you can run `make' on them in parallel (for example, if
277they are NFS-mounted on each of the hosts); they will not interfere
278with each other.
279
280
281Specifying names for hosts and targets
282======================================
283
284 The specifications used for hosts and targets in the `configure'
285script are based on a three-part naming scheme, but some short
286predefined aliases are also supported. The full naming scheme encodes
287three pieces of information in the following pattern:
288
289 ARCHITECTURE-VENDOR-OS
290
291 For example, you can use the alias `sun4' as a HOST argument or in a
292`--target=TARGET' option. The equivalent full name is
293`sparc-sun-sunos4'.
294
295 The `configure' script accompanying GDB does not provide any query
296facility to list all supported host and target names or aliases.
297`configure' calls the Bourne shell script `config.sub' to map
298abbreviations to full names; you can read the script, if you wish, or
299you can use it to test your guesses on abbreviations--for example:
300
301 % sh config.sub sun4
302 sparc-sun-sunos4.1.1
303 % sh config.sub sun3
304 m68k-sun-sunos4.1.1
305 % sh config.sub decstation
306 mips-dec-ultrix4.2
307 % sh config.sub hp300bsd
308 m68k-hp-bsd
309 % sh config.sub i386v
310 i386-pc-sysv
311 % sh config.sub i786v
312 Invalid configuration `i786v': machine `i786v' not recognized
313
314`config.sub' is also distributed in the GDB source directory
315(`gdb-4.18', for version 4.18).
316
317
318`configure' options
319===================
320
321 Here is a summary of the `configure' options and arguments that are
322most often useful for building GDB. `configure' also has several other
323options not listed here. *note : (configure.info)What Configure Does,
324for a full explanation of `configure'.
325
326 configure [--help]
327 [--prefix=DIR]
328 [--srcdir=PATH]
329 [--norecursion] [--rm]
330 [--enable-build-warnings]
331 [--target=TARGET]
332 [--host=HOST]
333 [HOST]
334
335You may introduce options with a single `-' rather than `--' if you
336prefer; but you may abbreviate option names if you use `--'.
337
338`--help'
339 Display a quick summary of how to invoke `configure'.
340
341`-prefix=DIR'
342 Configure the source to install programs and files under directory
343 `DIR'.
344
345`--srcdir=PATH'
346 *Warning: using this option requires GNU `make', or another `make'
347 that compatibly implements the `VPATH' feature.*
348 Use this option to make configurations in directories separate
349 from the GDB source directories. Among other things, you can use
350 this to build (or maintain) several configurations simultaneously,
351 in separate directories. `configure' writes configuration
352 specific files in the current directory, but arranges for them to
353 use the source in the directory PATH. `configure' will create
354 directories under the working directory in parallel to the source
355 directories below PATH.
356
357`--norecursion'
358 Configure only the directory level where `configure' is executed;
359 do not propagate configuration to subdirectories.
360
361`--rm'
362 Remove the configuration that the other arguments specify.
363
364`--enable-build-warnings'
365 When building the GDB sources, ask the compiler to warn about any
366 code which looks even vaguely suspicious. You should only using
367 this feature if you're compiling with GNU CC. It passes the
368 following flags:
369 -Wall
370 -Wpointer-arith
371 -Wstrict-prototypes
372 -Wmissing-prototypes
373 -Wmissing-declarations
374
375`--target=TARGET'
376 Configure GDB for cross-debugging programs running on the specified
377 TARGET. Without this option, GDB is configured to debug programs
378 that run on the same machine (HOST) as GDB itself.
379
380 There is no convenient way to generate a list of all available
381 targets.
382
383`--host=HOST'
384 Configure GDB to run on the specified HOST.
385
386 There is no convenient way to generate a list of all available
387 hosts.
388
389`HOST ...'
390 Same as `--host=HOST'. If you omit this, GDB will guess; it's
391 quite accurate.
392
393`configure' accepts other options, for compatibility with configuring
394other GNU tools recursively; but these are the only options that affect
395GDB or its supporting libraries.
396
397
398Languages other than C
399=======================
400
401See the GDB manual (gdb/doc/gdb.texinfo) for information on this.
402
403
404Kernel debugging
405=================
406
407I have't done this myself so I can't really offer any advice.
408Remote debugging over serial lines works fine, but the kernel debugging
409code in here has not been tested in years. Van Jacobson has
410better kernel debugging, but the UC lawyers won't let FSF have it.
411
412
413Remote debugging
414=================
415
416The files m68k-stub.c, i386-stub.c, and sparc-stub.c are examples of
417remote stubs to be used with remote.c. They are designed to run
418standalone on an m68k, i386, or SPARC cpu and communicate properly with
419the remote.c stub over a serial line.
420
421The directory gdb/gdbserver/ contains `gdbserver', a program that
422allows remote debugging for Unix applications. gdbserver is only
423supported for some native configurations, including Sun 3, Sun 4,
424and Linux.
425
426There are a number of remote interfaces for talking to existing ROM
427monitors and other hardware:
428
429 remote-adapt.c AMD 29000 "Adapt"
430 remote-array.c Array Tech RAID controller
431 remote-bug.c Motorola BUG monitor
432 remote-d10v.c GDB protocol, talking to a d10v chip
433 remote-e7000.c Hitachi E7000 ICE
434 remote-eb.c AMD 29000 "EBMON"
435 remote-es.c Ericsson 1800 monitor
436 remote-est.c EST emulator
437 remote-hms.c Hitachi Micro Systems H8/300 monitor
438 remote-mips.c MIPS remote debugging protocol
439 remote-mm.c AMD 29000 "minimon"
440 remote-nindy.c Intel 960 "Nindy"
441 remote-nrom.c NetROM ROM emulator
442 remote-os9k.c PC running OS/9000
443 remote-rdi.c ARM with Angel monitor
444 remote-rdp.c ARM with Demon monitor
445 remote-sds.c PowerPC SDS monitor
446 remote-sim.c Generalized simulator protocol
447 remote-st.c Tandem ST-2000 monitor
448 remote-udi.c AMD 29000 using the AMD "Universal Debug Interface"
449 remote-vx.c VxWorks realtime kernel
450
451Remote-vx.c and the vx-share subdirectory contain a remote interface for the
452VxWorks realtime kernel, which communicates over TCP using the Sun
453RPC library. This would be a useful starting point for other remote-
454via-ethernet back ends.
455
456Remote-udi.c and the 29k-share subdirectory contain a remote interface
457for AMD 29000 programs, which uses the AMD "Universal Debug Interface".
458This allows GDB to talk to software simulators, emulators, and/or bare
459hardware boards, via network or serial interfaces. Note that GDB only
460provides an interface that speaks UDI, not a complete solution. You
461will need something on the other end that also speaks UDI.
462
463
464Reporting Bugs
465===============
466
467The correct address for reporting bugs found in gdb is
468"bug-gdb@gnu.org". Please email all bugs, and all requests for
469help with GDB, to that address. Please include the GDB version number
470(e.g., gdb-4.18), and how you configured it (e.g., "sun4" or "mach386
471host, i586-intel-synopsys target"). Since GDB now supports so many
472different configurations, it is important that you be precise about this.
473If at all possible, you should include the actual banner that GDB prints
474when it starts up, or failing that, the actual configure command that
475you used when configuring GDB.
476
477For more information on how/whether to report bugs, see the GDB Bugs
478section of the GDB manual (gdb/doc/gdb.texinfo).
479
480Known bugs:
481
482 * Under Ultrix 4.2 (DECstation-3100) or Alphas under OSF/1, we have
483 seen problems with backtraces after interrupting the inferior out
484 of a read(). The problem is caused by ptrace() returning an
485 incorrect value for the frame pointer register (register 15 or
486 30). As far as we can tell, this is a kernel problem. Any help
487 with this would be greatly appreciated.
488
489 * Under Ultrix 4.4 (DECstation-3100), setting the TERMCAP environment
490 variable to a string without a trailing ':' can cause GDB to dump
491 core upon startup. Although the core file makes it look as though
492 GDB code failed, the crash actually occurs within a call to the
493 termcap library function tgetent(). The problem can be solved by
494 using the GNU Termcap library.
495
496 Alphas running OSF/1 (versions 1.0 through 2.1) have the same buggy
497 termcap code, but GDB behaves strangely rather than crashing.
498
499 * On DECstations there are warnings about shift counts out of range in
500 various BFD modules. None of them is a cause for alarm, they are actually
501 a result of bugs in the DECstation compiler.
502
503 * Notes for the DEC Alpha using OSF/1:
504 The debugging output of native cc has two known problems; we view these
505 as compiler bugs.
506 The linker miscompacts symbol tables, which causes gdb to confuse the
507 type of variables or results in `struct <illegal>' type outputs.
508 dbx has the same problems with those executables. A workaround is to
509 specify -Wl,-b when linking, but that will increase the executable size
510 considerably.
511 If a structure has incomplete type in one file (e.g., "struct foo *"
512 without a definition for "struct foo"), gdb will be unable to find the
513 structure definition from another file.
514 It has been reported that the Ultrix 4.3A compiler on decstations has the
515 same problems.
516
517 * Notes for Solaris 2.x, using the SPARCworks cc compiler:
518 You have to compile your program with the -xs option of the SPARCworks
519 compiler to be able to debug your program with gdb.
520 Under Solaris 2.3 you also need patch 101409-03 (Jumbo linker patch).
521 Under Solaris 2.2, if you have patch 101052 installed, make sure
522 that it is at least at revision 101052-06.
523
524 * Under Irix 5 for SGIs, you must have installed the `compiler_dev.hdr'
525 subsystem that is on the IDO CD, otherwise you will get complaints
526 that certain files such as `/usr/include/syms.h' cannot be found.
527
528 * Notes for BSD/386:
529 To compile gdb-4.18 on BSD/386, you must run the configure script and
530 its subscripts with bash. Here is an easy way to do this:
531
532 bash -c 'CONFIG_SHELL=/bin/bash ./configure'
533
534 (configure will report i386-unknown-bsd). Then, compile with the
535 standard "make" command.
536
537GDB can produce warnings about symbols that it does not understand. By
538default, these warnings are disabled. You can enable them by executing
539`set complaint 10' (which you can put in your ~/.gdbinit if you like).
540I recommend doing this if you are working on a compiler, assembler,
541linker, or GDB, since it will point out problems that you may be able
542to fix. Warnings produced during symbol reading indicate some mismatch
543between the object file and GDB's symbol reading code. In many cases,
544it's a mismatch between the specs for the object file format, and what
545the compiler actually outputs or the debugger actually understands.
546
547
548X Windows versus GDB
549=====================
550
551You should check out DDD, the Data Display Debugger. Here's the blurb
552from the DDD web site, http://www.cs.tu-bs.de/softech/ddd:
553
554 The Data Display Debugger (DDD) is a popular graphical user
555 interface for command-line debuggers such as GDB, DBX, JDB, WDB,
556 XDB, the Perl debugger, and the Python debugger. Besides ``usual''
557 front-end features such as viewing source texts, DDD has become
558 famous through its interactive graphical data display, where data
559 structures are displayed as graphs. A simple mouse click
560 dereferences pointers or views structure contents, updated each
561 time the program stops. Using DDD, you can reason about your
562 application by watching its data, not just by viewing it execute
563 lines of source code.
564
565Emacs users will very likely enjoy the Grand Unified Debugger mode;
566try typing `M-x gdb RET'.
567
568Those interested in experimenting with a new kind of gdb-mode
569should load gdb/gdba.el into GNU Emacs 19.25 or later. Comments
570on this mode are also welcome.
571
572
573Writing Code for GDB
574=====================
575
576There is a lot of information about writing code for GDB in the
577internals manual, distributed with GDB in gdb/doc/gdbint.texinfo. You
578can read it by hand, print it by using TeX and texinfo, or process it
579into an `info' file for use with Emacs' info mode or the standalone
580`info' program.
581
582If you are pondering writing anything but a short patch, especially
583take note of the information about copyrights in the node Submitting
584Patches. It can take quite a while to get all the paperwork done, so
585we encourage you to start that process as soon as you decide you are
586planning to work on something, or at least well ahead of when you
587think you will be ready to submit the patches.
588
589
590GDB Testsuite
591=============
592
593There is a DejaGNU based testsuite available for testing your newly
594built GDB, or for regression testing GDBs with local modifications.
595
596Running the testsuite requires the prior installation of DejaGNU,
597which is generally available via ftp; you'll need a pretty recent
598release. Once DejaGNU is installed, you can run the tests in one of
599two ways:
600
601 (1) cd gdb-4.18/gdb (assuming you also unpacked gdb)
602 make check
603
604or
605
606 (2) cd gdb-4.18/gdb/testsuite
607 make site.exp (builds the site specific file)
608 runtest -tool gdb GDB=../gdb (or GDB=<somepath> as appropriate)
609
610The second method gives you slightly more control in case of problems with
611building one or more test executables or if you are using the testsuite
612'standalone', without it being part of the GDB source tree.
613
614See the DejaGNU documentation for further details.
615
616\f
617(this is for editing this file with GNU emacs)
618Local Variables:
619mode: text
620End:
This page took 0.065345 seconds and 4 git commands to generate.