public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/gdb] gdb-17.2-rebase-f44: Backport upstream commit bc23ea51f8a83e9524dfb553baa8baacb29e68a9
Date: Sun, 28 Jun 2026 00:01:28 GMT	[thread overview]
Message-ID: <178260488803.1.2982088760019746923.rpms-gdb-a84ff66cf3a4@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/gdb
            Branch : gdb-17.2-rebase-f44
            Commit : a84ff66cf3a463550ff27a55eeb4558fd1113549
            Author : Kevin Buettner <kevinb@redhat.com>
            Date   : 2024-01-16T20:12:34-07:00
            Stats  : +123/-1 in 5 file(s)
            URL    : https://src.fedoraproject.org/rpms/gdb/c/a84ff66cf3a463550ff27a55eeb4558fd1113549?branch=gdb-17.2-rebase-f44

            Log:
            Backport upstream commit bc23ea51f8a83e9524dfb553baa8baacb29e68a9

This backport might fix RHBZ 2257562.

---
diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include
index 87c2ab7..ee95bce 100644
--- a/_gdb.spec.Patch.include
+++ b/_gdb.spec.Patch.include
@@ -193,3 +193,6 @@ Patch044: gdb-rhbz2250652-gdbpy_gil.patch
 
 Patch045: gdb-rhbz2250652-avoid-PyOS_ReadlineTState.patch
 
+# Backport potential fix for RH BZ 2257562.
+Patch046: gdb-rhbz2257562-cp-namespace-null-ptr-check.patch
+

diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include
index cfd9510..80df31a 100644
--- a/_gdb.spec.patch.include
+++ b/_gdb.spec.patch.include
@@ -43,3 +43,4 @@
 %patch -p1 -P043
 %patch -p1 -P044
 %patch -p1 -P045
+%patch -p1 -P046

diff --git a/_patch_order b/_patch_order
index 7c373f2..327a629 100644
--- a/_patch_order
+++ b/_patch_order
@@ -43,3 +43,4 @@ gdb-rhbz-2232086-generate-gdb-index-consistently.patch
 gdb-rhbz-2232086-generate-dwarf-5-index-consistently.patch
 gdb-rhbz2250652-gdbpy_gil.patch
 gdb-rhbz2250652-avoid-PyOS_ReadlineTState.patch
+gdb-rhbz2257562-cp-namespace-null-ptr-check.patch

diff --git a/gdb-rhbz2257562-cp-namespace-null-ptr-check.patch b/gdb-rhbz2257562-cp-namespace-null-ptr-check.patch
new file mode 100644
index 0000000..f868e6f
--- /dev/null
+++ b/gdb-rhbz2257562-cp-namespace-null-ptr-check.patch
@@ -0,0 +1,113 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Kevin Buettner <kevinb@redhat.com>
+Date: Tue, 16 Jan 2024 20:07:53 -0700
+Subject: gdb-rhbz2257562-cp-namespace-null-ptr-check.patch
+
+;; Backport potential fix for RH BZ 2257562.
+
+Fix printing of global variable stubs if no inferior is running
+
+Since 3c45e9f915ae4aeab7312d6fc55a947859057572 gdb crashes when trying
+to print a global variable stub without a running inferior, because of
+a missing nullptr-check (the block_scope function took care of that
+check before it was converted to a method).
+
+With this check it works again:
+```
+(gdb) print s
+$1 = <incomplete type>
+```
+
+Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31128
+Approved-By: Tom Tromey <tom@tromey.com>
+(cherry picked from commit 576745e26c0ec76a53ba45b20af464628a50b3e4)
+
+diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
+--- a/gdb/cp-namespace.c
++++ b/gdb/cp-namespace.c
+@@ -1026,7 +1026,11 @@ cp_lookup_transparent_type (const char *name)
+ 
+   /* If that doesn't work and we're within a namespace, look there
+      instead.  */
+-  scope = get_selected_block (0)->scope ();
++  const block *block = get_selected_block (0);
++  if (block == nullptr)
++    return nullptr;
++
++  scope = block->scope ();
+ 
+   if (scope[0] == '\0')
+     return NULL;
+diff --git a/gdb/testsuite/gdb.cp/print-global-stub.cc b/gdb/testsuite/gdb.cp/print-global-stub.cc
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.cp/print-global-stub.cc
+@@ -0,0 +1,31 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2023 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++struct S
++{
++  S (int);
++  virtual ~S ();
++
++  int m_i;
++};
++
++S s (5);
++
++int main ()
++{
++  return 0;
++}
+diff --git a/gdb/testsuite/gdb.cp/print-global-stub.exp b/gdb/testsuite/gdb.cp/print-global-stub.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.cp/print-global-stub.exp
+@@ -0,0 +1,32 @@
++# Copyright (C) 2023 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++# This file is part of the GDB testsuite.
++# It tests printing of a global stub without inferior.
++
++require allow_cplus_tests
++
++standard_testfile .cc
++set objfile [standard_output_file ${testfile}.o]
++
++if { [gdb_compile $srcdir/$subdir/$srcfile $objfile object \
++	  {c++ debug}] != "" } {
++    untested "failed to compile"
++    return -1
++}
++
++clean_restart $objfile
++
++gdb_test "print s" " = <incomplete type>"

diff --git a/gdb.spec b/gdb.spec
index f8bf277..bab04d1 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -57,7 +57,7 @@ Version: 14.1
 
 # The release always contains a leading reserved number, start it at 1.
 # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
-Release: 3%{?dist}
+Release: 4%{?dist}
 
 License: GPL-3.0-or-later AND BSD-3-Clause AND FSFAP AND LGPL-2.1-or-later AND GPL-2.0-or-later AND LGPL-2.0-or-later AND LicenseRef-Fedora-Public-Domain AND GFDL-1.3-or-later AND LGPL-2.0-or-later WITH GCC-exception-2.0 AND GPL-3.0-or-later WITH GCC-exception-3.1 AND GPL-2.0-or-later WITH GNU-compiler-exception
 # Do not provide URL for snapshots as the file lasts there only for 2 days.
@@ -1250,6 +1250,10 @@ fi
 %endif
 
 %changelog
+* Tue Jan 16 2024 Kevin Buettner <kevinb@redhat.com> - 14.1-4
+- Backport upstream commit bc23ea51f8a83e9524dfb553baa8baacb29e68a9,
+  potentially fixing RHBZ 2257562.
+
 * Thu Jan 11 2024 Alexandra Hájková <ahajkova@redhat.com> - 14.1-3
 - Fix typo in gdb.spec.
 

                 reply	other threads:[~2026-06-28  0:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178260488803.1.2982088760019746923.rpms-gdb-a84ff66cf3a4@fedoraproject.org \
    --to=kevinb@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox