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