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