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