Add none
[deliverable/binutils-gdb.git] / gdb / README
CommitLineData
c45c19f8
JG
1 README for gdb-3.98 beta release
2 John Gilmore 31 July 91
3
bd5635a1 4This is GDB, the GNU source-level debugger, presently running under
c45c19f8 5un*x. This is a beta test version of GDB version 4, and has not been
bd5635a1 6extensively tested. It surely has some bugs, both bugs that were
c45c19f8
JG
7present in version 3, and new bugs. If your favorite bugfix is not
8yet present here, I encourage you to port it into this version and
9then send the diffs to bug-gdb@prep.ai.mit.edu.
10
11A summary of features new since gdb-3.5 is in the file `WHATS.NEW'.
12
bd5635a1 13
c45c19f8 14 Unpacking and Installation
bd5635a1 15
c45c19f8
JG
16This release moves the generic GNU include files, the BFD ("binary file
17description") library, the getopt routines, obstacks, and the readline
18library into the parent directory of gdb. The idea is that a variety
19of GNU tools can share a common copy of these things.
bd5635a1 20
c45c19f8
JG
21These generic files are packaged separately from GDB, in a tar file
22called "bfd.ilrt-3.98.tar.Z". ("ilrt" stands for include, libiberty,
23readline, texinfo). Unpack that tar file in the same directory in
24which you unpacked the gdb-3.98.tar.Z file, so that for example the
25'bfd' directory sits next to the 'gdb' directory. The whole top-level
26directory will look like this with `ls -F':
bd5635a1 27
c45c19f8
JG
28 Makefile.in configure* include/ texinfo/
29 README.configure configure.in libiberty/
30 bfd/ gdb/ readline/
170d0c85 31
c45c19f8
JG
32Once you have this stuff unpacked, and your current directory is here,
33you can type:
170d0c85
RP
34
35 ./configure HOSTNAME
36 make
37
38and all the libraries, as well as GDB will be configured and built.
c45c19f8
JG
39If you get compiler warnings during this stage, see the `Reporting Bugs'
40section below; there are a few known problems.
361cc81a 41
c45c19f8
JG
42GDB can be used as a cross-debugger, running on a machine of one type
43while debugging a program running on a machine of another type. You
44configure it this way by specifying `./configure host -target=target';
45see below.
170d0c85 46
170d0c85 47
c45c19f8 48 More Documentation
bd5635a1 49
c45c19f8
JG
50The GDB manual is much expanded and improved. For online browsing,
51gdb/gdb.info is the main file, and there are gdb/gdb.info-1 through -6
52files that can be installed into your main `info' tree. If you want a
53printed version of the manual, you can run, from the GDB source
54directory,
bd5635a1 55
c45c19f8
JG
56 make gdb.dvi
57
58to make the TeX device-independent output file. This assumes you have
59a running TeX on your system. The source for the GDB manual is in
60doc/gdb.texinfo (and a few other files it includes), provided with
61this distribution. The Makefile attempts to use the texinfo.tex
62supplied as part of the BFD-and-libraries tar file, since the manual
63uses Texinfo-2 which is not in common use yet.
64
65
66 Configuration Details (extracted from gdb.texinfo)
67
68 GDB is distributed with a `configure' script that automates the
69process of preparing GDB for installation; you can then use `make'
70to build the `gdb' program.
71
72 The `configure' script that's specific to GDB is distributed in
73the main GDB source directory. However, building GDB also requires
74several other directories of source common to multiple GNU programs.
75These directories (GNU libraries and includes) are distributed
76separately, but their `configure' scripts and `Makefile's are
77designed to work together. To ensure that GDB's `Makefile' can find
78all the pieces, you should make a single overall directory to hold
79the directories of source for GNU libraries and includes, and you
80should install the GDB source directory there too. In this
81Appendix, we refer to the directory of GNU source directories as GNUSRC.
82
83 At a minimum, to build GDB you need the directories
84
85`GNUSRC/gdb'
86 the source specific to GDB itself
87
88`GNUSRC/bfd'
89 source for the Binary File Descriptor Library
90
91`GNUSRC/include'
92 GNU include files
93
94`GNUSRC/libiberty'
95 source for the `-liberty' free software library
96
97`GNUSRC/readline'
98 source for the GNU command-line interface
99
100Each of these directories has its own `configure' script. GNUSRC has
101an overall `configure' script, which is distributed with the GNU
102libraries and includes.
103
104 `configure' is designed to be called recursively, so it is most
105convenient to run `configure' from the GNUSRC directory. The
106simplest way to configure and build GDB is the following:
107
108 cd GNUSRC
109 ./configure HOST
110 make
111
112where HOST is something like `sun4' or `vax', that identifies the
113platform where GDB will run. This builds the three libraries `bfd',
114`readline', and `libiberty', then `gdb' itself. The configured
115source files, and the binaries, are left in the corresponding source
116directories.
117
118 You can install `gdb' anywhere; it has no hardwired paths.
119However, you should make sure that the shell on your path (named by
120the `SHELL' environment variable) is publicly readable; some systems
121refuse to let GDB debug child processes whose programs are not
122readable, and GDB uses the shell to start your program.
123
124
125 Configuration Subdirectories
126
127 If you build GDB for several host or target machines, and if your
128`make' program handles the `VPATH' feature (GNU `make' does), it is
129most convenient instead to build the different GDB configurations in
130subdirectories (separate from the source). `configure' does this
131for you when you simultaneously specify several configurations; but
132it's a good habit even for a single configuration. You can specify
133the use of subdirectories using the `+forcesubdirs' option
134(abbreviated `+f'). For example, you can build GDB on a Sun 4 as
135follows:
136
137 cd GNUSRC
138 ./configure +f sun4
139 cd Host-sun4/Target-sun4
140 make
141
142 When `configure' uses subdirectories to build programs or
143libraries, it creates nested directories `Host-HOST/Target-MACHINE'.
144This is because GDB can be configured for cross-compiling: GDB can
145run on one machine (the host) while debugging programs that run on
146another machine (the target). You specify cross-debugging targets
147by giving the `+target=MACHINE' option to `configure'. Specifying
148only hosts still gives you two levels of subdirectory for each host,
149with the same machine-name suffix on both. On the other hand,
150whenever you specify both hosts and targets on the same command
151line, `configure' creates all combinations of the hosts and targets you
152list.
153
154 When you run `make' to build a program or library, you must run it
155in a configured directory. If you made a single configuration,
156without subdirectories, run `make' in the source directory. If you
157have `Host-HOST/Target-MACHINE' subdirectories, run `make' in those
158subdirectories.
159
160 Each `configure' and `Makefile' under each source directory runs
161recursively, so that typing `make' in GNUSRC (or in a
162`GNUSRC/Host-HOST/Target-MACHINE' subdirectory) builds all the
163required libraries, then GDB.
164
165 If you run `configure' from a directory (such as GNUSRC) that
166contains source directories for multiple libraries or programs,
167`configure' creates the `Host-HOST/Target-MACHINE' subdirectories in
168each library or program's source directory. For example, typing:
169
170 cd GNUSRC
171 configure sun4 +target=vx960
172
173creates the following directories:
174
175 GNUSRC/Host-sun4/Target-vx960
176 GNUSRC/bfd/Host-sun4/Target-vx960
177 GNUSRC/gdb/Host-sun4/Target-vx960
178 GNUSRC/libiberty/Host-sun4/Target-vx960
179 GNUSRC/readline/Host-sun4/Target-vx960
180
181The `Makefile' in `GNUSRC/Host-sun4/Target-vx960' will `cd' to the
182appropriate lower-level directories (such as
183`GNUSRC/bfd/Host-sun4/Target-vx960'), building each in turn.
184
185 When you have multiple hosts or targets configured, you can run
186`make' on them in parallel (for example, if they are NFS-mounted on
187each of the hosts); they will not interfere with each other.
188
189
190 `configure' Options
191
192 Here is a summary of all the `configure' options and arguments
193that you might use for building GDB:
194
195 configure [+destdir=DIR] [+forcesubdirs] [+norecur] [+rm]
196 [+target=MACHINE...] HOST...
197
198You may introduce options with the character `-' rather than `+' if
199you prefer; but options introduced with `+' may be truncated.
200
201`+destdir=DIR'
202 DIR is an installation directory *path prefix*. After you
203 configure with this option, `make install' will install GDB as
204 `DIR/bin/gdb', and the libraries in `DIR/lib'. If you specify
205
206 `+destdir=/usr/local', for example, `make install' creates
207 `/usr/local/bin/gdb'.
208
209`+forcesubdirs'
210 Write configuration specific files in subdirectories of the form
211
212 Host-MACHINE/Target-MACHINE
213
214 (and configure the `Makefile' to write binaries there too).
215 Without this option, if you specify only one configuration for
216 GDB, `configure' will use the same directory for source,
217 configured files, and binaries. This option is used
218 automatically if you specify more than one HOST or more than
219 one `+target=MACHINE' option on the `configure' command line.
220
221`+norecur'
222 Configure only the directory where `configure' is executed; do
223 not propagate configuration to subdirectories.
224
225`+rm'
226 Remove the configuration specified by other arguments.
227
228`+target=MACHINE ...'
229 Configure GDB for cross-debugging programs running on each
230 specified MACHINE. You may specify as many `+target' options
231 as you wish. To see a list of available targets, execute `ls
232 tconfig' in the GDB source directory. Without this option, GDB
233 is configured to debug programs that run on the same machine
234 (HOST) as GDB itself.
235
236`HOST ...'
237 Configure GDB to run on each specified HOST. You may specify as
238 many host names as you wish. To see a list of available hosts,
239 execute `ls xconfig' in the GDB source directory.
240
241`configure' accepts other options, for compatibility with configuring
242other GNU tools recursively; but these are the only options that
243affect GDB or its supporting libraries.
bd5635a1 244
bd5635a1 245
c45c19f8 246 Languages other than C
bd5635a1
RP
247
248C++ support has been integrated into gdb. GDB should work with FORTRAN
c45c19f8
JG
249programs. (If you have problems, please send a bug report; you may
250have to refer to some FORTRAN variables with a trailing underscore).
251There is an effort to produce a GDB that works with Modula-2. I am not
252aware of anyone who is working on getting gdb to use the syntax of any
253other language. Pascal programs which use sets, subranges, file
254variables, or nested functions will not currently work.
bd5635a1 255
bd5635a1 256
c45c19f8 257 Kernel debugging
bd5635a1 258
c45c19f8
JG
259I have't done this myself so I can't really offer any advice.
260Remote debugging over serial lines works fine, but the kernel debugging
261code in here has not been tested in years. Van Jacobson claims to have
262better kernel debugging, but won't release it for ordinary mortals.
bd5635a1 263
bd5635a1 264
c45c19f8 265 Remote debugging
bd5635a1 266
361cc81a
JG
267The files m68k-stub.c and i386-stub.c contain two examples of remote
268stubs to be used with remote.c. They are designeded to run standalone
269on a 68k or 386 cpu and communicate properly with the remote.c stub
270over a serial line.
271
170d0c85
RP
272The file rem-multi.shar contains a general stub that can probably
273run on various different flavors of unix to allow debugging over a
361cc81a 274serial line from one machine to another.
bd5635a1
RP
275
276The files remote-eb.c and remote-nindy.c are two examples of remote
277interfaces for talking to existing ROM monitors (for the AMD 29000 and the
170d0c85
RP
278Intel 960 repsectively).
279
280Remote-vx.c and the vx-share subdirectory contain a remote interface for the
281VxWorks realtime kernel, which communicates over TCP using the Sun
282RPC library. This would be a useful starting point for other remote-
283via-ethernet back ends.
bd5635a1 284
c45c19f8
JG
285[This section seems to be out of date, I have never seen the "rapp"
286program, though I would like to. FIXME.]
287`rapp' runs under unix and acts as a remote stub (like rem-multi.shar
288distributed with GDB version 3). Currently it just works over UDP
289(network), not over a serial line. To get it running
290* Compile GDB on the host machine as usual
291* Compile rapp on the target machine, giving for both host and target
292 the type of the target machine
293* Install "gdb" in /etc/services on both machines.
bd5635a1 294
c45c19f8
JG
295
296 Reporting Bugs
297
298The correct address for reporting bugs found in gdb is
bd5635a1
RP
299"bug-gdb@prep.ai.mit.edu". Please email all bugs to that address.
300
c45c19f8
JG
301"mcheck.c", line 32, will produce a pointer conversion warning, which
302can be ignored.
303
304When gdb reads object files produced by the Sun bundled C compiler,
305you will often get a "bad block start address patched" message. You
306can shut off such messages with the command `set complaint 0' (which
307you can put in your ~/.gdbinit if you like). Messages like this
308during symbol reading indicate some mismatch between the object file
309and GDB's symbol reading code (in this case, it's a mismatch
310between the specs for the object file format, and what Sun's compiler
311actually outputs).
312
313If you port gdb to a new machine, please send the required changes
314to bug-gdb@prep.ai.mit.edu. If your changes are more than a few
315lines, obtain and send in a copyright assignment from gnu@prep.ai.mit.edu, as
316described in the section `Writing Code for GDB'.
317
318
319 X Windows versus GDB
bd5635a1 320
361cc81a 321xgdb is obsolete. We are not doing any development or support of it.
bd5635a1 322
c45c19f8
JG
323There is an "xxgdb", which shows more promise, which was posted to
324comp.sources.x.
bd5635a1
RP
325
326For those intersted in auto display of source and the availability of
327an editor while debugging I suggest trying gdb-mode in gnu-emacs
328(Try typing M-x gdb RETURN). Comments on this mode are welcome.
329
c45c19f8
JG
330
331 About the machine-dependent files
bd5635a1
RP
332
333tconfig/<machine>
334This contains Makefile stuff for when the target system is <machine>.
335It also specifies the name of the tm-XXX.h file for this machine.
336
337xconfig/<machine>
338This contains Makefile stuff for when the host system is <machine>.
339It also specifies the name of the xm-XXX.h file for this machine.
340
170d0c85 341tm-XXX.h (tm.h is a link to this file, created by configure).
c45c19f8
JG
342This file contains macro definitions about the target machine's
343registers, stack frame format and instructions.
bd5635a1 344
170d0c85 345xm-XXX.h (xm.h is a link to this file, created by configure).
bd5635a1
RP
346This contains macro definitions describing the host system environment,
347such as byte order, host C compiler and library, ptrace support,
348and core file structure.
349
350<machine>-opcode.h
351<machine>-pinsn.c
352These files contain the information necessary to print instructions
353for your cpu type. <machine>-opcode.h includes some large initialized
354data structures, which is strange for a ".h" file, but it's OK since
355it is only included in one place. <machine>-opcode.h is shared
356between the debugger and the assembler (if the GNU assembler has been
357ported to that machine), whereas <machine>-pinsn.c is specific to GDB.
358
359<machine>-tdep.c
360This file contains any miscellaneous code required for this machine
361as a target. On some machines it doesn't exist at all. Its existence
362is specified in the tconfig/XXX file.
363
364<machine>-xdep.c
365This file contains any miscellaneous code required for this machine
366as a host. On some machines it doesn't exist at all. Its existence
367is specified in the xconfig/XXX file.
368
369infptrace.c
370This is the low level interface to inferior processes for systems
371using the Unix ptrace call in a vanilla way. Some systems have their
372own routines in <machine>-xdep.c. Whether or not it is used
373is specified in the xconfig/XXX file.
374
375coredep.c
376Machine and system-dependent aspects of reading core files. Some
377machines use coredep.c; some have the routines in <machine>-xdep.c.
378Whether or not it is used is specified in the xconfig/XXX file.
379Now that BFD is used to read core files, virtually all machines should
380use coredep.c and should just provide fetch_core_registers in
381<machine>-xdep.c.
382
383exec.c
384Machine and system-dependent aspects of reading executable files.
385Some machines use exec.c; some have the routines in <machine>-tdep.c
386Since BFD, virtually all machines should use exec.c.
387
c45c19f8
JG
388
389 Writing Code for GDB
bd5635a1
RP
390
391We appreciate having users contribute code that is of general use, but
392for it to be included in future GDB releases it must be cleanly
393written. We do not want to include changes that will needlessly make
394future maintainance difficult. It is not much harder to do things
395right, and in the long term it is worth it to the GNU project, and
396probably to you individually as well.
397
398Please code according to the GNU coding standards. If you do not have
399a copy, you can request one by sending mail to gnu@prep.ai.mit.edu.
400
401If you make substantial changes, you'll have to file a copyright
402assignment with the Free Software Foundation before we can produce a
403release that includes your changes. Send mail requesting the copyright
404assignment to gnu@prep.ai.mit.edu. Do this early, like before the
405changes actually work, or even before you start them, because a manager
406or lawyer on your end will probably make this a slow process.
407
408Please try to avoid making machine-specific changes to
409machine-independent files. If this is unavoidable, put a hook in the
410machine-independent file which calls a (possibly) machine-dependent
411macro (for example, the IGNORE_SYMBOL macro can be used for any
412symbols which need to be ignored on a specific machine. Calling
413IGNORE_SYMBOL in dbxread.c is a lot cleaner than a maze of #if
414defined's). The machine-independent code should do whatever "most"
415machines want if the macro is not defined in param.h. Using #if
361cc81a 416defined can sometimes be OK (e.g. SET_STACK_LIMIT_HUGE) but should be
bd5635a1
RP
417conditionalized on a specific feature of an operating system (set in
418tm.h or xm.h) rather than something like #if defined(vax) or #if
419defined(SYSV). If you use an #ifdef on some symbol that is defined
420in a header file (e.g. #ifdef TIOCSETP), *please* make sure that you
421have #include'd the relevant header file in that module!
422
423It is better to replace entire routines which may be system-specific,
424rather than put in a whole bunch of hooks which are probably not going
425to be helpful for any purpose other than your changes. For example,
426if you want to modify dbxread.c to deal with DBX debugging symbols
427which are in COFF files rather than BSD a.out files, do something
428along the lines of a macro GET_NEXT_SYMBOL, which could have
429different definitions for COFF and a.out, rather than trying to put
430the necessary changes throughout all the code in dbxread.c that
431currently assumes BSD format.
432
433Please avoid duplicating code. For example, in GDB 3.x all the stuff
434in infptrace.c was duplicated in *-dep.c, and so changing something
c45c19f8 435was very painful. In GDB 4.x, these have all been consolidated
bd5635a1
RP
436into infptrace.c. infptrace.c can deal with variations between
437systems the same way any system-independent file would (hooks, #if
438defined, etc.), and machines which are radically different don't need
439to use infptrace.c at all. The same was true of core_file_command
440and exec_file_command.
441
bd5635a1 442
c45c19f8 443 Debugging gdb with itself
bd5635a1 444
c45c19f8
JG
445If gdb is limping on your machine, this is the preferred way to get it
446fully functional. Be warned that in some ancient Unix systems, like
447Ultrix 4.0, a program can't be running in one process while it is being
448debugged in another. Rather than doing "./gdb ./gdb", which works on
449Suns and such, you can copy gdb to gdb2 and then do "./gdb ./gdb2".
bd5635a1
RP
450
451When you run gdb in this directory, it will read a ".gdbinit" file that
452sets up some simple things to make debugging gdb easier. The "info"
453command, when executed without a subcommand in a gdb being debugged by
454gdb, will pop you back up to the top level gdb. See .gdbinit for details.
c45c19f8
JG
455
456If you use emacs, you will probably want to do a "make TAGS" after you
457configure your distribution; this will put the machine dependent
458routines for your local machine where they will be accessed first by a
459M-period.
460
461Also, make sure that you've compiled gdb with your local cc or taken
462appropriate precautions regarding ansification of include files. See
463the Makefile for more information.
bd5635a1
RP
464\f
465(this is for editing this file with GNU emacs)
466Local Variables:
467mode: text
468End:
This page took 0.047822 seconds and 4 git commands to generate.