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