c13e18cd386a6977ba8ac6d7f15ba39b4ad557b8
[deliverable/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 release moves the generic GNU include files, the BFD ("binary
9 file description") library, the
10 getopt routines, obstacks, and the readline library into the parent
11 directory of gdb. The idea is that a variety of GNU tools can share a
12 common copy of these things.
13
14 These generic files are packaged separately from GDB. You must obtain
15 them separately from GDB, and unpack them into the same directory, so
16 that the directories:
17
18 bfd gdb include libiberty readline texinfo
19
20 are all in the same directory. There should also be a "configure"
21 script (and its parameters, in "configure.in" and "Makefile.in"),
22 in the same place.
23
24 Once you have this stuff unpacked, you can cd to the directory in which
25 you unpacked them, and type:
26
27 ./configure HOSTNAME
28 make
29
30 and all the libraries, as well as GDB will be configured and built.
31
32
33 When building gdb's for multiple platforms, you must manually
34 rebuild the libraries separately for each platform. FIXME FIXME no more!
35 MENTION VPATH.
36
37 cd ../readline
38 [edit Makefile as appropriate]
39 make
40
41 A summary of features new since gdb-3.5 is in the file `WHATS.NEW'.
42
43 The best way to build GDB (and the supporting libraries and include
44 files), in my opinion, is in subdirectories. The configure script
45 does this automatically if you specify more than one HOSTNAME; you can
46 force it, even for one host only, by using configure's "+forcesubdirs"
47 option (which you can abbreviate to +f). configure will create two
48 directory levels, Host-machine and Target-machine. "machine"
49 depends on your configuration options; the two directory levels
50 reflect the fact that GDB can be configured for cross-debugging
51 (described further below).
52
53 For example, you can do
54
55 cd .. (the directory *above* where this README is)
56 configure +f mymachine
57 cd Host-mymachine/Target-mymachine
58 make
59
60 Machine is like "vax" or "sun4". For more information type
61 `./configure'. For a list of host machines, see the "xconfig"
62 directory; for a list of targets, see the "tconfig" directory.
63
64
65 Once you have done that, just `make' will do everything, producing an
66 executable `gdb' in this directory. You can install it anywhere; it has
67 no hardwired paths in it. However, you should make sure that the shell
68 on your path (named by the SHELL environment variable) is publicly
69 readable; various systems refuse to let GDB debug child programs which
70 are not readable, and GDB uses the shell to start your program.
71
72 You can also build gdb binaries in a completely different directory from its
73 sources, by specifying "-destdir=YYY" to ./configure, giving it an absolute
74 or relative path to the installation directory.
75
76 GDB can be used as a cross-debugger, running on a machine of one type
77 while debugging a program running on a machine of another type. You
78 configure it this way by specifying `./configure host -target=target'
79 where host is where GDB runs, and target is where your program runs.
80
81 If you want a new (current to this release) version of the manual, you
82 can run, from the GDB source directory,
83 make gdb.dvi
84 to make the TeX device-independent output file, or
85 make gdb.info
86 to make the "info" version for online browsing. The former assumes
87 you have a running TeX on your system; the latter, a running makeinfo.
88 The source for the GDB manual is in the doc/gdb.texinfo file (and a
89 few other files it includes) provided with this distribution. The
90 Makefile attempts to use a texinfo.tex from a "texinfo" directory
91 parallel to the GDB directory (../texinfo/texinfo.tex, from the
92 directory where this README is). For details see the texinfo manual
93 (distributed with emacs and as a printed manual).
94
95 About languages other than C...
96
97 C++ support has been integrated into gdb. GDB should work with FORTRAN
98 programs. (If you have problems, please send a bug report; you
99 may have to refer to some FORTRAN variables with a trailing
100 underscore). I am not aware of anyone who is working on getting gdb
101 to use the syntax of any language other than C or C++. Pascal programs
102 which use sets, subranges, file variables, or nested functions will not
103 currently work.
104
105 About kernel debugging...
106
107 I have't done this myself so I can't really offer any advice.
108 Remote debugging over serial lines is more like to be in a currently
109 functioning state than the standalone gdb (kdb). FIXME.
110
111 About remote debugging...
112
113 [This section seems to be out of date, I have never seen the "rapp"
114 program, though I would like to. FIXME.]
115 `rapp' runs under unix and acts as a remote stub (like rem-multi.shar
116 distributed with GDB version 3). Currently it just works over UDP
117 (network), not over a serial line. To get it running
118 * Compile GDB on the host machine as usual
119 * Compile rapp on the target machine, giving for both host and target
120 the type of the target machine
121 * Install "gdb" in /etc/services on both machines.
122
123 This will get reworked before the initial release of 4.x. FIXME.
124
125 The files m68k-stub.c and i386-stub.c contain two examples of remote
126 stubs to be used with remote.c. They are designeded to run standalone
127 on a 68k or 386 cpu and communicate properly with the remote.c stub
128 over a serial line.
129
130 The file rem-multi.shar contains a general stub that can probably
131 run on various different flavors of unix to allow debugging over a
132 serial line from one machine to another.
133
134 The files remote-eb.c and remote-nindy.c are two examples of remote
135 interfaces for talking to existing ROM monitors (for the AMD 29000 and the
136 Intel 960 repsectively).
137
138 Remote-vx.c and the vx-share subdirectory contain a remote interface for the
139 VxWorks realtime kernel, which communicates over TCP using the Sun
140 RPC library. This would be a useful starting point for other remote-
141 via-ethernet back ends.
142
143 About reporting bugs...
144
145 The correct address for reporting bugs found with gdb is
146 "bug-gdb@prep.ai.mit.edu". Please email all bugs to that address.
147
148 About xgdb...
149
150 xgdb is obsolete. We are not doing any development or support of it.
151
152 There is an "xxgdb", which shows more promise.
153
154 For those intersted in auto display of source and the availability of
155 an editor while debugging I suggest trying gdb-mode in gnu-emacs
156 (Try typing M-x gdb RETURN). Comments on this mode are welcome.
157
158 About the machine-dependent files...
159
160 tconfig/<machine>
161 This contains Makefile stuff for when the target system is <machine>.
162 It also specifies the name of the tm-XXX.h file for this machine.
163
164 xconfig/<machine>
165 This contains Makefile stuff for when the host system is <machine>.
166 It also specifies the name of the xm-XXX.h file for this machine.
167
168 tm-XXX.h (tm.h is a link to this file, created by configure).
169 This file contains macro definitions that express information
170 about the target machine's registers, stack frame format and instructions.
171
172 xm-XXX.h (xm.h is a link to this file, created by configure).
173 This contains macro definitions describing the host system environment,
174 such as byte order, host C compiler and library, ptrace support,
175 and core file structure.
176
177 <machine>-opcode.h
178 <machine>-pinsn.c
179 These files contain the information necessary to print instructions
180 for your cpu type. <machine>-opcode.h includes some large initialized
181 data structures, which is strange for a ".h" file, but it's OK since
182 it is only included in one place. <machine>-opcode.h is shared
183 between the debugger and the assembler (if the GNU assembler has been
184 ported to that machine), whereas <machine>-pinsn.c is specific to GDB.
185
186 <machine>-tdep.c
187 This file contains any miscellaneous code required for this machine
188 as a target. On some machines it doesn't exist at all. Its existence
189 is specified in the tconfig/XXX file.
190
191 <machine>-xdep.c
192 This file contains any miscellaneous code required for this machine
193 as a host. On some machines it doesn't exist at all. Its existence
194 is specified in the xconfig/XXX file.
195
196 infptrace.c
197 This is the low level interface to inferior processes for systems
198 using the Unix ptrace call in a vanilla way. Some systems have their
199 own routines in <machine>-xdep.c. Whether or not it is used
200 is specified in the xconfig/XXX file.
201
202 coredep.c
203 Machine and system-dependent aspects of reading core files. Some
204 machines use coredep.c; some have the routines in <machine>-xdep.c.
205 Whether or not it is used is specified in the xconfig/XXX file.
206 Now that BFD is used to read core files, virtually all machines should
207 use coredep.c and should just provide fetch_core_registers in
208 <machine>-xdep.c.
209
210 exec.c
211 Machine and system-dependent aspects of reading executable files.
212 Some machines use exec.c; some have the routines in <machine>-tdep.c
213 Since BFD, virtually all machines should use exec.c.
214
215 About writing code for GDB...
216
217 We appreciate having users contribute code that is of general use, but
218 for it to be included in future GDB releases it must be cleanly
219 written. We do not want to include changes that will needlessly make
220 future maintainance difficult. It is not much harder to do things
221 right, and in the long term it is worth it to the GNU project, and
222 probably to you individually as well.
223
224 Please code according to the GNU coding standards. If you do not have
225 a copy, you can request one by sending mail to gnu@prep.ai.mit.edu.
226
227 If you make substantial changes, you'll have to file a copyright
228 assignment with the Free Software Foundation before we can produce a
229 release that includes your changes. Send mail requesting the copyright
230 assignment to gnu@prep.ai.mit.edu. Do this early, like before the
231 changes actually work, or even before you start them, because a manager
232 or lawyer on your end will probably make this a slow process.
233
234 Please try to avoid making machine-specific changes to
235 machine-independent files. If this is unavoidable, put a hook in the
236 machine-independent file which calls a (possibly) machine-dependent
237 macro (for example, the IGNORE_SYMBOL macro can be used for any
238 symbols which need to be ignored on a specific machine. Calling
239 IGNORE_SYMBOL in dbxread.c is a lot cleaner than a maze of #if
240 defined's). The machine-independent code should do whatever "most"
241 machines want if the macro is not defined in param.h. Using #if
242 defined can sometimes be OK (e.g. SET_STACK_LIMIT_HUGE) but should be
243 conditionalized on a specific feature of an operating system (set in
244 tm.h or xm.h) rather than something like #if defined(vax) or #if
245 defined(SYSV). If you use an #ifdef on some symbol that is defined
246 in a header file (e.g. #ifdef TIOCSETP), *please* make sure that you
247 have #include'd the relevant header file in that module!
248
249 It is better to replace entire routines which may be system-specific,
250 rather than put in a whole bunch of hooks which are probably not going
251 to be helpful for any purpose other than your changes. For example,
252 if you want to modify dbxread.c to deal with DBX debugging symbols
253 which are in COFF files rather than BSD a.out files, do something
254 along the lines of a macro GET_NEXT_SYMBOL, which could have
255 different definitions for COFF and a.out, rather than trying to put
256 the necessary changes throughout all the code in dbxread.c that
257 currently assumes BSD format.
258
259 Please avoid duplicating code. For example, in GDB 3.x all the stuff
260 in infptrace.c was duplicated in *-dep.c, and so changing something
261 was very painful. Thus in GDB 4.x these have all been consolidated
262 into infptrace.c. infptrace.c can deal with variations between
263 systems the same way any system-independent file would (hooks, #if
264 defined, etc.), and machines which are radically different don't need
265 to use infptrace.c at all. The same was true of core_file_command
266 and exec_file_command.
267
268 About debugging gdb with itself...
269
270 You probably want to do a "make TAGS" after you configure your
271 distribution; this will put the machine dependent routines for your
272 local machine where they will be accessed first by a M-period .
273
274 Also, make sure that you've compiled gdb with your local cc or taken
275 appropriate precautions regarding ansification of include files. See
276 the Makefile for more information.
277
278 When you run gdb in this directory, it will read a ".gdbinit" file that
279 sets up some simple things to make debugging gdb easier. The "info"
280 command, when executed without a subcommand in a gdb being debugged by
281 gdb, will pop you back up to the top level gdb. See .gdbinit for details.
282 \f
283 (this is for editing this file with GNU emacs)
284 Local Variables:
285 mode: text
286 End:
This page took 0.035473 seconds and 4 git commands to generate.