Go to file
Andrew Burgess e19c0f8fb7 Rewrite (and rename) gdb-libexec-add-index.patch
It has been observed that the changes added by
gdb-libexec-add-index.patch will result in GDB testing hanging when
the tests are being run using an in-tree GDB; that is when using 'make
check'.  One test that is known to fail is gdb.base/with-mf.exp,
though any test that calls the gdb-add-index.sh script will also hang.

The problem is that when the gdb-add-index.sh script is run, the GDB
testsuite passes the GDB command to use within the GDB environment
variable.  For in-tree testing this will be something like:

  GDB="/path/to/gdb -data-directory /path/to/data-directory"

Notice that the environment variable contains both an executable and
an argument.

Our changes to gdb-add-index.sh add this:

  GDB2=/usr/libexec/gdb
  if test -x $GDB2 && ! which $GDB &>/dev/null; then
      GDB=$GDB2
  fi

The problem then is that '-data-directory' is treated as a set of
options to 'which'.  Many of these options are not known to 'which',
but the '-i' option is known.  The documentation of '-i' says:

    --read-alias, -i
        Read aliases from stdin, reporting matching ones on
        stdout. This is useful in combination with using an alias for
        which itself. For example
        alias which=´alias | which -i´.

And here's the problem; this option causes 'which' to read from
stdin.  As the GDB testsuite doesn't send any additional input on
stdin then the which command will never complete, and the test will
hang.

The solution I think is to avoid calling 'which' like this on a user
supplied GDB environment variable.

The changes in the gdb-libexec-add-index.patch were really about what
the _default_ GDB executable should be.  The upstream version of this
script does this:

  GDB=${GDB:=gdb}

That is, the default is just 'gdb'.  However, for RH this is not good
enough.  We want to handle two additional cases, first, when only the
gdb-minimal package is installed, in which case the default should be
/usr/bin/gdb.minimal.  Then we also want to handle the case where the
user doesn't have 'gdb' itself in their $PATH, but does have the 'gdb'
executable installed in /usr/libexec/gdb.

The code as it currently stands also has a problem where, if
gdb.minimal is installed on the machine this will _always_ be used in
preference to the user supplied GDB value (assuming the code worked at
all) this means that when doing in-tree testing we wouldn't actually
be using the in-tree GDB to build the index, which isn't ideal.

So in this commit I propose that we rework our gdb-add-index.sh
changes.  Now, we only use the RH special values in the case that
there is no GDB environment variable set.  I believe this handles all
the required use cases:

  1. When doing in-tree testing GDB environment variable will be set,
  and this will always be used as is, with no special processing,

  2. When gdb-add-index.sh is used and GDB environment variable is not
  set then we will use the first of the following as the default:

    (a) /usr/bin/gdb.minimal if this file exists and is executable,
    (b) The first gdb executable that can be found in the $PATH,
    (c) /usr/libexec/gdb if this file exists and is executable.

While I was changing this patch anyway I've removed the libexec part
of the patch name -- this no longer seemed relevant, I suspect this
related to an older version of this patch.
2023-05-04 15:11:19 +01:00
.fmf init FMF CI gating 2021-08-12 17:12:21 +00:00
plans plans/ci.fmf: fix deprecated fmf plan attribute 2022-12-15 12:42:14 +00:00
tests gdb-testsuite-sanity: Add glibc-debuginfo as a test requirement 2022-02-08 13:00:45 +01:00
.gitignore Rebase to FSF GDB 13.1 2023-03-08 21:42:55 -07:00
README.local-patches.md Rename README.local-patches to README.local-patches.md 2020-02-11 15:34:42 -05:00
_gdb.spec.Patch.include Rewrite (and rename) gdb-libexec-add-index.patch 2023-05-04 15:11:19 +01:00
_gdb.spec.patch.include Backport upstream fix for RHBZ 2192105 2023-05-03 13:32:42 -07:00
_git_upstream_commit Rebase to FSF GDB 13.1 2023-03-08 21:42:55 -07:00
_patch_order Rewrite (and rename) gdb-libexec-add-index.patch 2023-05-04 15:11:19 +01:00
gating.yaml drop unwanted scratch build rule for gating 2021-08-12 17:12:21 +00:00
gdb-6.3-attach-see-vdso-test.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-6.3-gstack-20050411.patch Rebase to FSF GDB 13.1 2023-03-08 21:42:55 -07:00
gdb-6.3-mapping-zero-inode-test.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-6.3-rh-testversion-20041202.patch Set distro name using --with-pkgconfig configure option 2023-03-29 16:30:04 +01:00
gdb-6.5-BEA-testsuite.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch Rebase to FSF GDB 13.1 2023-03-08 21:42:55 -07:00
gdb-6.5-bz218379-ppc-solib-trampoline-test.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-6.5-bz243845-stale-testing-zombie-test.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-6.5-gcore-buffer-limit-test.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-6.5-ia64-libunwind-leak-test.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-6.5-missed-trap-on-step-test.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-6.5-section-num-fixup-test.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-6.5-sharedlibrary-path.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch Rebase to FSF GDB 8.3.50.20190304 (8.4pre). 2019-03-05 11:27:44 -05:00
gdb-6.6-buildid-locate-rpm-librpm-workaround.patch Rebase to FSF GDB 12.1. 2022-05-13 10:30:05 -07:00
gdb-6.6-buildid-locate-rpm.patch Rebase to FSF GDB 13.1 2023-03-08 21:42:55 -07:00
gdb-6.6-buildid-locate-solib-missing-ids.patch Rebase to FSF GDB 13.1 2023-03-08 21:42:55 -07:00
gdb-6.6-buildid-locate.patch Update gdb-6.6-buildid-locate.patch to fix RHBZ 2181221. 2023-03-30 16:20:10 +02:00
gdb-6.6-bz229517-gcore-without-terminal.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-6.6-bz237572-ppc-atomic-sequence-test.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-6.6-testsuite-timeouts.patch Remove need for "FileName:" line on the header of the patches. 2018-06-18 20:10:24 -04:00
gdb-6.7-ppc-clobbered-registers-O2-test.patch Remove need for "FileName:" line on the header of the patches. 2018-06-18 20:10:24 -04:00
gdb-6.7-testsuite-stable-results.patch Rebase to FSF GDB 13.1 2023-03-08 21:42:55 -07:00
gdb-6.8-bz466901-backtrace-full-prelinked.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-add-index.patch Rewrite (and rename) gdb-libexec-add-index.patch 2023-05-04 15:11:19 +01:00
gdb-archer-next-over-throw-cxx-exec.patch Update gdb-6.3-gstack-20050411.patch (Pedro Alves). 2018-12-11 16:37:09 -05:00
gdb-binutils29988-read_indexed_address.patch Backport fix for binutils/29988 2023-04-11 10:32:14 -07:00
gdb-bz634108-solib_address.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-ccache-workaround.patch Rebase to FSF GDB 13.1 2023-03-08 21:42:55 -07:00
gdb-container-rh-pkg.patch Rebase to FSF GDB 13.1 2023-03-08 21:42:55 -07:00
gdb-core-open-vdso-warning.patch Rebase to FSF GDB 13.1 2023-03-08 21:42:55 -07:00
gdb-fedora-libncursesw.patch Rebase to FSF GDB 13.1 2023-03-08 21:42:55 -07:00
gdb-gcc-13-backport-self-move-diagnostic-fix Fixes to get GDB to build again with GCC 13 and Python 3.12 2023-01-20 17:14:37 -07:00
gdb-glibc-strstr-workaround.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-gstack.man - ia64 build fixes from Doug Chapman (BZ 428882). 2008-02-20 09:43:35 +00:00
gdb-lineno-makeup-test.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-linux_perf-bundle.patch Rebase to FSF GDB 13.1 2023-03-08 21:42:55 -07:00
gdb-orphanripper.c [testsuite] [RHEL-5] Fix gdb-orphanripper.c runtime error. 2013-05-06 17:30:58 +02:00
gdb-ppc-power7-test.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch Remove need for "FileName:" line on the header of the patches. 2018-06-18 20:10:24 -04:00
gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch Remove need for "FileName:" line on the header of the patches. 2018-06-18 20:10:24 -04:00
gdb-rhbz1007614-memleak-infpy_read_memory-test.patch Remove need for "FileName:" line on the header of the patches. 2018-06-18 20:10:24 -04:00
gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch Remove need for "FileName:" line on the header of the patches. 2018-06-18 20:10:24 -04:00
gdb-rhbz1149205-catch-syscall-after-fork-test.patch Remove need for "FileName:" line on the header of the patches. 2018-06-18 20:10:24 -04:00
gdb-rhbz1156192-recursive-dlopen-test.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch Remove need for "FileName:" line on the header of the patches. 2018-06-18 20:10:24 -04:00
gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-rhbz1553104-s390x-arch12-test.patch Remove need for "FileName:" line on the header of the patches. 2018-06-18 20:10:24 -04:00
gdb-rhbz2042664-fix-sect_index_data-internal-error Fix "sect_index_data not initialized" internal error. (RHBZ 2042664, 2022-02-01 13:14:01 -07:00
gdb-rhbz2177655-aarch64-pauth-valid-regcache.patch Backport fix for RHBZ 2177655. (Luis Machado) 2023-03-24 19:22:09 -04:00
gdb-rhbz2183595-rustc-inside_main.patch Backport "Fix crash in inside_main_func" 2023-03-31 13:14:15 -07:00
gdb-rhbz2192105-ftbs-dangling-pointer Backport upstream fix for RHBZ 2192105 2023-05-03 13:32:42 -07:00
gdb-rhel5.9-testcase-xlf-var-inside-mod.patch Remove need for "FileName:" line on the header of the patches. 2018-06-18 20:10:24 -04:00
gdb-simultaneous-step-resume-breakpoint-test.patch Remove need for "FileName:" line on the header of the patches. 2018-06-18 20:10:24 -04:00
gdb-test-bt-cfi-without-die.patch Remove need for "FileName:" line on the header of the patches. 2018-06-18 20:10:24 -04:00
gdb-test-dw2-aranges.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-test-pid0-core.patch - Don't check for stgit unless needed w/generate-git-repo-from-patches.sh. 2021-03-26 11:40:18 -07:00
gdb-testsuite-readline63-sigint-revert.patch [testsuite] Fix several false FAILs. 2016-04-08 17:32:35 +02:00
gdb.spec Rewrite (and rename) gdb-libexec-add-index.patch 2023-05-04 15:11:19 +01:00
gdbinit [rhel5] Fix /etc/gdbinit compatibility with python-2.4. 2013-10-30 12:53:46 +01:00
gdbtui testsuite: Fix gdb.base/macscp.exp ccache workaround in SCL mode. 2012-02-28 18:05:01 +01:00
generate-git-repo-from-patches.sh update generate-*-from-*.sh so they can apply patches to any directory, not just a subdir 2022-06-06 16:28:12 -03:00
generate-patches-from-git-repo.sh Use %patch -PNNN 2023-03-31 09:53:54 -07:00
sources Rebase to FSF GDB 13.1 2023-03-08 21:42:55 -07:00
v1.5-libipt-static.patch Rebase to FSF GDB 8.3.50.20190824 (8.4pre). 2019-08-25 16:37:00 -04:00

README.local-patches.md

Fedora GDB local patches policy

In order to make things easier for the Fedora GDB maintainer, we choose to auto-generate the local patches by making use of an upstream git repository. Below you can find a few instructions on how to work using this method.

You need to run the following commands from the directory that contains the "gdb.spec" file.

Importing the GDB patches into a git repository

  1. The local patches (*.patch) need to be imported into an upstream git repository. For example, let's assume you cloned the repository by doing:

$ git clone git://sourceware.org/git/binutils-gdb.git

TIP: if you already have the repository cloned somewhere in your system, you can pass a "--reference

" to the "git clone" command and it will use your local repository as much as possible to make the clone, speeding up things.

  1. After cloning the upstream repository, you can import your patches by using the script "generate-git-repo-from-patches.sh":

$ sh generate-git-repo-from-patches.sh <REPOSITORY_DIR>

The script will basically cd into the repository, checkout the revision specified in the file _git_upstream_commit, iterate through the file _patch_order and "git-am" every patch in that order. This operation should complete without errors; if you find a problem with git-am, it probably means that the revision specified in the file _git_upstream_commit is wrong.

Rebasing the patches against a newer version/release

  1. First, cd into the upstream repository. All you have to do is choose the revision against which you plan to rebase the patches, and git rebase <REVISION>. git will do the rest, and you will be able to perform conflict resolution by git's algorithm, which is smarter.

Creating new patches

  1. Create the new patch on top of the the others, as usual. Note that you can use git rebase whenever you want to reorder patch order, or even to delete a patch.

  2. When writing the commit log, you must obey a few rules. The subject line must be the filename of the patch. This line will be used when exporting the patches from the git repository, and (obviously) it gives the filename that should be used for this specific patch.

  3. You can also add comments that will go into the auto-generated Patch: file (see below). To do that, use the special marker ;; at the beginning of the line. This way, a commit log that says:

  test-patch.patch

  ;; This is a test patch
  ;; Second line

Will generate the following entry in the auto-generated Patch: file:

  # This is a test patch
  # Second line
  PatchXYZ: test-patch.patch

Exporting the GDB patches from the git repository

  1. When you're done working with the patches, go back to the directory that contains the gdb.spec file, and from there you run:

$ sh generate-patches-from-git-repo.sh <REPOSITORY_DIR>

This will regenerate all of the *.patch files (excluding the ones that were also excluded from the git repository), and also regenerate a few control files. These control files are:

  • _gdb.spec.Patch.include: This file contains the Patch: directives.

  • _gdb.spec.patch.include: This file contains the %patch directives.

  • _patch_order: This file contains the patches, in the exact order that they must be applied. It is used when importing the patches into the git repository.

  • _git_upstream_commit: This file contains the last upstream commit against which the patches were rebased. It is used when importing the patches into the git repository.

NOTE: If you did a rebase against a newer upstream version, you need to specify the commit/tag/branch against which you rebased:

$ sh generate-patches-from-git-repo.sh <REPOSITORY_DIR> <COMMIT_OR_TAG_OR_BRANCH>

For example, if you rebased against gdb-8.1-release:

$ sh generate-patches-from-git-repo.sh <REPOSITORY_DIR> gdb-8.1-release