Update README.
[deliverable/binutils-gdb.git] / gdb / README
1 README for gdb-4.0 release
2 John Gilmore 23 Aug 91
3
4 This is GDB, the GNU source-level debugger, presently running under un*x.
5 A summary of features new since gdb-3.5 is in the file `WHATS.NEW'.
6
7
8 Unpacking and Installation -- quick overview
9 ==========================
10
11 This release moves the generic GNU include files, the BFD ("binary file
12 description") library, the getopt routines, obstacks, and the readline
13 library into the parent directory of the gdb source files. The idea is
14 that a variety of GNU tools can share a common copy of these things.
15
16 These generic files are packaged together with the directory containing
17 the source code for GDB, for now. When you unpack the gdb-4.0.tar.Z
18 file, you'll get a directory called `gdb-4.0', which contains:
19
20 Makefile.in bfd/ configure.in libiberty/
21 README config.sub* gdb/ readline/
22 README.configure configure* include/ texinfo/
23
24 To build GDB, you can just do:
25
26 cd gdb-4.0
27 ./configure HOSTNAME
28 make
29 cp gdb/gdb /usr/local/bin/gdb (or wherever you want)
30
31 This will configure and build all the libraries as well as GDB.
32 If you get compiler warnings during this stage, see the `Reporting Bugs'
33 section below; there are a few known problems.
34
35 GDB can be used as a cross-debugger, running on a machine of one type
36 while debugging a program running on a machine of another type. See below.
37
38
39 More Documentation
40 ==================
41
42 The GDB 4.0 release includes an already-formatted reference card, ready
43 for printing on a PostScript printer, as `gdb-4.0/gdb/refcard.ps'. It
44 uses the most common PostScript fonts: the Times family, Courier,
45 and Symbol. If you have a PostScript printer you can print the
46 reference card by just sending `refcard.ps' to the printer.
47
48 The release also includes the online Info version of the manual
49 already formatted: the main Info file is `gdb-4.0/gdb/gdb.info', and
50 it refers to subordinate files matching `gdb.info*' in the same
51 directory.
52
53 If you want to make these Info files yourself from the GDB
54 manual's source, you need the GNU `makeinfo' program. Once you have
55 it, you can type
56
57 cd gdb-4.0/gdb
58 make gdb.info
59
60 to make the Info file.
61
62 If you want to format and print copies of this manual, you need
63 several things:
64
65 * TeX, the public domain typesetting program written by Donald
66 Knuth, must be installed on your system and available through
67 your execution path.
68
69 * `gdb-4.0/texinfo': TeX macros defining the GNU Documentation
70 Format.
71
72 * *A DVI output program.* TeX doesn't actually make marks on
73 paper; it produces output files called DVI files. If your
74 system has TeX installed, chances are it has a program for
75 printing out these files; one popular example is `dvips', which
76 can print DVI files on PostScript printers.
77
78 Once you have these things, you can type
79
80 cd gdb-4.0/gdb
81 make gdb.dvi
82
83 to format the text of this manual, and print it with the usual output
84 method for TeX DVI files at your site.
85
86 If you want to print the reference card, but don't have a PostScript
87 printer, or want to print using Computer Modern fonts instead, you can
88 still print it if you have TeX. Format the reference card by typing
89
90 cd gdb-4.0/gdb
91 make refcard.dvi
92
93 The GDB reference card is designed to print in landscape mode on US
94 "letter" size paper; that is, on a sheet 11 inches wide by 8.5
95 inches high. You will need to specify this form of printing as an
96 option to your DVI output program.
97
98
99 Installing GDB
100 ==============
101
102 GDB comes with a `configure' script that automates the process of
103 preparing GDB for installation; you can then use `make' to build the
104 `gdb' program.
105
106 The gdb distribution includes all the source code you need for gdb
107 in a single directory `gdb-4.0'. That directory in turn contains:
108
109 `gdb-4.0/configure'
110 Overall script for configuring GDB and all its supporting
111 libraries.
112
113 `gdb-4.0/gdb'
114 the source specific to GDB itself
115
116 `gdb-4.0/bfd'
117 source for the Binary File Descriptor Library
118
119 `gdb-4.0/include'
120 GNU include files
121
122 `gdb-4.0/libiberty'
123 source for the `-liberty' free software library
124
125 `gdb-4.0/readline'
126 source for the GNU command-line interface
127
128 Each of these directories has its own `configure' script, which are
129 used by the overall `configure' script in `gdb-4.0'.
130
131 It is most convenient to run `configure' from the `gdb-4.0'
132 directory. The simplest way to configure and build GDB is the
133 following:
134
135 cd gdb-4.0
136 ./configure HOST
137 make
138
139 where HOST is something like `sun4' or `decstation', that identifies
140 the platform where GDB will run. This builds the three libraries
141 `bfd', `readline', and `libiberty', then `gdb' itself. The
142 configured source files, and the binaries, are left in the
143 corresponding source directories.
144
145 You can install `gdb' anywhere; it has no hardwired paths.
146 However, you should make sure that the shell on your path (named by
147 the `SHELL' environment variable) is publicly readable; some systems
148 refuse to let GDB debug child processes whose programs are not
149 readable, and GDB uses the shell to start your program.
150
151 Configuration Subdirectories
152 ============================
153
154 If you want to run GDB versions for several host or target
155 machines, you'll need a different gdb compiled for each combination
156 of host and target. `configure' is designed to make this easy by
157 allowing you to generate each configuration in a separate
158 subdirectory. If your `make' program handles the `VPATH' feature
159 (GNU `make' does), running `make' in each of these directories then
160 builds the gdb program specified there.
161
162 `configure' creates these subdirectories for you when you
163 simultaneously specify several configurations; but it's a good habit
164 even for a single configuration. You can specify the use of
165 subdirectories using the `+subdirs' option (abbreviated `+sub').
166 For example, you can build GDB on a Sun 4 as follows:
167
168 cd gdb-4.0
169 ./configure +sub sun4
170 cd Host-sparc-sun-sunos4/Target-sparc-sun-sunos4
171 make
172
173 When `configure' uses subdirectories to build programs or
174 libraries, it creates nested directories `Host-HOST/Target-TARGET'.
175 (As you see in the example, the names used for HOST and TARGET may
176 be expanded from your `configure' argument; *note Config Names::.).
177 `configure' uses these two directory levels because GDB can be
178 configured for cross-compiling: GDB can run on one machine (the
179 host) while debugging programs that run on another machine (the
180 target). You specify cross-debugging targets by giving the
181 `+target=TARGET' option to `configure'. Specifying only hosts still
182 gives you two levels of subdirectory for each host, with the same
183 configuration suffix on both; that is, if you give any number of
184 hosts but no targets, GDB will be configured for native debugging on
185 each host. On the other hand, whenever you specify both hosts and
186 targets on the same command line, `configure' creates all
187 combinations of the hosts and targets you list.
188
189 When you run `make' to build a program or library, you must run it
190 in a configured directory. If you made a single configuration,
191 without subdirectories, run `make' in the source directory. If you
192 have `Host-HOST/Target-TARGET' subdirectories, run `make' in those
193 subdirectories.
194
195 Each `configure' and `Makefile' under each source directory runs
196 recursively, so that typing `make' in `gdb-4.0' (or in a
197 `gdb-4.0/Host-HOST/Target-TARGET' subdirectory) builds all the
198 required libraries, then GDB.
199
200 If you run `configure' from a directory (such as `gdb-4.0') that
201 contains source directories for multiple libraries or programs,
202 `configure' creates the `Host-HOST/Target-TARGET' subdirectories in
203 each library or program's source directory. For example, typing:
204
205 cd gdb-4.0
206 configure sun4 +target=vxworks960
207
208 creates the following directories:
209
210 gdb-4.0/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks
211 gdb-4.0/bfd/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks
212 gdb-4.0/gdb/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks
213 gdb-4.0/libiberty/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks
214 gdb-4.0/readline/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks
215
216 The `Makefile' in
217
218 gdb-4.0/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks
219
220 will `cd' to the appropriate lower-level directories, for example:
221
222 gdb-4.0/bfd/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks
223
224 building each in turn.
225
226 When you have multiple hosts or targets configured, you can run
227 `make' on them in parallel (for example, if they are NFS-mounted on
228 each of the hosts); they will not interfere with each other.
229
230 Specifying Names for Hosts and Targets
231 ======================================
232
233 The specifications used for hosts and targets in the `configure'
234 script are based on a three-part naming scheme, but some short
235 predefined aliases are also supported. The full naming scheme
236 encodes three pieces of information in the following pattern:
237
238 ARCHITECTURE-VENDOR-OS
239
240 For example, you can use the alias `sun4' as a HOST argument or in
241 a `+target='TARGET option, but the full name of that configuration
242 specifies that the architecture is `sparc', the vendor is `sun', and
243 the operating system is `sunos4'.
244
245 The following table shows all the architectures, hosts, and OS
246 prefixes that `configure' recognizes in GDB 4.0. Entries in the "OS
247 prefix"
248 column ending in a `*' may be followed by a release number.
249
250
251 ARCHITECTURE VENDOR OS prefix
252 ------------+-------------+-------------
253 | |
254 a29k | altos | aix*
255 alliant | aout | aout
256 arm | apollo | bout
257 c1 | att | bsd*
258 c2 | bout | coff
259 i386 | coff | ctix*
260 i860 | convergent | dynix*
261 i960 | convex | esix*
262 m68000 | dec | hpux*
263 m68k | encore | isc*
264 m88k | gould | mach*
265 mips | hp | newsos*
266 ns32k | ibm | nindy*
267 pyramid | intel | none
268 rs6000 | isi | osf*
269 rtpc | little | sco*
270 sparc | mips | sunos*
271 tahoe | motorola | sysv*
272 tron | ncr | ultrix*
273 vax | next | unos*
274 | none | v88r*
275 | sco | vms*
276 | sequent | vxworks*
277 | sgi |
278 | sony |
279 | sun |
280 | unicom |
281 | utek |
282 | wrs |
283
284 *Warning:* Many combinations of architecture, vendor, and OS are
285 untested.
286
287 The `configure' script accompanying GDB 4.0 does not provide any
288 query facility to list all supported host and target names or
289 aliases. `configure' calls the Bourne shell script `config.sub' to
290 map abbreviations to full names; you can read the script, if you
291 wish, or you can use it to test your guesses on abbreviations--for
292 example:
293
294 % sh config.sub sun4
295 sparc-sun-sunos4
296 % sh config.sub sun3
297 m68k-sun-sunos4
298 % sh config.sub decstation
299 mips-dec-ultrix
300 % sh config.sub hp300bsd
301 m68k-hp-bsd
302 % sh config.sub i386v
303 i386-none-sysv
304 % sh config.sub i486v
305 *** No vendor: configuration `i486v' not recognized
306
307 `configure' Options
308 ===================
309
310 Here is a summary of all the `configure' options and arguments
311 that you might use for building GDB:
312
313 configure [+destdir=DIR] [+subdirs] [+norecur] [+rm]
314 [+target=TARGET...] HOST...
315
316 You may introduce options with the character `-' rather than `+' if
317 you prefer; but you may abbreviate option names if you use `+'.
318
319 `+destdir=DIR'
320 DIR is an installation directory *path prefix*. After you
321 configure with this option, `make install' will install GDB as
322 `DIR/bin/gdb', and the libraries in `DIR/lib'. If you specify
323 `+destdir=/usr/local', for example, `make install' creates
324 `/usr/local/bin/gdb'.
325
326 `+subdirs'
327 Write configuration specific files in subdirectories of the form
328
329 Host-HOST/Target-TARGET
330
331 (and configure the `Makefile' to write binaries there too).
332 Without this option, if you specify only one configuration for
333 GDB, `configure' will use the same directory for source,
334 configured files, and binaries. This option is used
335 automatically if you specify more than one HOST or more than
336 one
337 `+target=TARGET' option on the `configure' command line.
338
339 `+norecur'
340 Configure only the directory where `configure' is executed; do
341 not propagate configuration to subdirectories.
342
343 `+rm'
344 Remove the configuration that the other arguments specify.
345
346 `+target=TARGET ...'
347 Configure GDB for cross-debugging programs running on each
348 specified TARGET. You may specify as many `+target' options as
349 you wish. Without this option, GDB is configured to debug
350 programs that run on the same machine (HOST) as GDB itself.
351
352 There is no convenient way to generate a list of all available
353 targets.
354
355 `HOST ...'
356 Configure GDB to run on each specified HOST. You may specify as
357 many host names as you wish.
358
359 There is no convenient way to generate a list of all available
360 hosts.
361
362 `configure' accepts other options, for compatibility with configuring
363 other GNU tools recursively; but these are the only options that
364 affect GDB or its supporting libraries.
365
366
367 Languages other than C
368
369 C++ support has been integrated into gdb. GDB should work with FORTRAN
370 programs. (If you have problems, please send a bug report; you may
371 have to refer to some FORTRAN variables with a trailing underscore).
372 Andrew Beers has produced a GDB that works with Modula-2, which will
373 appear in gdb-4.1. I am not aware of anyone who is working on getting
374 gdb to use the syntax of any other language. Pascal programs which use
375 sets, subranges, file variables, or nested functions will not currently
376 work.
377
378
379 Kernel debugging
380
381 I have't done this myself so I can't really offer any advice.
382 Remote debugging over serial lines works fine, but the kernel debugging
383 code in here has not been tested in years. Van Jacobson claims to have
384 better kernel debugging, but won't release it for ordinary mortals.
385
386
387 Remote debugging
388
389 The files m68k-stub.c and i386-stub.c contain two examples of remote
390 stubs to be used with remote.c. They are designeded to run standalone
391 on a 68k or 386 cpu and communicate properly with the remote.c stub
392 over a serial line.
393
394 The file rem-multi.shar contains a general stub that can probably
395 run on various different flavors of unix to allow debugging over a
396 serial line from one machine to another.
397
398 The files remote-eb.c and remote-nindy.c are two examples of remote
399 interfaces for talking to existing ROM monitors (for the AMD 29000 and the
400 Intel 960 repsectively).
401
402 Remote-vx.c and the vx-share subdirectory contain a remote interface for the
403 VxWorks realtime kernel, which communicates over TCP using the Sun
404 RPC library. This would be a useful starting point for other remote-
405 via-ethernet back ends.
406
407 [This section seems to be out of date, I have never seen the "rapp"
408 program, though I would like to. FIXME.]
409 `rapp' runs under unix and acts as a remote stub (like rem-multi.shar
410 distributed with GDB version 3). Currently it just works over UDP
411 (network), not over a serial line. To get it running
412 * Compile GDB on the host machine as usual
413 * Compile rapp on the target machine, giving for both host and target
414 the type of the target machine
415 * Install "gdb" in /etc/services on both machines.
416
417
418 Reporting Bugs
419
420 The correct address for reporting bugs found in gdb is
421 "bug-gdb@prep.ai.mit.edu". Please email all bugs to that address.
422
423 GDB can produce warnings about symbols that it does not understand. By
424 default, these warnings are disabled. You can enable them by executing
425 `set complaint 10' (which you can put in your ~/.gdbinit if you like).
426 I recommend doing this if you are working on a compiler, assembler,
427 linker, or gdb, since it will point out problems that you may be able
428 to fix. Warnings produced during symbol reading indicate some mismatch
429 between the object file and GDB's symbol reading code (in many cases,
430 it's a mismatch between the specs for the object file format, and what
431 the compiler actually outputs or the debugger actually understands).
432
433 If you port gdb to a new machine, please send the required changes
434 to bug-gdb@prep.ai.mit.edu. If your changes are more than a few
435 lines, obtain and send in a copyright assignment from gnu@prep.ai.mit.edu, as
436 described in the section `Writing Code for GDB'.
437
438
439 X Windows versus GDB
440
441 xgdb is obsolete. We are not doing any development or support of it.
442
443 There is an "xxgdb", which shows more promise, which was posted to
444 comp.sources.x.
445
446 For those intersted in auto display of source and the availability of
447 an editor while debugging I suggest trying gdb-mode in gnu-emacs
448 (Try typing M-x gdb RETURN). Comments on this mode are welcome.
449
450
451 About the machine-dependent files
452
453 tconfig/<machine>
454 This contains Makefile stuff for when the target system is <machine>.
455 It also specifies the name of the tm-XXX.h file for this machine.
456
457 xconfig/<machine>
458 This contains Makefile stuff for when the host system is <machine>.
459 It also specifies the name of the xm-XXX.h file for this machine.
460
461 tm-XXX.h (tm.h is a link to this file, created by configure).
462 This file contains macro definitions about the target machine's
463 registers, stack frame format and instructions.
464
465 xm-XXX.h (xm.h is a link to this file, created by configure).
466 This contains macro definitions describing the host system environment,
467 such as byte order, host C compiler and library, ptrace support,
468 and core file structure.
469
470 <machine>-opcode.h
471 <machine>-pinsn.c
472 These files contain the information necessary to print instructions
473 for your cpu type. <machine>-opcode.h includes some large initialized
474 data structures, which is strange for a ".h" file, but it's OK since
475 it is only included in one place. <machine>-opcode.h is shared
476 between the debugger and the assembler (if the GNU assembler has been
477 ported to that machine), whereas <machine>-pinsn.c is specific to GDB.
478
479 <machine>-tdep.c
480 This file contains any miscellaneous code required for this machine
481 as a target. On some machines it doesn't exist at all. Its existence
482 is specified in the tconfig/XXX file.
483
484 <machine>-xdep.c
485 This file contains any miscellaneous code required for this machine
486 as a host. On some machines it doesn't exist at all. Its existence
487 is specified in the xconfig/XXX file.
488
489 infptrace.c
490 This is the low level interface to inferior processes for systems
491 using the Unix ptrace call in a vanilla way. Some systems have their
492 own routines in <machine>-xdep.c. Whether or not it is used
493 is specified in the xconfig/XXX file.
494
495 coredep.c
496 Machine and system-dependent aspects of reading core files. Some
497 machines use coredep.c; some have the routines in <machine>-xdep.c.
498 Whether or not it is used is specified in the xconfig/XXX file.
499 Now that BFD is used to read core files, virtually all machines should
500 use coredep.c and should just provide fetch_core_registers in
501 <machine>-xdep.c.
502
503 exec.c
504 Machine and system-dependent aspects of reading executable files.
505 Some machines use exec.c; some have the routines in <machine>-tdep.c
506 Since BFD, virtually all machines should use exec.c.
507
508
509 Writing Code for GDB
510
511 We appreciate having users contribute code that is of general use, but
512 for it to be included in future GDB releases it must be cleanly
513 written. We do not want to include changes that will needlessly make
514 future maintainance difficult. It is not much harder to do things
515 right, and in the long term it is worth it to the GNU project, and
516 probably to you individually as well.
517
518 Please code according to the GNU coding standards. If you do not have
519 a copy, you can request one by sending mail to gnu@prep.ai.mit.edu.
520
521 If you make substantial changes, you'll have to file a copyright
522 assignment with the Free Software Foundation before we can produce a
523 release that includes your changes. Send mail requesting the copyright
524 assignment to gnu@prep.ai.mit.edu. Do this early, like before the
525 changes actually work, or even before you start them, because a manager
526 or lawyer on your end will probably make this a slow process.
527
528 Please try to avoid making machine-specific changes to
529 machine-independent files. If this is unavoidable, put a hook in the
530 machine-independent file which calls a (possibly) machine-dependent
531 macro (for example, the IGNORE_SYMBOL macro can be used for any
532 symbols which need to be ignored on a specific machine. Calling
533 IGNORE_SYMBOL in dbxread.c is a lot cleaner than a maze of #if
534 defined's). The machine-independent code should do whatever "most"
535 machines want if the macro is not defined in param.h. Using #if
536 defined can sometimes be OK (e.g. SET_STACK_LIMIT_HUGE) but should be
537 conditionalized on a specific feature of an operating system (set in
538 tm.h or xm.h) rather than something like #if defined(vax) or #if
539 defined(SYSV). If you use an #ifdef on some symbol that is defined
540 in a header file (e.g. #ifdef TIOCSETP), *please* make sure that you
541 have #include'd the relevant header file in that module!
542
543 It is better to replace entire routines which may be system-specific,
544 rather than put in a whole bunch of hooks which are probably not going
545 to be helpful for any purpose other than your changes. For example,
546 if you want to modify dbxread.c to deal with DBX debugging symbols
547 which are in COFF files rather than BSD a.out files, do something
548 along the lines of a macro GET_NEXT_SYMBOL, which could have
549 different definitions for COFF and a.out, rather than trying to put
550 the necessary changes throughout all the code in dbxread.c that
551 currently assumes BSD format.
552
553 Please avoid duplicating code. For example, in GDB 3.x all the stuff
554 in infptrace.c was duplicated in *-dep.c, and so changing something
555 was very painful. In GDB 4.x, these have all been consolidated
556 into infptrace.c. infptrace.c can deal with variations between
557 systems the same way any system-independent file would (hooks, #if
558 defined, etc.), and machines which are radically different don't need
559 to use infptrace.c at all. The same was true of core_file_command
560 and exec_file_command.
561
562
563 Debugging gdb with itself
564
565 If gdb is limping on your machine, this is the preferred way to get it
566 fully functional. Be warned that in some ancient Unix systems, like
567 Ultrix 4.0, a program can't be running in one process while it is being
568 debugged in another. Rather than doing "./gdb ./gdb", which works on
569 Suns and such, you can copy gdb to gdb2 and then do "./gdb ./gdb2".
570
571 When you run gdb in this directory, it will read a ".gdbinit" file that
572 sets up some simple things to make debugging gdb easier. The "info"
573 command, when executed without a subcommand in a gdb being debugged by
574 gdb, will pop you back up to the top level gdb. See .gdbinit for details.
575
576 I strongly recommend printing out the reference card and using it.
577 Send reference-card suggestions to bug-gdb@prep.ai.mit.edu, just like bugs.
578
579 If you use emacs, you will probably want to do a "make TAGS" after you
580 configure your distribution; this will put the machine dependent
581 routines for your local machine where they will be accessed first by a
582 M-period.
583
584 Also, make sure that you've compiled gdb with your local cc or taken
585 appropriate precautions regarding ansification of include files. See
586 the Makefile for more information.
587 \f
588 (this is for editing this file with GNU emacs)
589 Local Variables:
590 mode: text
591 End:
This page took 0.210411 seconds and 5 git commands to generate.