386BSD 0.0 development
[unix-history] / usr / src / usr.bin / gdb / README.gnu
CommitLineData
d7a2300c
WJ
1This is GDB, the GNU source-level debugger, presently running under un*x.
2
3Before compiling GDB, you must tell GDB what kind of machine you are
4running on. To do this, type `config.gdb machine', where machine is
5something like `vax' or `sun2'. For a list of valid machine types,
6type `config.gdb'.
7
8Normally config.gdb edits the makefile as necessary. If you have to
9edit the makefile on a standard machine listed in config.gdb this
10should be considered a bug and reported as such.
11
12Once these files are set up, just `make' will do everything,
13producing an executable `gdb' in this directory.
14
15If you want a new (current to this release) version of the manual, you
16will have to use the gdb.texinfo file provided with this distribution.
17The gdb.texinfo file requires the texinfo-format-buffer command from
18emacs 18.55 or later.
19
20About languages other than C...
21
22C++ support has been integrated into gdb. GDB should work with
23FORTRAN programs (if you have problem, please send a bug report), but
24I am not aware of anyone who is working on getting it to use the
25syntax of any language other than C or C++. Pascal programs which use
26sets, subranges, file variables, or nested functions will not
27currently work.
28
29About -gg format...
30
31Currently GDB version 3.x does *not* support GCC's -gg format. This
32is because it (in theory) has fast enough startup on dbx debugging
33format object files that -gg format is unnecessary (and hence
34undesirable, since it wastes space and processing power in gcc). I
35would like to hear people's opinions on the amount of time currently
36spent in startup; is it fast enough?
37
38About remote debugging...
39
40The two files remote-multi.shar and remote-sa.m68k.shar contain two
41examples of a remote stub to be used with remote.c. The the -multi
42file is a general stub that can probably be running on various
43different flavors of unix to allow debugging over a serial line from
44one machine to another. The remote-sa.m68k.shar is designed to run
45standalone on a 68k type cpu and communicate properley with the
46remote.c stub over a serial line.
47
48About reporting bugs...
49
50The correct address for reporting bugs found with gdb is
51"bug-gdb@prep.ai.mit.edu". Please send all bugs to that address.
52
53About xgdb...
54
55xgdb.c was provided to us by the user community; it is not an integral
56part of the gdb distribution. The problem of providing visual
57debugging support on top of gdb is peripheral to the GNU project and
58(at least right now) we can't afford to put time into it. So while we
59will be happy to incorporate user fixes to xgdb.c, we do not guarantee
60that it will work and we will not fix bugs reported in it. Someone is
61working on writing a new XGDB, so improving (e.g. by fixing it so that
62it will work, if it doesn't currently) the current one is not worth it.
63
64For those intersted in auto display of source and the availability of
65an editor while debugging I suggest trying gdb-mode in gnu-emacs.
66Comments on this mode are welcome.
67
68About the machine-dependent files...
69
70m-<machine>.h (param.h is a link to this file).
71This file contains macro definitions that express information
72about the machine's registers, stack frame format and instructions.
73
74<machine>-opcode.h (opcode.h is a link to this file).
75<machine>-pinsn.c (pinsn.c is a link to this file).
76These files contain the information necessary to print instructions
77for your cpu type.
78
79<machine>-dep.c (dep.c is a link to this file).
80Those routines which provide a low level interface to ptrace and which
81tend to be machine-dependent. (The machine-independent routines are in
82`infrun.c' and `inflow.c')
83
84About writing code for GDB...
85
86We appreciate having users contribute code that is of general use, but
87for it to be included in future GDB releases it must be cleanly
88written. We do not want to include changes that will needlessly make future
89maintainance difficult. It is not much harder to do things right, and
90in the long term it is worth it to the GNU project, and probably to
91you individually as well.
92
93Please code according to the GNU coding standards. If you do not have
94a copy, you can request one by sending mail to gnu@prep.ai.mit.edu.
95
96Please try to avoid making machine-specific changes to
97machine-independent files (i.e. all files except "param.h" and
98"dep.c". "pinsn.c" and "opcode.h" are processor-specific but not
99operating system-dependent). If this is unavoidable, put a hook in
100the machine-independent file which calls a (possibly)
101machine-dependent macro (for example, the IGNORE_SYMBOL macro can be
102used for any symbols which need to be ignored on a specific machine.
103Calling IGNORE_SYMBOL in dbxread.c is a lot cleaner than a maze of #if
104defined's). The machine-independent code should do whatever "most"
105machines want if the macro is not defined in param.h. Using #if
106defined can sometimes be OK (e.g. SET_STACK_LIMIT_HUGE) but should be
107conditionalized on a specific feature of an operating system (set in
108param.h) rather than something like #if defined(vax) or #if
109defined(SYSV).
110
111It is better to replace entire routines which may be system-specific,
112rather than put in a whole bunch of hooks which are probably not going
113to be helpful for any purpose other than your changes. For example,
114if you want to modify dbxread.c to deal with DBX debugging symbols
115which are in COFF files rather than BSD a.out files, do something
116along the lines of a macro GET_NEXT_SYMBOL, which could have
117different definitions for COFF and a.out, rather than trying to put
118the necessary changes throughout all the code in dbxread.c that
119currently assumes BSD format.
120
121Please avoid duplicating code. For example, if something needs to be
122changed in read_inferior_memory, it is very painful because there is a
123copy in every dep.c file. The correct way to do this is to put (in
124this case) the standard ptrace interfaces in a separate file ptrace.c,
125which is used by all systems which have ptrace. ptrace.c would deal
126with variations between systems the same way any system-independent
127file would (hooks, #if defined, etc.).
128
129About debugging gdb with itself...
130
131You probably want to do a "make TAGS" after you configure your
132distribution; this will put the machine dependent routines for your
133local machine where they will be accessed first by a M-period .
134
135Also, make sure that you've compiled gdb with your local cc or taken
136appropriate precautions regarding ansification of include files. See
137the Makefile for more information.
138
139The "info" command, when executed without a subcommand in a gdb being
140debugged by gdb, will pop you back up to the top level gdb. See
141.gdbinit for more details.
142