From ce991fb7c0e33238aa6eba6786598035f058bfa9 Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Wed, 17 Feb 2021 18:28:52 -0700 Subject: [PATCH] Fix libstdc++ assert when performing tab completion; build must be made with -D_GLIBCXX_DEBUG flag in order to trigger assert (RHBZ 1912985, Kevin Buettner). --- _gdb.spec.Patch.include | 20 ++++++++ _gdb.spec.patch.include | 5 ++ _patch_order | 1 + gdb-rhbz1912985-libstdc++-assert.patch | 64 ++++++++++++++++++++++++++ gdb.spec | 7 ++- 5 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 gdb-rhbz1912985-libstdc++-assert.patch diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include index 24ae5fd..9c1279a 100644 --- a/_gdb.spec.Patch.include +++ b/_gdb.spec.Patch.include @@ -37,6 +37,10 @@ Patch009: gdb-6.3-test-movedir-20050125.patch #=fedoratest Patch010: gdb-6.3-threaded-watchpoints2-20050225.patch +# Notify observers that the inferior has been created +#=fedoratest +Patch011: gdb-6.3-inferior-notification-20050721.patch + # Verify printing of inherited members test #=fedoratest Patch012: gdb-6.3-inheritancetest-20050726.patch @@ -98,6 +102,10 @@ Patch025: gdb-6.6-testsuite-timeouts.patch #=fedoratest Patch026: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch +# Test kernel VDSO decoding while attaching to an i386 process. +#=fedoratest +Patch027: gdb-6.3-attach-see-vdso-test.patch + # Test leftover zombie process (BZ 243845). #=fedoratest Patch028: gdb-6.5-bz243845-stale-testing-zombie-test.patch @@ -131,6 +139,14 @@ Patch034: gdb-6.7-testsuite-stable-results.patch #=fedoratest Patch035: gdb-6.5-ia64-libunwind-leak-test.patch +# Test hiding unexpected breakpoints on intentional step commands. +#=fedoratest +Patch036: gdb-6.5-missed-trap-on-step-test.patch + +# Test gcore memory and time requirements for large inferiors. +#=fedoratest +Patch037: gdb-6.5-gcore-buffer-limit-test.patch + # Test GCORE for shmid 0 shared memory mappings. #=fedoratest: But it is broken anyway, sometimes the case being tested is not reproducible. Patch038: gdb-6.3-mapping-zero-inode-test.patch @@ -383,3 +399,7 @@ Patch097: gdb-rhbz1553104-s390x-arch12-test.patch # =fedoratest Patch098: gdb-rhbz1905996-fix-off-by-one-error-in-ada_fold_name.patch +# Backport fix for libstdc++ assert when performing tab completion +# (RH BZ 1912985). +Patch099: gdb-rhbz1912985-libstdc++-assert.patch + diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include index a01109a..dddd45a 100644 --- a/_gdb.spec.patch.include +++ b/_gdb.spec.patch.include @@ -8,6 +8,7 @@ %patch008 -p1 %patch009 -p1 %patch010 -p1 +%patch011 -p1 %patch012 -p1 %patch013 -p1 %patch014 -p1 @@ -23,6 +24,7 @@ %patch024 -p1 %patch025 -p1 %patch026 -p1 +%patch027 -p1 %patch028 -p1 %patch029 -p1 %patch030 -p1 @@ -31,6 +33,8 @@ %patch033 -p1 %patch034 -p1 %patch035 -p1 +%patch036 -p1 +%patch037 -p1 %patch038 -p1 %patch039 -p1 %patch040 -p1 @@ -92,3 +96,4 @@ %patch096 -p1 %patch097 -p1 %patch098 -p1 +%patch099 -p1 diff --git a/_patch_order b/_patch_order index ce0f896..e426c2f 100644 --- a/_patch_order +++ b/_patch_order @@ -96,3 +96,4 @@ gdb-archer.patch gdb-vla-intel-fix-print-char-array.patch gdb-rhbz1553104-s390x-arch12-test.patch gdb-rhbz1905996-fix-off-by-one-error-in-ada_fold_name.patch +gdb-rhbz1912985-libstdc++-assert.patch diff --git a/gdb-rhbz1912985-libstdc++-assert.patch b/gdb-rhbz1912985-libstdc++-assert.patch new file mode 100644 index 0000000..5fa5f4e --- /dev/null +++ b/gdb-rhbz1912985-libstdc++-assert.patch @@ -0,0 +1,64 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Wed, 17 Feb 2021 17:58:54 -0700 +Subject: gdb-rhbz1912985-libstdc++-assert.patch + +;; Backport fix for libstdc++ assert when performing tab completion +;; (RH BZ 1912985). + +Fix completion related libstdc++ assert when using -D_GLIBCXX_DEBUG + +This commit fixes a libstdc++ assertion failure encountered when +running gdb.base/completion.exp. In order to see this problem, +GDB must be built with the follow CFLAGS and CXXFLAGS as part +of the configure line: + + CFLAGS='-D_GLIBCXX_DEBUG' CXXFLAGS='-D_GLIBCXX_DEBUG' + +(Also, this problem was encountered using Fedora rawhide. It might +not be reproducible in Fedora versions prior to Fedora 34.) + +Using the gdb.base/completion.exp test program, the problem can be +observed as follows: + +[kev@rawhide-1 gdb]$ ./gdb -q testsuite/outputs/gdb.base/completion/completion +Reading symbols from testsuite/outputs/gdb.base/completion/completion... +(gdb) start +Temporary breakpoint 1 at 0x401179: file ../../worktree-master/gdb/testsuite/gdb.base/break.c, line 43. +Starting program: testsuite/outputs/gdb.base/completion/completion + +Temporary breakpoint 1, main (argc=1, argv=0x7fffffffd718, envp=0x7fffffffd728) at ../../worktree-master/gdb/testsuite/gdb.base/break.c:43 +43 if (argc == 12345) { /* an unlikely value < 2^16, in case uninited */ /* set breakpoint 6 here */ +(gdb) p /usr/include/c++/11/string_view:211: constexpr const value_type& std::basic_string_view<_CharT, _Traits>::operator[](std::basic_string_view<_CharT, _Traits>::size_type) const [with _CharT = char; _Traits = std::char_traits; std::basic_string_view<_CharT, _Traits>::const_reference = const char&; std::basic_string_view<_CharT, _Traits>::size_type = long unsigned int]: Assertion '__pos < this->_M_len' failed. +Aborted (core dumped) + +(Note that I added "" to make it clear where the tab key was +pressed.) + +gdb/ChangeLog: + + * ada-lang.c (ada_fold_name): Check for non-empty string prior + to accessing it. + (ada_lookup_name_info): Likewise. + +diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c +--- a/gdb/ada-lang.c ++++ b/gdb/ada-lang.c +@@ -997,7 +997,7 @@ ada_fold_name (gdb::string_view name) + int len = name.size (); + GROW_VECT (fold_buffer, fold_buffer_size, len + 1); + +- if (name[0] == '\'') ++ if (!name.empty () && name[0] == '\'') + { + strncpy (fold_buffer, name.data () + 1, len - 2); + fold_buffer[len - 2] = '\000'; +@@ -13592,7 +13592,7 @@ ada_lookup_name_info::ada_lookup_name_info (const lookup_name_info &lookup_name) + { + gdb::string_view user_name = lookup_name.name (); + +- if (user_name[0] == '<') ++ if (!user_name.empty () && user_name[0] == '<') + { + if (user_name.back () == '>') + m_encoded_name diff --git a/gdb.spec b/gdb.spec index 99929e0..18bad1b 100644 --- a/gdb.spec +++ b/gdb.spec @@ -37,7 +37,7 @@ Version: 10.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: 5%{?dist} +Release: 6%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL # Do not provide URL for snapshots as the file lasts there only for 2 days. @@ -1195,6 +1195,11 @@ fi %endif %changelog +* Thu Feb 11 2021 Kevin Buettner - 10.1-6 +- Fix libstdc++ assert when performing tab completion; build must be made + with -D_GLIBCXX_DEBUG flag in order to trigger assert (RHBZ 1912985, + Kevin Buettner). + * Thu Feb 11 2021 Keith Seitz - Disable Guile support for RHEL9+.