Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package gdb for openSUSE:Factory checked in at 2021-05-10 15:34:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/gdb (Old) and /work/SRC/openSUSE:Factory/.gdb.new.2988 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "gdb" Mon May 10 15:34:14 2021 rev:149 rq:891447 version:10.1 Changes: -------- --- /work/SRC/openSUSE:Factory/gdb/gdb.changes 2021-05-05 20:39:36.471017479 +0200 +++ /work/SRC/openSUSE:Factory/.gdb.new.2988/gdb.changes 2021-05-10 15:34:16.326772120 +0200 @@ -1,0 +2,12 @@ +Fri May 7 10:43:38 UTC 2021 - Tom de Vries <tdevr...@suse.com> +- Replace tentative fix with upstreamed fix [swo#27681]: + Remove: + * gdb-build-workaround-pcre2_posix-linking-problem.patch + Add: + * gdb-build-hardcode-with-included-regex.patch +- Backport fix from upstream [bsc#1185638, swo#26327]: + * gdb-symtab-fix-infinite-recursion-in-dwarf2_cu-get_builder.patch +- Backport fix from upstream [rh#1931344]: + * gdb-save-restore-file-offset-while-reading-notes-in-core-file.patch + +------------------------------------------------------------------- Old: ---- gdb-build-workaround-pcre2_posix-linking-problem.patch New: ---- gdb-build-hardcode-with-included-regex.patch gdb-save-restore-file-offset-while-reading-notes-in-core-file.patch gdb-symtab-fix-infinite-recursion-in-dwarf2_cu-get_builder.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gdb.spec ++++++ --- /var/tmp/diff_new_pack.ccZiva/_old 2021-05-10 15:34:18.166765076 +0200 +++ /var/tmp/diff_new_pack.ccZiva/_new 2021-05-10 15:34:18.166765076 +0200 @@ -295,7 +295,6 @@ Patch1513: gdb-testsuite-fix-control-flow-in-gdb-reverse-insn-reverse-exp.patch Patch1514: gdb-fix-use-of-invalid-pointer-in-remote-async-inferior-event-handler.patch Patch1515: gdb-try-to-load-libthread_db-only-after-reading-all-shared-libraries-when-attaching.patch -Patch1516: gdb-build-workaround-pcre2_posix-linking-problem.patch # Backports from master @@ -317,6 +316,9 @@ Patch2016: gdb-testsuite-ignore-debuginfod_urls.patch Patch2017: gdb-testsuite-fix-unset-of-debuginfod_urls-in-default_gdb_init.patch Patch2018: gdb-tui-fix-len_without_escapes-in-tui-disasm.c.patch +Patch2019: gdb-build-hardcode-with-included-regex.patch +Patch2020: gdb-symtab-fix-infinite-recursion-in-dwarf2_cu-get_builder.patch +Patch2021: gdb-save-restore-file-offset-while-reading-notes-in-core-file.patch # Testsuite patches @@ -714,7 +716,6 @@ %patch1513 -p1 %patch1514 -p1 %patch1515 -p1 -%patch1516 -p1 %patch2000 -p1 %patch2002 -p1 @@ -734,6 +735,9 @@ %patch2016 -p1 %patch2017 -p1 %patch2018 -p1 +%patch2019 -p1 +%patch2020 -p1 +%patch2021 -p1 %patch2500 -p1 %if 0%{?suse_version} > 1500 ++++++ gdb-build-hardcode-with-included-regex.patch ++++++ Index: gdb-10.1/gdb/config.in =================================================================== --- gdb-10.1.orig/gdb/config.in +++ gdb-10.1/gdb/config.in @@ -734,9 +734,6 @@ /* Define if <thread_db.h> has the TD_VERSION error code. */ #undef THREAD_DB_HAS_TD_VERSION -/* Define to 1 if the regex included in libiberty should be used. */ -#undef USE_INCLUDED_REGEX - /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE Index: gdb-10.1/gdb/configure =================================================================== --- gdb-10.1.orig/gdb/configure +++ gdb-10.1/gdb/configure @@ -912,7 +912,6 @@ enable_source_highlight with_intel_pt with_libipt_prefix with_libipt_type -with_included_regex with_sysroot with_system_gdbinit with_system_gdbinit_dir @@ -1663,10 +1662,6 @@ Optional Packages: --with-libipt-prefix[=DIR] search for libipt in DIR/include and DIR/lib --without-libipt-prefix don't search for libipt in includedir and libdir --with-libipt-type=TYPE type of library to search for (auto/static/shared) - --without-included-regex - don't use included regex; this is the default on - systems with version 2 of the GNU C library (use - with caution on other system) --with-sysroot[=DIR] search for usr/lib et al within DIR --with-system-gdbinit=PATH automatically load a system-wide gdbinit file @@ -16006,57 +16001,6 @@ if test "$ac_cv_func_setpgrp_void" = yes fi fi -# Assume we'll default to using the included libiberty regex. -gdb_use_included_regex=yes - -# However, if the system regex is GNU regex, then default to *not* -# using the included regex. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU regex" >&5 -$as_echo_n "checking for GNU regex... " >&6; } -if ${gdb_cv_have_gnu_regex+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <gnu-versions.h> -int -main () -{ -#define REGEX_INTERFACE_VERSION 1 -#if _GNU_REGEX_INTERFACE_VERSION != REGEX_INTERFACE_VERSION -# error "Version mismatch" -#endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gdb_cv_have_gnu_regex=yes -else - gdb_cv_have_gnu_regex=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_have_gnu_regex" >&5 -$as_echo "$gdb_cv_have_gnu_regex" >&6; } -if test "$gdb_cv_have_gnu_regex" = yes; then - gdb_use_included_regex=no -fi - - -# Check whether --with-included-regex was given. -if test "${with_included_regex+set}" = set; then : - withval=$with_included_regex; gdb_with_regex=$withval -else - gdb_with_regex=$gdb_use_included_regex -fi - -if test "$gdb_with_regex" = yes; then - -$as_echo "#define USE_INCLUDED_REGEX 1" >>confdefs.h - -fi - # Check if <sys/proc.h> defines `struct thread' with a td_pcb member. ac_fn_c_check_member "$LINENO" "struct thread" "td_pcb" "ac_cv_member_struct_thread_td_pcb" "#include <sys/param.h> #include <sys/proc.h> Index: gdb-10.1/gdb/configure.ac =================================================================== --- gdb-10.1.orig/gdb/configure.ac +++ gdb-10.1/gdb/configure.ac @@ -1514,35 +1514,6 @@ if test "$ac_cv_func_setpgrp_void" = yes fi fi -# Assume we'll default to using the included libiberty regex. -gdb_use_included_regex=yes - -# However, if the system regex is GNU regex, then default to *not* -# using the included regex. -AC_CACHE_CHECK( - [for GNU regex], - [gdb_cv_have_gnu_regex], - [AC_TRY_COMPILE( - [#include <gnu-versions.h>], - [#define REGEX_INTERFACE_VERSION 1 -#if _GNU_REGEX_INTERFACE_VERSION != REGEX_INTERFACE_VERSION -# error "Version mismatch" -#endif], - gdb_cv_have_gnu_regex=yes, - gdb_cv_have_gnu_regex=no)]) -if test "$gdb_cv_have_gnu_regex" = yes; then - gdb_use_included_regex=no -fi - -AC_ARG_WITH(included-regex, - AS_HELP_STRING([--without-included-regex], [don't use included regex; this is the default on systems with version 2 of the GNU C library (use with caution on other system)]), - gdb_with_regex=$withval, - gdb_with_regex=$gdb_use_included_regex) -if test "$gdb_with_regex" = yes; then - AC_DEFINE(USE_INCLUDED_REGEX, 1, - [Define to 1 if the regex included in libiberty should be used.]) -fi - # Check if <sys/proc.h> defines `struct thread' with a td_pcb member. AC_CHECK_MEMBERS([struct thread.td_pcb], [], [], [#include <sys/param.h> Index: gdb-10.1/gdb/gdb_regex.h =================================================================== --- gdb-10.1.orig/gdb/gdb_regex.h +++ gdb-10.1/gdb/gdb_regex.h @@ -19,13 +19,7 @@ #ifndef GDB_REGEX_H #define GDB_REGEX_H 1 -#ifdef USE_INCLUDED_REGEX # include "xregex.h" -#else -/* Request 4.2 BSD regex functions. */ -# define _REGEX_RE_COMP -# include <regex.h> -#endif /* A compiled regex. This is mainly a wrapper around regex_t. The the constructor throws on regcomp error and the destructor is ++++++ gdb-save-restore-file-offset-while-reading-notes-in-core-file.patch ++++++ Save/restore file offset while reading notes in core file A recent bug (RH BZ 1931344) has exposed a bug in the core file build-ID support that I introduced a while ago. It is pretty easy to demonstate the problem following a simplified procedure outlined in that bug: [shell1] shell1$ /usr/libexec/qemu-kvm [shell2] shell2$ pkill -SEGV -x qemu-kvm [shell1] Segmentation fault (core dumped) Load this core file into GDB without specifying an executable (an unfortunate Fedora/RHEL-ism), and GDB will inform the user to install debuginfo for the "missing" executable: $ gdb -nx -q core.12345 ... Missing separate debuginfo for the main executable file Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/e2/e9c66d3117fb2bbb5b2be122f04f2664e5df54 Core was generated by `/usr/libexec/qemu-kvm'. Program terminated with signal SIGSEGV, Segmentation fault. ... The suggested build-ID is actaully for gmp not qemu-kvm. The problem lies in _bfd_elf_core_find_build_id, where we loop over program headers looking for note segments: /* Read in program headers and parse notes. */ for (i = 0; i < i_ehdr.e_phnum; ++i, ++i_phdr) { Elf_External_Phdr x_phdr; if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr)) goto fail; elf_swap_phdr_in (abfd, &x_phdr, i_phdr); if (i_phdr->p_type == PT_NOTE && i_phdr->p_filesz > 0) { elf_read_notes (abfd, offset + i_phdr->p_offset, i_phdr->p_filesz, i_phdr->p_align); if (abfd->build_id != NULL) return TRUE; } elf_read_notes uses bfd_seek to forward the stream to the location of the note segment. When control returns to _bfd_elf_core_fild_build_id, the stream is no longer in the location looking at program headers, and all subsequent reads will read from the wrong file offset. To fix this, this patch marks the stream location and ensures that it is restored after elf_read_notes is called. bfd/ChangeLog 2021-03-26 Keith Seitz <kei...@redhat.com> * elfcore.h (_bfd_elf_core_find_build_id): Seek file offset of program headers after calling elf_read_notes. --- bfd/elfcore.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/bfd/elfcore.h b/bfd/elfcore.h index 3015e582ef0..4e6383415f7 100644 --- a/bfd/elfcore.h +++ b/bfd/elfcore.h @@ -410,6 +410,13 @@ NAME(_bfd_elf, core_find_build_id) { elf_read_notes (abfd, offset + i_phdr->p_offset, i_phdr->p_filesz, i_phdr->p_align); + + /* Make sure ABFD returns to processing the program headers. */ + if (bfd_seek (abfd, (file_ptr) (offset + i_ehdr.e_phoff + + (i + 1) * sizeof (x_phdr)), + SEEK_SET) != 0) + goto fail; + if (abfd->build_id != NULL) return TRUE; } ++++++ gdb-symtab-fix-infinite-recursion-in-dwarf2_cu-get_builder.patch ++++++ [gdb/symtab] Fix infinite recursion in dwarf2_cu::get_builder() With the test-case attached in PR26327, gdb aborts: ... $ gdb -q -batch 447.dealII -ex "b main" Aborted (core dumped) ... when running out of stack due to infinite recursion: ... #8 0x00000000006aaba6 in dwarf2_cu::get_builder (this=0x35e4b40) at src/gdb/dwarf2/read.c:700 #9 0x00000000006aaba6 in dwarf2_cu::get_builder (this=0x22ee2c0) at src/gdb/dwarf2/read.c:700 #10 0x00000000006aaba6 in dwarf2_cu::get_builder (this=0x35e4b40) at src/gdb/dwarf2/read.c:700 #11 0x00000000006aaba6 in dwarf2_cu::get_builder (this=0x22ee2c0) at src/gdb/dwarf2/read.c:700 ... We're recursing in this code in dwarf2_cu::get_builder(): ... /* Otherwise, search ancestors for a valid builder. */ if (ancestor != nullptr) return ancestor->get_builder (); ... due to the fact that the ancestor chain is a cycle. Higher up in the call stack, we find some code that is responsible for triggering this, in new_symbol: ... case DW_TAG_formal_parameter: { /* If we are inside a function, mark this as an argument. If not, we might be looking at an argument to an inlined function when we do not have enough information to show inlined frames; pretend it's a local variable in that case so that the user can still see it. */ struct context_stack *curr = cu->get_builder ()->get_current_context_stack (); if (curr != nullptr && curr->name != nullptr) SYMBOL_IS_ARGUMENT (sym) = 1; ... This is code that was added to support pre-4.1 gcc, to be able to show arguments of inlined functions as locals, in the absense of sufficiently correct debug information. Removing this code (that is, doing SYMBOL_IS_ARGUMENT (sym) = 1 unconditially), fixes the crash. The ancestor variable also seems to have been added specifically to deal with fallout from this code, so remove that as well. Tested on x86_64-linux: - openSUSE Leap 15.2 with gcc 7.5.0, and - openSUSE Tumbleweed with gcc 10.3.0. gdb/ChangeLog: 2021-05-07 Tom de Vries <tdevr...@suse.de> PR symtab/26327 * dwarf2/read.c (struct dwarf2_cu): Remove ancestor. (dwarf2_cu::get_builder): Remove ancestor-related code. (new_symbol): Remove code supporting pre-4.1 gcc that show arguments of inlined functions as locals. (follow_die_offset, follow_die_sig_1): Remove setting of ancestor. gdb/doc/ChangeLog: 2021-05-07 Tom de Vries <tdevr...@suse.de> PR symtab/26327 * gdb.texinfo (Inline Functions): Update. --- gdb/doc/gdb.texinfo | 4 ++-- gdb/dwarf2/read.c | 25 ++----------------------- 4 files changed, 18 insertions(+), 25 deletions(-) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 56f37eb2288..f4d7085da58 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -13842,8 +13842,8 @@ when using @sc{dwarf 2}. Versions of @value{NGCC} before 4.1 do not emit two required attributes (@samp{DW_AT_call_file} and @samp{DW_AT_call_line}); @value{GDBN} does not display inlined function calls with earlier versions of @value{NGCC}. It instead -displays the arguments and local variables of inlined functions as -local variables in the caller. +displays local variables of inlined functions as local variables in +the caller. The body of an inlined function is directly included at its call site; unlike a non-inlined function, there are no instructions devoted to diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 5796cf1730b..b2f48f1f395 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -684,10 +684,6 @@ struct dwarf2_cu struct partial_die_info *find_partial_die (sect_offset sect_off); - /* If this CU was inherited by another CU (via specification, - abstract_origin, etc), this is the ancestor CU. */ - dwarf2_cu *ancestor; - /* Get the buildsym_compunit for this CU. */ buildsym_compunit *get_builder () { @@ -695,10 +691,6 @@ struct dwarf2_cu if (m_builder != nullptr) return m_builder.get (); - /* Otherwise, search ancestors for a valid builder. */ - if (ancestor != nullptr) - return ancestor->get_builder (); - return nullptr; } }; @@ -22045,15 +22037,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, break; case DW_TAG_formal_parameter: { - /* If we are inside a function, mark this as an argument. If - not, we might be looking at an argument to an inlined function - when we do not have enough information to show inlined frames; - pretend it's a local variable in that case so that the user can - still see it. */ - struct context_stack *curr - = cu->get_builder ()->get_current_context_stack (); - if (curr != nullptr && curr->name != nullptr) - SYMBOL_IS_ARGUMENT (sym) = 1; + SYMBOL_IS_ARGUMENT (sym) = 1; attr = dwarf2_attr (die, DW_AT_location, cu); if (attr != nullptr) { @@ -23389,9 +23373,6 @@ follow_die_offset (sect_offset sect_off, int offset_in_dwz, *ref_cu = target_cu; temp_die.sect_off = sect_off; - if (target_cu != cu) - target_cu->ancestor = cu; - return (struct die_info *) htab_find_with_hash (target_cu->die_hash, &temp_die, to_underlying (sect_off)); @@ -23741,7 +23722,7 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type, struct dwarf2_cu **ref_cu) { struct die_info temp_die; - struct dwarf2_cu *sig_cu, *cu = *ref_cu; + struct dwarf2_cu *sig_cu; struct die_info *die; dwarf2_per_objfile *per_objfile = (*ref_cu)->per_objfile; @@ -23777,8 +23758,6 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type, } *ref_cu = sig_cu; - if (sig_cu != cu) - sig_cu->ancestor = cu; return die; }