]>
Commit | Line | Data |
---|---|---|
fbda4193 JG |
1 | README for gdb-4.3 release |
2 | John Gilmore 7 Dec 1991 | |
c45c19f8 | 3 | |
846058ed | 4 | This is GDB, the GNU source-level debugger, presently running under un*x. |
c45c19f8 JG |
5 | A summary of features new since gdb-3.5 is in the file `WHATS.NEW'. |
6 | ||
bd5635a1 | 7 | |
846058ed JG |
8 | Unpacking and Installation -- quick overview |
9 | ========================== | |
bd5635a1 | 10 | |
fbda4193 JG |
11 | In this release, the GDB debugger sources, the generic GNU include |
12 | files, the BFD ("binary file description") library, the readline library, | |
13 | and a miscellaneous library all have directories of their own underneath | |
14 | the gdb-4.3 directory. The idea is that a variety of GNU tools can | |
15 | share a common copy of these things. Configuration scripts and | |
16 | makefiles exist to cruise up and down this directory tree and | |
17 | automatically build all the pieces in the right order. | |
bd5635a1 | 18 | |
fbda4193 JG |
19 | When you unpack the gdb-4.3.tar.Z file, you'll get a directory called |
20 | `gdb-4.3', which contains: | |
bd5635a1 | 21 | |
fbda4193 JG |
22 | Makefile.in config/ gdb/ texinfo/ |
23 | README config.sub* include/ | |
24 | README.configure configure* libiberty/ | |
25 | bfd/ configure.in readline/ | |
170d0c85 | 26 | |
846058ed | 27 | To build GDB, you can just do: |
170d0c85 | 28 | |
fbda4193 JG |
29 | cd gdb-4.3 |
30 | ./configure HOSTTYPE (e.g. sun4, decstation) | |
170d0c85 | 31 | make |
846058ed | 32 | cp gdb/gdb /usr/local/bin/gdb (or wherever you want) |
170d0c85 | 33 | |
846058ed | 34 | This will configure and build all the libraries as well as GDB. |
c45c19f8 JG |
35 | If you get compiler warnings during this stage, see the `Reporting Bugs' |
36 | section below; there are a few known problems. | |
361cc81a | 37 | |
c45c19f8 | 38 | GDB can be used as a cross-debugger, running on a machine of one type |
846058ed JG |
39 | while debugging a program running on a machine of another type. See below. |
40 | ||
41 | ||
42 | More Documentation | |
43 | ================== | |
44 | ||
fbda4193 JG |
45 | The GDB 4.3 release includes an already-formatted reference card, |
46 | ready for printing on a PostScript printer, as | |
47 | `gdb-4.3/gdb/refcard.ps'. It uses the most common PostScript fonts: | |
48 | the Times family, Courier, and Symbol. If you have a PostScript | |
49 | printer, you can print the reference card by just sending `refcard.ps' | |
50 | to the printer. | |
846058ed | 51 | |
fbda4193 JG |
52 | The release also includes the online Info version of this manual |
53 | already formatted: the main Info file is `gdb-4.3/gdb/gdb.info', and it | |
54 | refers to subordinate files matching `gdb.info*' in the same directory. | |
846058ed | 55 | |
fbda4193 JG |
56 | If you want to make these Info files yourself from the GDB manual's |
57 | source, you need the GNU `makeinfo' program. Once you have it, you | |
58 | can type | |
846058ed | 59 | |
fbda4193 | 60 | cd gdb-4.3/gdb |
846058ed JG |
61 | make gdb.info |
62 | ||
63 | to make the Info file. | |
64 | ||
fbda4193 | 65 | If you want to format and print copies of the manual, you need |
846058ed JG |
66 | several things: |
67 | ||
68 | * TeX, the public domain typesetting program written by Donald | |
69 | Knuth, must be installed on your system and available through | |
70 | your execution path. | |
71 | ||
fbda4193 | 72 | * `gdb-4.3/texinfo': TeX macros defining the GNU Documentation |
846058ed JG |
73 | Format. |
74 | ||
fbda4193 JG |
75 | * *A DVI output program.* TeX does not actually make marks on |
76 | paper; it produces output files called DVI files. If your system | |
77 | has TeX installed, chances are it has a program for printing out | |
78 | these files; one popular example is `dvips', which can print DVI | |
79 | files on PostScript printers. | |
846058ed JG |
80 | |
81 | Once you have these things, you can type | |
170d0c85 | 82 | |
fbda4193 | 83 | cd gdb-4.3/gdb |
846058ed | 84 | make gdb.dvi |
170d0c85 | 85 | |
846058ed JG |
86 | to format the text of this manual, and print it with the usual output |
87 | method for TeX DVI files at your site. | |
bd5635a1 | 88 | |
fbda4193 JG |
89 | If you want to print the reference card, but do not have a |
90 | PostScript printer, or you want to use Computer Modern fonts instead, | |
91 | you can still print it if you have TeX. Format the reference card by | |
92 | typing | |
bd5635a1 | 93 | |
fbda4193 | 94 | cd gdb-4.3/gdb |
846058ed | 95 | make refcard.dvi |
c45c19f8 | 96 | |
846058ed | 97 | The GDB reference card is designed to print in landscape mode on US |
fbda4193 JG |
98 | "letter" size paper; that is, on a sheet 11 inches wide by 8.5 inches |
99 | high. You will need to specify this form of printing as an option to | |
100 | your DVI output program. | |
c45c19f8 JG |
101 | |
102 | ||
846058ed JG |
103 | Installing GDB |
104 | ============== | |
c45c19f8 | 105 | |
846058ed JG |
106 | GDB comes with a `configure' script that automates the process of |
107 | preparing GDB for installation; you can then use `make' to build the | |
108 | `gdb' program. | |
c45c19f8 | 109 | |
846058ed | 110 | The gdb distribution includes all the source code you need for gdb |
fbda4193 | 111 | in a single directory `gdb-4.3'. That directory in turn contains: |
c45c19f8 | 112 | |
fbda4193 JG |
113 | `gdb-4.3/configure (and supporting files)' |
114 | script for configuring GDB and all its supporting libraries. | |
c45c19f8 | 115 | |
fbda4193 | 116 | `gdb-4.3/gdb' |
c45c19f8 JG |
117 | the source specific to GDB itself |
118 | ||
fbda4193 | 119 | `gdb-4.3/bfd' |
c45c19f8 JG |
120 | source for the Binary File Descriptor Library |
121 | ||
fbda4193 | 122 | `gdb-4.3/include' |
c45c19f8 JG |
123 | GNU include files |
124 | ||
fbda4193 | 125 | `gdb-4.3/libiberty' |
c45c19f8 JG |
126 | source for the `-liberty' free software library |
127 | ||
fbda4193 | 128 | `gdb-4.3/readline' |
c45c19f8 JG |
129 | source for the GNU command-line interface |
130 | ||
fbda4193 JG |
131 | It is most convenient to run `configure' from the `gdb-4.3' directory. |
132 | The simplest way to configure and build GDB is the following: | |
c45c19f8 | 133 | |
fbda4193 | 134 | cd gdb-4.3 |
c45c19f8 JG |
135 | ./configure HOST |
136 | make | |
137 | ||
846058ed JG |
138 | where HOST is something like `sun4' or `decstation', that identifies |
139 | the platform where GDB will run. This builds the three libraries | |
fbda4193 JG |
140 | `bfd', `readline', and `libiberty', then `gdb' itself. The configured |
141 | source files, and the binaries, are left in the corresponding source | |
142 | directories. | |
143 | ||
144 | `configure' is a Bourne-shell (`/bin/sh') script; if your system | |
145 | does not recognize this automatically when you run a different shell, | |
146 | you may need to run `sh' on it explicitly: `sh configure HOST'. | |
147 | ||
148 | You can *run* the `configure' script from any of the subordinate | |
149 | directories in the GDB distribution (if you only want to configure | |
150 | that subdirectory); but be sure to specify a path to it. For example, | |
151 | to configure only the `bfd' subdirectory, | |
152 | ||
153 | cd gdb-4.3/bfd | |
154 | ../configure HOST | |
155 | ||
156 | You can install `gdb' anywhere; it has no hardwired paths. Simply | |
157 | copy `gdb/gdb' to the desired directory. | |
c45c19f8 | 158 | |
fbda4193 | 159 | However, you should make sure that the shell on your path (named by |
c45c19f8 JG |
160 | the `SHELL' environment variable) is publicly readable; some systems |
161 | refuse to let GDB debug child processes whose programs are not | |
162 | readable, and GDB uses the shell to start your program. | |
163 | ||
fbda4193 | 164 | |
846058ed JG |
165 | Configuration Subdirectories |
166 | ============================ | |
167 | ||
fbda4193 JG |
168 | If you want to run GDB versions for several host or target machines, |
169 | you'll need a different gdb compiled for each combination of host and | |
170 | target. `configure' is designed to make this easy by allowing you to | |
171 | generate each configuration in a separate subdirectory. If your | |
172 | `make' program handles the `VPATH' feature (GNU `make' does), running | |
173 | `make' in each of these directories then builds the gdb program | |
174 | specified there. | |
846058ed JG |
175 | |
176 | `configure' creates these subdirectories for you when you | |
fbda4193 | 177 | simultaneously specify several configurations; but it is a good habit |
846058ed | 178 | even for a single configuration. You can specify the use of |
fbda4193 JG |
179 | subdirectories using the `+subdirs' option (abbreviated `+sub'). For |
180 | example, you can build GDB this way on a Sun 4 as follows: | |
846058ed | 181 | |
fbda4193 | 182 | cd gdb-4.3 |
846058ed | 183 | ./configure +sub sun4 |
fbda4193 | 184 | cd H-sun4/T-sun4 |
c45c19f8 JG |
185 | make |
186 | ||
187 | When `configure' uses subdirectories to build programs or | |
fbda4193 | 188 | libraries, it creates nested directories `H-HOST/T-TARGET'. |
846058ed | 189 | `configure' uses these two directory levels because GDB can be |
fbda4193 JG |
190 | configured for cross-compiling: GDB can run on one machine (the host) |
191 | while debugging programs that run on another machine (the target). | |
192 | You specify cross-debugging targets by giving the `+target=TARGET' | |
193 | option to `configure'. Specifying only hosts still gives you two | |
194 | levels of subdirectory for each host, with the same configuration | |
195 | suffix on both; that is, if you give any number of hosts but no | |
196 | targets, GDB will be configured for native debugging on each host. On | |
197 | the other hand, whenever you specify both hosts and targets on the | |
198 | same command line, `configure' creates all combinations of the hosts | |
199 | and targets you list. | |
200 | ||
201 | If you run `configure' from a directory (notably, `gdb-4.3') that | |
c45c19f8 | 202 | contains source directories for multiple libraries or programs, |
fbda4193 JG |
203 | `configure' creates the `H-HOST/T-TARGET' subdirectories in each |
204 | library or program's source directory. For example, typing: | |
c45c19f8 | 205 | |
fbda4193 | 206 | cd gdb-4.3 |
846058ed | 207 | configure sun4 +target=vxworks960 |
c45c19f8 JG |
208 | |
209 | creates the following directories: | |
210 | ||
fbda4193 JG |
211 | gdb-4.3/H-sun4/T-vxworks960 |
212 | gdb-4.3/bfd/H-sun4/T-vxworks960 | |
213 | gdb-4.3/gdb/H-sun4/T-vxworks960 | |
214 | gdb-4.3/libiberty/H-sun4/T-vxworks960 | |
215 | gdb-4.3/readline/H-sun4/T-vxworks960 | |
846058ed | 216 | |
fbda4193 JG |
217 | When you run `make' to build a program or library, you must run it |
218 | in a configured directory. If you made a single configuration, | |
219 | without subdirectories, run `make' in the source directory. If you | |
220 | have `H-HOST/T-TARGET' subdirectories, run `make' in those | |
221 | subdirectories. | |
846058ed | 222 | |
fbda4193 JG |
223 | The `Makefile' generated by `configure' for each source directory |
224 | runs recursively, so that typing `make' in `gdb-4.3' (or in a | |
225 | `gdb-4.3/H-HOST/T-TARGET' subdirectory) builds all the required | |
226 | libraries, then GDB. | |
c45c19f8 JG |
227 | |
228 | When you have multiple hosts or targets configured, you can run | |
229 | `make' on them in parallel (for example, if they are NFS-mounted on | |
230 | each of the hosts); they will not interfere with each other. | |
231 | ||
fbda4193 JG |
232 | You can also use the `+objdir=ALTROOT' option to have the |
233 | configured files placed in a parallel directory structure rather than | |
234 | alongside the source files; *note configure Options::.. | |
235 | ||
236 | ||
846058ed JG |
237 | Specifying Names for Hosts and Targets |
238 | ====================================== | |
239 | ||
240 | The specifications used for hosts and targets in the `configure' | |
241 | script are based on a three-part naming scheme, but some short | |
fbda4193 JG |
242 | predefined aliases are also supported. The full naming scheme encodes |
243 | three pieces of information in the following pattern: | |
846058ed JG |
244 | |
245 | ARCHITECTURE-VENDOR-OS | |
246 | ||
247 | For example, you can use the alias `sun4' as a HOST argument or in | |
fbda4193 JG |
248 | a `+target=TARGET' option, but the equivalent full name is |
249 | `sparc-sun-sunos4'. | |
846058ed JG |
250 | |
251 | The following table shows all the architectures, hosts, and OS | |
fbda4193 JG |
252 | prefixes that `configure' recognizes in GDB 4.3. Entries in the "OS |
253 | prefix" column ending in a `*' may be followed by a release number. | |
254 | ||
255 | ||
256 | ARCHITECTURE VENDOR OS prefix | |
257 | ------------+--------------------------+--------------------------- | |
258 | | | | |
259 | 580 | altos hp | aix* msdos* | |
260 | a29k | amd ibm | amigados newsos* | |
261 | alliant | amdahl intel | aout nindy* | |
262 | arm | aout isi | bout osf* | |
263 | c1 | apollo little | bsd* sco* | |
264 | c2 | att mips | coff sunos* | |
265 | cray2 | bcs motorola | ctix* svr4 | |
266 | h8300 | bout ncr | dgux* sym* | |
267 | i386 | bull next | dynix* sysv* | |
268 | i860 | cbm nyu | ebmon ultrix* | |
269 | i960 | coff sco | esix* unicos* | |
270 | m68000 | convergent sequent | hds unos* | |
271 | m68k | convex sgi | hpux* uts | |
272 | m88k | cray sony | irix* v88r* | |
273 | mips | dec sun | isc* vms* | |
274 | ns32k | encore unicom | kern vxworks* | |
275 | pyramid | gould utek | mach* | |
276 | romp | hitachi wrs | | |
277 | rs6000 | | | |
278 | sparc | | | |
279 | tahoe | | | |
280 | tron | | | |
281 | vax | | | |
282 | xmp | | | |
283 | ymp | | | |
284 | ||
285 | *Warning:* `configure' can represent a very large number of | |
286 | combinations of architecture, vendor, and OS. There is by no | |
287 | means support available for all possible combinations! | |
288 | ||
289 | The `configure' script accompanying GDB 4.3 does not provide any | |
290 | query facility to list all supported host and target names or aliases. | |
291 | `configure' calls the Bourne shell script `config.sub' to map | |
292 | abbreviations to full names; you can read the script, if you wish, or | |
293 | you can use it to test your guesses on abbreviations--for example: | |
846058ed JG |
294 | |
295 | % sh config.sub sun4 | |
296 | sparc-sun-sunos4 | |
297 | % sh config.sub sun3 | |
298 | m68k-sun-sunos4 | |
299 | % sh config.sub decstation | |
300 | mips-dec-ultrix | |
301 | % sh config.sub hp300bsd | |
302 | m68k-hp-bsd | |
303 | % sh config.sub i386v | |
304 | i386-none-sysv | |
305 | % sh config.sub i486v | |
fbda4193 JG |
306 | *** Configuration "i486v" not recognized |
307 | ||
308 | `config.sub' is also distributed in the directory `gdb-4.3'. | |
309 | ||
846058ed JG |
310 | |
311 | `configure' Options | |
312 | =================== | |
c45c19f8 | 313 | |
fbda4193 JG |
314 | Here is a summary of all the `configure' options and arguments that |
315 | you might use for building GDB: | |
c45c19f8 | 316 | |
fbda4193 JG |
317 | configure [+destdir=DIR] [+subdirs] |
318 | [+objdir=ALTROOT] [+norecursion] [+rm] | |
846058ed | 319 | [+target=TARGET...] HOST... |
c45c19f8 JG |
320 | |
321 | You may introduce options with the character `-' rather than `+' if | |
846058ed | 322 | you prefer; but you may abbreviate option names if you use `+'. |
c45c19f8 JG |
323 | |
324 | `+destdir=DIR' | |
325 | DIR is an installation directory *path prefix*. After you | |
326 | configure with this option, `make install' will install GDB as | |
327 | `DIR/bin/gdb', and the libraries in `DIR/lib'. If you specify | |
c45c19f8 JG |
328 | `+destdir=/usr/local', for example, `make install' creates |
329 | `/usr/local/bin/gdb'. | |
330 | ||
846058ed | 331 | `+subdirs' |
c45c19f8 JG |
332 | Write configuration specific files in subdirectories of the form |
333 | ||
fbda4193 | 334 | H-HOST/T-TARGET |
c45c19f8 | 335 | |
fbda4193 JG |
336 | (and configure the `Makefile' to generate object code in |
337 | subdirectories of this form as well). Without this option, if you | |
338 | specify only one configuration for GDB, `configure' will use the | |
339 | same directory for source, configured files, and binaries. This | |
340 | option is used automatically if you specify more than one HOST or | |
341 | more than one `+target=TARGET' option on the `configure' command | |
342 | line. | |
c45c19f8 | 343 | |
fbda4193 JG |
344 | `+norecursion' |
345 | Configure only the directory where `configure' is executed; do not | |
346 | propagate configuration to subdirectories. | |
347 | ||
348 | `+objdir=ALTROOT' | |
349 | ALTROOT is an alternative directory used as the root for | |
350 | configured files. `configure' will create directories under | |
351 | ALTROOT in parallel to the source directories. If you use | |
352 | `+objdir=ALTROOT' with `+subdirs', `configure' also builds the | |
353 | `H-HOST/T-TARGET' subdirectories in the directory tree rooted in | |
354 | ALTROOT. | |
c45c19f8 JG |
355 | |
356 | `+rm' | |
846058ed | 357 | Remove the configuration that the other arguments specify. |
c45c19f8 | 358 | |
846058ed | 359 | `+target=TARGET ...' |
c45c19f8 | 360 | Configure GDB for cross-debugging programs running on each |
846058ed JG |
361 | specified TARGET. You may specify as many `+target' options as |
362 | you wish. Without this option, GDB is configured to debug | |
363 | programs that run on the same machine (HOST) as GDB itself. | |
364 | ||
365 | There is no convenient way to generate a list of all available | |
366 | targets. | |
c45c19f8 JG |
367 | |
368 | `HOST ...' | |
369 | Configure GDB to run on each specified HOST. You may specify as | |
846058ed JG |
370 | many host names as you wish. |
371 | ||
372 | There is no convenient way to generate a list of all available | |
373 | hosts. | |
c45c19f8 JG |
374 | |
375 | `configure' accepts other options, for compatibility with configuring | |
376 | other GNU tools recursively; but these are the only options that | |
377 | affect GDB or its supporting libraries. | |
bd5635a1 | 378 | |
bd5635a1 | 379 | |
c45c19f8 | 380 | Languages other than C |
bd5635a1 | 381 | |
fbda4193 JG |
382 | C++ support has been integrated into gdb. Partial Modula-2 support is |
383 | now in GDB. GDB should work with FORTRAN programs. (If you have | |
384 | problems, please send a bug report; you may have to refer to some | |
385 | FORTRAN variables with a trailing underscore). I am not aware of | |
386 | anyone who is working on getting gdb to use the syntax of any other | |
387 | language. Pascal programs which use sets, subranges, file variables, | |
388 | or nested functions will not currently work. | |
bd5635a1 | 389 | |
bd5635a1 | 390 | |
c45c19f8 | 391 | Kernel debugging |
bd5635a1 | 392 | |
c45c19f8 JG |
393 | I have't done this myself so I can't really offer any advice. |
394 | Remote debugging over serial lines works fine, but the kernel debugging | |
395 | code in here has not been tested in years. Van Jacobson claims to have | |
396 | better kernel debugging, but won't release it for ordinary mortals. | |
bd5635a1 | 397 | |
bd5635a1 | 398 | |
c45c19f8 | 399 | Remote debugging |
bd5635a1 | 400 | |
361cc81a JG |
401 | The files m68k-stub.c and i386-stub.c contain two examples of remote |
402 | stubs to be used with remote.c. They are designeded to run standalone | |
403 | on a 68k or 386 cpu and communicate properly with the remote.c stub | |
404 | over a serial line. | |
405 | ||
170d0c85 RP |
406 | The file rem-multi.shar contains a general stub that can probably |
407 | run on various different flavors of unix to allow debugging over a | |
361cc81a | 408 | serial line from one machine to another. |
bd5635a1 | 409 | |
fbda4193 JG |
410 | Some working remote interfaces for talking to existing ROM monitors |
411 | are: | |
412 | remote-eb.c AMD 29000 "EBMON" | |
413 | remote-nindy.c Intel 960 "Nindy" | |
414 | remote-adapt.c AMD 29000 "Adapt" | |
415 | remote-mm.c AMD 29000 "minimon" | |
170d0c85 RP |
416 | |
417 | Remote-vx.c and the vx-share subdirectory contain a remote interface for the | |
418 | VxWorks realtime kernel, which communicates over TCP using the Sun | |
419 | RPC library. This would be a useful starting point for other remote- | |
420 | via-ethernet back ends. | |
bd5635a1 | 421 | |
c45c19f8 JG |
422 | |
423 | Reporting Bugs | |
424 | ||
425 | The correct address for reporting bugs found in gdb is | |
bd5635a1 | 426 | "[email protected]". Please email all bugs to that address. |
fbda4193 JG |
427 | Please include the GDB version number (e.g. gdb-4.3), and how |
428 | you configured it (e.g. "sun4" or "mach386 host, i586-intel-synopsys | |
429 | target"). | |
430 | ||
431 | A known bug: | |
432 | ||
433 | * If you run with a watchpoint enabled, breakpoints will become | |
434 | erratic and might not stop the program. Disabling or deleting the | |
435 | watchpoint will fix the problem. | |
bd5635a1 | 436 | |
846058ed JG |
437 | GDB can produce warnings about symbols that it does not understand. By |
438 | default, these warnings are disabled. You can enable them by executing | |
439 | `set complaint 10' (which you can put in your ~/.gdbinit if you like). | |
440 | I recommend doing this if you are working on a compiler, assembler, | |
441 | linker, or gdb, since it will point out problems that you may be able | |
442 | to fix. Warnings produced during symbol reading indicate some mismatch | |
fbda4193 | 443 | between the object file and GDB's symbol reading code. In many cases, |
846058ed | 444 | it's a mismatch between the specs for the object file format, and what |
fbda4193 | 445 | the compiler actually outputs or the debugger actually understands. |
c45c19f8 | 446 | |
fbda4193 JG |
447 | If you port gdb to a new machine, please send the required changes to |
448 | [email protected]. There's lots of information about doing your | |
449 | own port in the file gdb-4.3/gdb/doc/gdbint.texinfo, which you can | |
450 | print out, or read with `info' (see the Makefile.in there). If your | |
451 | changes are more than a few lines, obtain and send in a copyright | |
452 | assignment from [email protected], as described in the section | |
453 | `Writing Code for GDB'. | |
c45c19f8 JG |
454 | |
455 | ||
456 | X Windows versus GDB | |
bd5635a1 | 457 | |
361cc81a | 458 | xgdb is obsolete. We are not doing any development or support of it. |
bd5635a1 | 459 | |
c45c19f8 JG |
460 | There is an "xxgdb", which shows more promise, which was posted to |
461 | comp.sources.x. | |
bd5635a1 RP |
462 | |
463 | For those intersted in auto display of source and the availability of | |
464 | an editor while debugging I suggest trying gdb-mode in gnu-emacs | |
465 | (Try typing M-x gdb RETURN). Comments on this mode are welcome. | |
466 | ||
c45c19f8 | 467 | |
c45c19f8 | 468 | Writing Code for GDB |
bd5635a1 RP |
469 | |
470 | We appreciate having users contribute code that is of general use, but | |
471 | for it to be included in future GDB releases it must be cleanly | |
472 | written. We do not want to include changes that will needlessly make | |
473 | future maintainance difficult. It is not much harder to do things | |
474 | right, and in the long term it is worth it to the GNU project, and | |
475 | probably to you individually as well. | |
476 | ||
bd5635a1 RP |
477 | If you make substantial changes, you'll have to file a copyright |
478 | assignment with the Free Software Foundation before we can produce a | |
479 | release that includes your changes. Send mail requesting the copyright | |
480 | assignment to [email protected]. Do this early, like before the | |
481 | changes actually work, or even before you start them, because a manager | |
482 | or lawyer on your end will probably make this a slow process. | |
483 | ||
fbda4193 JG |
484 | Please code according to the GNU coding standards. If you do not have |
485 | a copy, you can request one by sending mail to [email protected]. | |
486 | ||
bd5635a1 RP |
487 | Please try to avoid making machine-specific changes to |
488 | machine-independent files. If this is unavoidable, put a hook in the | |
489 | machine-independent file which calls a (possibly) machine-dependent | |
490 | macro (for example, the IGNORE_SYMBOL macro can be used for any | |
491 | symbols which need to be ignored on a specific machine. Calling | |
492 | IGNORE_SYMBOL in dbxread.c is a lot cleaner than a maze of #if | |
493 | defined's). The machine-independent code should do whatever "most" | |
494 | machines want if the macro is not defined in param.h. Using #if | |
361cc81a | 495 | defined can sometimes be OK (e.g. SET_STACK_LIMIT_HUGE) but should be |
bd5635a1 RP |
496 | conditionalized on a specific feature of an operating system (set in |
497 | tm.h or xm.h) rather than something like #if defined(vax) or #if | |
498 | defined(SYSV). If you use an #ifdef on some symbol that is defined | |
499 | in a header file (e.g. #ifdef TIOCSETP), *please* make sure that you | |
500 | have #include'd the relevant header file in that module! | |
501 | ||
502 | It is better to replace entire routines which may be system-specific, | |
503 | rather than put in a whole bunch of hooks which are probably not going | |
504 | to be helpful for any purpose other than your changes. For example, | |
505 | if you want to modify dbxread.c to deal with DBX debugging symbols | |
506 | which are in COFF files rather than BSD a.out files, do something | |
507 | along the lines of a macro GET_NEXT_SYMBOL, which could have | |
508 | different definitions for COFF and a.out, rather than trying to put | |
509 | the necessary changes throughout all the code in dbxread.c that | |
510 | currently assumes BSD format. | |
511 | ||
fbda4193 JG |
512 | When generalizing GDB along a particular interface, please use an |
513 | attribute-struct rather than inserting tests or switch statements | |
514 | everywhere. For example, GDB has been generalized to handle multiple | |
515 | kinds of remote interfaces -- not by #ifdef's everywhere, but by | |
516 | defining the "target_ops" structure and having a current target (as | |
517 | well as a stack of targets below it, for memory references). Whenever | |
518 | something needs to be done that depends on which remote interface we | |
519 | are using, a flag in the current target_ops structure is tested (e.g. | |
520 | `target_has_stack'), or a function is called through a pointer in the | |
521 | current target_ops structure. In this way, when a new remote interface | |
522 | is added, only one module needs to be touched -- the one that actually | |
523 | implements the new remote interface. Other examples of | |
524 | attribute-structs are BFD access to multiple kinds of object file | |
525 | formats, or GDB's access to multiple source languages. | |
526 | ||
bd5635a1 RP |
527 | Please avoid duplicating code. For example, in GDB 3.x all the stuff |
528 | in infptrace.c was duplicated in *-dep.c, and so changing something | |
c45c19f8 | 529 | was very painful. In GDB 4.x, these have all been consolidated |
bd5635a1 RP |
530 | into infptrace.c. infptrace.c can deal with variations between |
531 | systems the same way any system-independent file would (hooks, #if | |
532 | defined, etc.), and machines which are radically different don't need | |
533 | to use infptrace.c at all. The same was true of core_file_command | |
534 | and exec_file_command. | |
535 | ||
bd5635a1 | 536 | |
c45c19f8 | 537 | Debugging gdb with itself |
bd5635a1 | 538 | |
c45c19f8 JG |
539 | If gdb is limping on your machine, this is the preferred way to get it |
540 | fully functional. Be warned that in some ancient Unix systems, like | |
541 | Ultrix 4.0, a program can't be running in one process while it is being | |
542 | debugged in another. Rather than doing "./gdb ./gdb", which works on | |
543 | Suns and such, you can copy gdb to gdb2 and then do "./gdb ./gdb2". | |
bd5635a1 | 544 | |
fbda4193 JG |
545 | When you run gdb in the gdb source directory, it will read a ".gdbinit" |
546 | file that sets up some simple things to make debugging gdb easier. The | |
547 | "info" command, when executed without a subcommand in a gdb being | |
548 | debugged by gdb, will pop you back up to the top level gdb. See | |
549 | .gdbinit for details. | |
c45c19f8 | 550 | |
846058ed JG |
551 | I strongly recommend printing out the reference card and using it. |
552 | Send reference-card suggestions to [email protected], just like bugs. | |
553 | ||
c45c19f8 JG |
554 | If you use emacs, you will probably want to do a "make TAGS" after you |
555 | configure your distribution; this will put the machine dependent | |
556 | routines for your local machine where they will be accessed first by a | |
557 | M-period. | |
558 | ||
fbda4193 JG |
559 | Also, make sure that you've either compiled gdb with your local cc, or |
560 | have run `fixincludes' if you are compiling with gcc. | |
bd5635a1 RP |
561 | \f |
562 | (this is for editing this file with GNU emacs) | |
563 | Local Variables: | |
564 | mode: text | |
565 | End: |