Previous: Getting Started, Up: Hints



22.2 Debugging gdb with itself

If gdb is limping on your machine, this is the preferred way to get it fully functional. Be warned that in some ancient Unix systems, like Ultrix 4.2, a program can't be running in one process while it is being debugged in another. Rather than typing the command ./gdb ./gdb, which works on Suns and such, you can copy gdb to gdb2 and then type ./gdb ./gdb2.

When you run gdb in the gdb source directory, it will read a .gdbinit file that sets up some simple things to make debugging gdb easier. The info command, when executed without a subcommand in a gdb being debugged by gdb, will pop you back up to the top level gdb. See .gdbinit for details.

If you use emacs, you will probably want to do a make TAGS after you configure your distribution; this will put the machine dependent routines for your local machine where they will be accessed first by M-.

Also, make sure that you've either compiled gdb with your local cc, or have run fixincludes if you are compiling with gcc.

22.3 Submitting Patches

Thanks for thinking of offering your changes back to the community of gdb users. In general we like to get well designed enhancements. Thanks also for checking in advance about the best way to transfer the changes.

The gdb maintainers will only install “cleanly designed” patches. This manual summarizes what we believe to be clean design for gdb.

If the maintainers don't have time to put the patch in when it arrives, or if there is any question about a patch, it goes into a large queue with everyone else's patches and bug reports.

The legal issue is that to incorporate substantial changes requires a copyright assignment from you and/or your employer, granting ownership of the changes to the Free Software Foundation. You can get the standard documents for doing this by sending mail to gnu@gnu.org and asking for it. We recommend that people write in "All programs owned by the Free Software Foundation" as "NAME OF PROGRAM", so that changes in many programs (not just gdb, but GAS, Emacs, GCC, etc) can be contributed with only one piece of legalese pushed through the bureaucracy and filed with the FSF. We can't start merging changes until this paperwork is received by the FSF (their rules, which we follow since we maintain it for them).

Technically, the easiest way to receive changes is to receive each feature as a small context diff or unidiff, suitable for patch. Each message sent to me should include the changes to C code and header files for a single feature, plus ChangeLog entries for each directory where files were modified, and diffs for any changes needed to the manuals (gdb/doc/gdb.texinfo or gdb/doc/gdbint.texinfo). If there are a lot of changes for a single feature, they can be split down into multiple messages.

In this way, if we read and like the feature, we can add it to the sources with a single patch command, do some testing, and check it in. If you leave out the ChangeLog, we have to write one. If you leave out the doc, we have to puzzle out what needs documenting. Etc., etc.

The reason to send each change in a separate message is that we will not install some of the changes. They'll be returned to you with questions or comments. If we're doing our job correctly, the message back to you will say what you have to fix in order to make the change acceptable. The reason to have separate messages for separate features is so that the acceptable changes can be installed while one or more changes are being reworked. If multiple features are sent in a single message, we tend to not put in the effort to sort out the acceptable changes from the unacceptable, so none of the features get installed until all are acceptable.

If this sounds painful or authoritarian, well, it is. But we get a lot of bug reports and a lot of patches, and many of them don't get installed because we don't have the time to finish the job that the bug reporter or the contributor could have done. Patches that arrive complete, working, and well designed, tend to get installed on the day they arrive. The others go into a queue and get installed as time permits, which, since the maintainers have many demands to meet, may not be for quite some time.

Please send patches directly to the gdb maintainers.

22.4 Build Script

The script gdb_buildall.sh builds gdb with flag --enable-targets=all set. This builds gdb with all supported targets activated. This helps testing gdb when doing changes that affect more than one architecture and is much faster than using gdb_mbuild.sh.

After building gdb the script checks which architectures are supported and then switches the current architecture to each of those to get information about the architecture. The test results are stored in log files in the directory the script was called from.