- List of requirements for patches
- GDB Internals documentation
- Creating ChangeLog entries
- Editing configure.ac
- Editing gdbarch.h/gdbarch.c
- Updating GDB's import of gnulib
- Debugging gdbserver on uClinux / Linux with no MMU
- Writing testcases
- Finding Gnats bug entries in the Bugzilla database
- git hash mentioned in Bugzilla or mailing list discussion not found?
- Making admin changes to bugzilla
- Closing obsolete bugs
List of requirements for patches
GDB Internals documentation
GDB has an official InternalsManual.
Jeremy Bennett wrote Howto: Porting the GNU Debugger, which is a good source of information as well. It is primarily aimed at engineers who will port GDB to a new target for the first time, but contains an overview of GDB Internals that is of general interest.
Creating ChangeLog entries
The GCC folks have a tool called mklog to help generate ChangeLogs. This script creates a ChangeLog template for a diff file. Run "mklog diff-file" and the template will be added to the top of the file.
After editing gdb/configure.ac, you need to regenerate gdb/configure, gdb/config.in and gdb/aclocal.m4:
$ pwd /path/to/src/gdb $ aclocal -I gnulib/m4 $ autoconf $ autoheader
You need to use the correct versions of aclocal, autoconf and autoheader. The correct version is the one mentioned at the beginning of gdb/aclocal.m4 and gdb/configure.
- Don't include the changes to these generated files in your patch when you post it to the mailing list. These files are big and unnecessary for code review.
Don't. These are generated files. Edit gdbarch.sh instead, and then run it.
Updating GDB's import of gnulib
GDB now imports various modules from the gnulib project, located in gdb/gnulib. This import is used when building both GDB and GDBserver.
To facilitate the update of our import, a script called update-gnulib.sh has been created to automate the process. To run this script:
% cd /path/to/gdb-sources/gdb/gnulib % ./update-gnulib.sh /path/to/gnulib-git-repository
When run without change, the new import should be identical to the previous one. This is actually a good test to perform before making any update to our import, to make sure that everything is correctly setup.
The script maintains the two key pieces of information from which the import is created as constants defined inside the script:
GNULIB_COMMIT_SHA1 - which commit from the gnulib respository is to be used for the import;
IMPORTED_GNULIB_MODULES - which modules to import from gnulib.
When updating the import, please only modify one element at a time. For instance, if you want to import a new module only defined in a later version of gnulib, please first update the import to use the newer commit as a first patch, and then update the import to include the new module as a second patch.
Debugging gdbserver on uClinux / Linux with no MMU
GDB has issues with breakpoints set in gdbserver on !MMU targets. Ulrich Weigand has a tip to make it work:
Gdbserver uses a direct call to the Linux "clone" system call at startup, and for some reason GDB gets really confused by this. When I want to debug gdbserver, I generally simply comment out the call to linux_test_for_tracefork in linux-nat.c:initialize_low to avoid this.
Finding Gnats bug entries in the Bugzilla database
If you ever had to find an old bug in the Bugzilla database, you probably stumbled upon this situation. There are some old entries from the now-retired Gnats database, which can be found by:
Adding 7105 to the Gnats bug number;
Search for "Converted from Gnats NNN", where NNN is the Gnats bug number.
Use "gdb 123" Location with Mozilla bookmark keyword "gdb", URL "http://localhost/~user/cgi-bin/buggdb.php?id=%s" and install this file as "~/public_html/cgi-bin/buggdb.php".
git hash mentioned in Bugzilla or mailing list discussion not found?
GDB used CVS as its main CSV up until October 2013, when it moved to git. The current git repository shares no ancestry with the old git mirror. The old git mirror is still available. See GitMirrors.
Making admin changes to bugzilla
Sometimes there's a need to add a new component, or make other admin changes to gdb's bugzilla. Send requests to firstname.lastname@example.org. Even gdb admins are not allowed admin access to this website (and those that have it work for Red Hat). Feel free to discuss requested changes on email@example.com, but to put them into effect you have to talk to The Powers That Be.
You can also try #overseers on irc.freenode.net, but email is the official way.
Closing obsolete bugs
Bugzilla is (at least as of this writing) full of lots of old bugs that have too low a priority relative to everything else to put any time into. To improve the S/N ratio of bugs we do care about it's best to just close these old bugs out. The way to do this is to close them as RESOLVED/OBSOLETE. An example of this is here: https://sourceware.org/bugzilla/show_bug.cgi?id=8769
As for what the rules are that defines whether a bug falls into this category, good question.
Obviously build problems for gdb versions older than, say, 7.0, is pretty safe.
If possible (and relatively easy) you could try to reproduce the bug in git head, and if not reproducible, and if the gdb version in the bug report is older than 7.0, then the author thinks it's safe to close these out too.
Feel free to add comments to any PR asking whether the bug is old enough to close out. If such a question goes unanswered for a year, and the gdb version in the bug is older than, say, 7.0, then the author thinks it's safe to close these out too. A year may seem like a long time, but relative to how old some of the bugs are that need to be cleaned out, it's amply conservative and still useful.
The author thinks we could be slightly more aggressive with closing some of the older bugs. The above is intended to be a start.