Initial revision
[binutils-gdb.git] / gdb / README
1 This is GDB, the GNU source-level debugger, presently running under
2 un*x. This is a pre-alpha version of GDB version 4, and has NOT been
3 extensively tested. It surely has some bugs, both bugs that were
4 present in version 3 and new bugs. I have filed all the bug reports
5 and fixes mailed to bug-gdb, and the fixes in particular will move
6 into these sources as I find the time.
7
8 => THIS VERSION IS PARTICULARLY FRAGILE! <=
9
10 It depends on a preliminary version of a new "binary file
11 descriptor" library and a new global "include" directory, which
12 are packaged separately from GDB. You must obtain, configure
13 and build this library manually, then configure and build gdb.
14 When building gdb's for multiple platforms, you must manually
15 rebuild the bfd library separately for each platform. Yes, of
16 course, we are working on this! FIXME!
17
18 Configure bfd for your host system by:
19
20 cd ../bfd
21 edit Makefile
22 make
23
24 Then you can cd ../gdb-whatever, and config and build gdb.
25
26 This release moves the generic GNU include files, the BFD library,
27 and the getopt routines into the parent directory of gdb. The idea
28 is that a variety of GNU tools can share a common copy of these things.
29
30 A summary of features new since gdb-3.5 is in the file `WHATS.NEW'.
31
32 The best way to build GDB, in my opinion, is in a subdirectory. I use
33 a naming convention "=XXX" where XXX is the machine type I'm building
34 for. Nothing depends on this, it's just how I remember which
35 subdirectories are what. So, once you have the BFD library built for
36 that machine, you can do:
37
38 cd gdb-x.yy (the directory where this README is)
39 mkdir =XXX (e.g. mkdir =vax)
40 cd =XXX
41 ../config.gdb machine
42 make
43
44 Machine is like "vax" or "sun4". For more information type `../config.gdb'.
45
46 Once you have done that, just `make' will do everything, producing an
47 executable `gdb' in this directory.
48
49 You can also build gdb binaries in a completely different directory from its
50 sources, by specifying "srcdir=YYY" to config.gdb, giving it an absolute
51 or relative path to the source directory.
52
53 GDB can be used as a cross-debugger, running on a machine of one type
54 while debugging a program running on a machine of another type. You
55 configure it this way by specifying `config.gdb host target' where host
56 is where GDB runs, and target is where your program runs.
57
58 If you want a new (current to this release) version of the manual, you
59 will have to use the gdb.texinfo file provided with this distribution.
60 For details see the texinfo manual (distributed with emacs and as a
61 printed manual).
62
63 About languages other than C...
64
65 C++ support has been integrated into gdb. GDB should work with FORTRAN
66 programs (if you have problem, please send a bug report; note that you
67 may have to refer to some FORTRAN variables with a trailing
68 underscore), but I am not aware of anyone who is working on getting it
69 to use the syntax of any language other than C or C++. Pascal programs
70 which use sets, subranges, file variables, or nested functions will not
71 currently work.
72
73 About kernel debugging...
74
75 I have't done this myself so I can't really offer any advice.
76 Remote debugging over serial lines is more like to be in a currently
77 functioning state than the standalone gdb (kdb). FIXME.
78
79 About remote debugging...
80
81 [This section seems to be out of date, I have never seen the "rapp"
82 program, though I would like to. FIXME.]
83 `rapp' runs under unix and acts as a remote stub (like remote-multi.shar
84 distributed with GDB version 3). Currently it just works over UDP
85 (network), not over a serial line. To get it running
86 * Compile GDB on the host machine as usual
87 * Compile rapp on the target machine, giving for both host and target
88 the type of the target machine
89 * Install "gdb" in /etc/services on both machines.
90
91 This will get reworked before the initial release of 4.x. FIXME.
92
93 The two files remote-multi.shar and remote-sa.m68k.shar contain two
94 examples of a remote stub to be used with remote.c. The the -multi
95 file is a general stub that can probably be running on various
96 different flavors of unix to allow debugging over a serial line from
97 one machine to another. The remote-sa.m68k.shar is designed to run
98 standalone on a 68k type cpu and communicate properley with the
99 remote.c stub over a serial line.
100
101 The files remote-eb.c and remote-nindy.c are two examples of remote
102 interfaces for talking to existing ROM monitors (for the AMD 29000 and the
103 Intel 960 repsectively). There is also a remote interface for the
104 VxWorks realtime kernel, which communicates over TCP/IP, in remote-vx.c
105 and the vx-share subdirectory.
106
107 About reporting bugs...
108
109 The correct address for reporting bugs found with gdb is
110 "bug-gdb@prep.ai.mit.edu". Please email all bugs to that address.
111
112 About xgdb...
113
114 Hopefully a new xgdb will be in 4.x.
115
116 xgdb.c was provided to us by the user community; it is not an integral
117 part of the gdb distribution. The problem of providing visual
118 debugging support on top of gdb is peripheral to the GNU project and
119 (at least right now) we can't afford to put time into it. So while we
120 will be happy to incorporate user fixes to xgdb.c, we do not guarantee
121 that it will work and we will not fix bugs reported in it. See
122 XGDB-README for one person's opinion about what is wrong with the
123 current xgdb. Someone is working on writing a new XGDB, so improving
124 (e.g. by fixing it so that it will work, if it doesn't currently) the
125 current one is not worth it.
126
127 For those intersted in auto display of source and the availability of
128 an editor while debugging I suggest trying gdb-mode in gnu-emacs
129 (Try typing M-x gdb RETURN). Comments on this mode are welcome.
130
131 About the machine-dependent files...
132
133 tconfig/<machine>
134 This contains Makefile stuff for when the target system is <machine>.
135 It also specifies the name of the tm-XXX.h file for this machine.
136
137 xconfig/<machine>
138 This contains Makefile stuff for when the host system is <machine>.
139 It also specifies the name of the xm-XXX.h file for this machine.
140
141 tm-XXX.h (tm.h is a link to this file, created by config.gdb).
142 This file contains macro definitions that express information
143 about the target machine's registers, stack frame format and instructions.
144
145 xm-XXX.h (xm.h is a link to this file, created by config.gdb).
146 This contains macro definitions describing the host system environment,
147 such as byte order, host C compiler and library, ptrace support,
148 and core file structure.
149
150 <machine>-opcode.h
151 <machine>-pinsn.c
152 These files contain the information necessary to print instructions
153 for your cpu type. <machine>-opcode.h includes some large initialized
154 data structures, which is strange for a ".h" file, but it's OK since
155 it is only included in one place. <machine>-opcode.h is shared
156 between the debugger and the assembler (if the GNU assembler has been
157 ported to that machine), whereas <machine>-pinsn.c is specific to GDB.
158
159 <machine>-tdep.c
160 This file contains any miscellaneous code required for this machine
161 as a target. On some machines it doesn't exist at all. Its existence
162 is specified in the tconfig/XXX file.
163
164 <machine>-xdep.c
165 This file contains any miscellaneous code required for this machine
166 as a host. On some machines it doesn't exist at all. Its existence
167 is specified in the xconfig/XXX file.
168
169 infptrace.c
170 This is the low level interface to inferior processes for systems
171 using the Unix ptrace call in a vanilla way. Some systems have their
172 own routines in <machine>-xdep.c. Whether or not it is used
173 is specified in the xconfig/XXX file.
174
175 coredep.c
176 Machine and system-dependent aspects of reading core files. Some
177 machines use coredep.c; some have the routines in <machine>-xdep.c.
178 Whether or not it is used is specified in the xconfig/XXX file.
179 Now that BFD is used to read core files, virtually all machines should
180 use coredep.c and should just provide fetch_core_registers in
181 <machine>-xdep.c.
182
183 exec.c
184 Machine and system-dependent aspects of reading executable files.
185 Some machines use exec.c; some have the routines in <machine>-tdep.c
186 Since BFD, virtually all machines should use exec.c.
187
188 About writing code for GDB...
189
190 We appreciate having users contribute code that is of general use, but
191 for it to be included in future GDB releases it must be cleanly
192 written. We do not want to include changes that will needlessly make
193 future maintainance difficult. It is not much harder to do things
194 right, and in the long term it is worth it to the GNU project, and
195 probably to you individually as well.
196
197 Please code according to the GNU coding standards. If you do not have
198 a copy, you can request one by sending mail to gnu@prep.ai.mit.edu.
199
200 If you make substantial changes, you'll have to file a copyright
201 assignment with the Free Software Foundation before we can produce a
202 release that includes your changes. Send mail requesting the copyright
203 assignment to gnu@prep.ai.mit.edu. Do this early, like before the
204 changes actually work, or even before you start them, because a manager
205 or lawyer on your end will probably make this a slow process.
206
207 Please try to avoid making machine-specific changes to
208 machine-independent files. If this is unavoidable, put a hook in the
209 machine-independent file which calls a (possibly) machine-dependent
210 macro (for example, the IGNORE_SYMBOL macro can be used for any
211 symbols which need to be ignored on a specific machine. Calling
212 IGNORE_SYMBOL in dbxread.c is a lot cleaner than a maze of #if
213 defined's). The machine-independent code should do whatever "most"
214 machines want if the macro is not defined in param.h. Using #if
215 defined can sometimes be OK (e.g. SET_STACK_LIMIT_HUGE) but should be
216 conditionalized on a specific feature of an operating system (set in
217 tm.h or xm.h) rather than something like #if defined(vax) or #if
218 defined(SYSV). If you use an #ifdef on some symbol that is defined
219 in a header file (e.g. #ifdef TIOCSETP), *please* make sure that you
220 have #include'd the relevant header file in that module!
221
222 It is better to replace entire routines which may be system-specific,
223 rather than put in a whole bunch of hooks which are probably not going
224 to be helpful for any purpose other than your changes. For example,
225 if you want to modify dbxread.c to deal with DBX debugging symbols
226 which are in COFF files rather than BSD a.out files, do something
227 along the lines of a macro GET_NEXT_SYMBOL, which could have
228 different definitions for COFF and a.out, rather than trying to put
229 the necessary changes throughout all the code in dbxread.c that
230 currently assumes BSD format.
231
232 Please avoid duplicating code. For example, in GDB 3.x all the stuff
233 in infptrace.c was duplicated in *-dep.c, and so changing something
234 was very painful. Thus in GDB 4.x these have all been consolidated
235 into infptrace.c. infptrace.c can deal with variations between
236 systems the same way any system-independent file would (hooks, #if
237 defined, etc.), and machines which are radically different don't need
238 to use infptrace.c at all. The same was true of core_file_command
239 and exec_file_command.
240
241 About debugging gdb with itself...
242
243 You probably want to do a "make TAGS" after you configure your
244 distribution; this will put the machine dependent routines for your
245 local machine where they will be accessed first by a M-period .
246
247 Also, make sure that you've compiled gdb with your local cc or taken
248 appropriate precautions regarding ansification of include files. See
249 the Makefile for more information.
250
251 When you run gdb in this directory, it will read a ".gdbinit" file that
252 sets up some simple things to make debugging gdb easier. The "info"
253 command, when executed without a subcommand in a gdb being debugged by
254 gdb, will pop you back up to the top level gdb. See .gdbinit for details.
255 \f
256 (this is for editing this file with GNU emacs)
257 Local Variables:
258 mode: text
259 End: