Rebase to FSF GDB 14.1

Update local patches:
    gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
    gdb-6.6-buildid-locate-rpm.patch
    gdb-6.6-buildid-locate.patch
    gdb-container-rh-pkg.patch
    gdb-core-open-vdso-warning.patch
    gdb-fedora-libncursesw.patch
    gdb-linux_perf-bundle.patch

Update backported patches which didn't make it into 14.1:
    gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch
    gdb-rhbz-2232086-generate-gdb-index-consistently.patch

Drop upstreamed local patches:
    gdb-6.5-sharedlibrary-path.patch

Drop gdb-13.2 backports (which are now in gdb-14.1):
    gdb-binutils29988-read_indexed_address.patch
    gdb-bz2196395-debuginfod-legacy-openssl-crash.patch
    gdb-bz2237392-dwarf-obstack-allocation.patch
    gdb-bz2237515-debuginfod-double-free.patch
    gdb-rhbz2192105-ftbs-dangling-pointer
    gdb-rhbz2233961-CVE-2022-4806.patch
    gdb-rhbz2233965-memory-leak.patch

Adjust gdb.spec so that --with-mpfr is no longer passed to
configure; doing so, combined with some configury changes triggered
a latent build problem.
This commit is contained in:
Kevin Buettner 2023-12-08 18:43:22 -07:00
parent a27201b2a0
commit ebdac5bb6e
29 changed files with 454 additions and 1081 deletions

3
.gitignore vendored
View File

@ -1,5 +1,4 @@
/new-fedora-release
/gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz
/v2.0.5.tar.gz
/gdb-13.1.tar.xz
/gdb-13.2.tar.xz
/gdb-14.1.tar.xz

View File

@ -167,59 +167,23 @@ Patch037: gdb-linux_perf-bundle.patch
#=fedora
Patch038: gdb-add-index.patch
# Backport "Fix a potential illegal memory access in the BFD library..."
# (Nick Clifton, binutils/29988)
Patch039: gdb-binutils29988-read_indexed_address.patch
# Backport upstream patch fixing a "dangling pointer" build problem
# first seen when building with GCC 13.1.1 20230426 (Red Hat ;; 13.1.1-1).
Patch040: gdb-rhbz2192105-ftbs-dangling-pointer
# Backport two commits, 0ad504dd464 and ea70f941f9b, from Lancelot SIX
# which prevent repeated warnings from being printed while loading a
# core file. (RH BZ 2160211)
Patch041: gdb-rhbz2160211-excessive-core-file-warnings.patch
# Backport upstream commit f3eee5861743d635 to fix a crash triggered
# when debuginfod makes use of particular openssl settings.
Patch042: gdb-bz2196395-debuginfod-legacy-openssl-crash.patch
# Backport upstream commit f96328accde1e63 to fix a potential double
# free issue in the debuginfod code.
Patch043: gdb-bz2237515-debuginfod-double-free.patch
# Backport upstream commit 54392c4df604f20 to fix an incorrect
# obstack allocation that wold lead to memory corruption.
Patch044: gdb-bz2237392-dwarf-obstack-allocation.patch
# Backport PR29922, SHT_NOBITS section
# avoids section size sanity check.
Patch045: gdb-rhbz2233961-CVE-2022-4806.patch
# Backport PR29925, Memory leak in find_abstract_instance
Patch046: gdb-rhbz2233965-memory-leak.patch
# Backport upstream patch which prevents internal error when
# generating a gdb-index file (RH BZ 1773651).
Patch047: gdb-rhbz1773651-gdb-index-internal-error.patch
# Back-port upstream commit 1f0fab7ff86 as part of a fix for
# non-deterministic gdb-index generation (RH BZ 2232086).
Patch048: gdb-rhbz2232086-refactor-selftest-support.patch
Patch039: gdb-rhbz2232086-refactor-selftest-support.patch
# Back-port upstream commit aa19bc1d259 as part of a fix for
# non-deterministic gdb-index generation (RH BZ 2232086).
Patch049: gdb-rhbz-2232086-reduce-size-of-gdb-index.patch
Patch040: gdb-rhbz-2232086-reduce-size-of-gdb-index.patch
# Back-port upstream commit acc117b57f7 as part of a fix for
# non-deterministic gdb-index generation (RH BZ 2232086).
Patch050: gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch
Patch041: gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch
# Back-port upstream commit aff250145af as part of a fix for
# non-deterministic gdb-index generation (RH BZ 2232086).
Patch051: gdb-rhbz-2232086-generate-gdb-index-consistently.patch
Patch042: gdb-rhbz-2232086-generate-gdb-index-consistently.patch
# Back-port upstream commit 3644f41dc80 as part of a fix for
# non-deterministic gdb-index generation (RH BZ 2232086).
Patch052: gdb-rhbz-2232086-generate-dwarf-5-index-consistently.patch
Patch043: gdb-rhbz-2232086-generate-dwarf-5-index-consistently.patch

View File

@ -41,12 +41,3 @@
%patch -p1 -P041
%patch -p1 -P042
%patch -p1 -P043
%patch -p1 -P044
%patch -p1 -P045
%patch -p1 -P046
%patch -p1 -P047
%patch -p1 -P048
%patch -p1 -P049
%patch -p1 -P050
%patch -p1 -P051
%patch -p1 -P052

View File

@ -1 +1 @@
662243de0e14a4945555a480dca33c0e677976eb
6bda1c19bcd16eff8488facb8a67d52a436f70e7

View File

@ -36,15 +36,6 @@ gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
gdb-container-rh-pkg.patch
gdb-linux_perf-bundle.patch
gdb-add-index.patch
gdb-binutils29988-read_indexed_address.patch
gdb-rhbz2192105-ftbs-dangling-pointer
gdb-rhbz2160211-excessive-core-file-warnings.patch
gdb-bz2196395-debuginfod-legacy-openssl-crash.patch
gdb-bz2237515-debuginfod-double-free.patch
gdb-bz2237392-dwarf-obstack-allocation.patch
gdb-rhbz2233961-CVE-2022-4806.patch
gdb-rhbz2233965-memory-leak.patch
gdb-rhbz1773651-gdb-index-internal-error.patch
gdb-rhbz2232086-refactor-selftest-support.patch
gdb-rhbz-2232086-reduce-size-of-gdb-index.patch
gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch

View File

@ -16,7 +16,7 @@ Subject: gdb-6.3-gstack-20050411.patch
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2011,7 +2011,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
@@ -2035,7 +2035,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
install: all
@$(MAKE) $(FLAGS_TO_PASS) install-only
@ -25,7 +25,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in
transformed_name=`t='$(program_transform_name)'; \
echo gdb | sed -e "$$t"` ; \
if test "x$$transformed_name" = x; then \
@@ -2061,7 +2061,25 @@ install-guile:
@@ -2085,7 +2085,25 @@ install-guile:
install-python:
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
@ -52,7 +52,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in
transformed_name=`t='$(program_transform_name)'; \
echo gdb | sed -e $$t` ; \
if test "x$$transformed_name" = x; then \
@@ -2092,6 +2110,18 @@ uninstall: force $(CONFIG_UNINSTALL)
@@ -2116,6 +2134,18 @@ uninstall: force $(CONFIG_UNINSTALL)
rm -f $(DESTDIR)$(bindir)/$$transformed_name
@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do

View File

@ -44,7 +44,7 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1300,6 +1300,10 @@ process_print_command_args (const char *args, value_print_options *print_opts,
@@ -1308,6 +1308,11 @@ process_print_command_args (const char *args, value_print_options *print_opts,
if (exp != nullptr && *exp)
{
@ -52,9 +52,10 @@ diff --git a/gdb/printcmd.c b/gdb/printcmd.c
+ function descriptors. */
+ if (target_has_execution () && strcmp (exp, "errno") == 0)
+ exp = "*(*(int *(*)(void)) __errno_location) ()";
/* VOIDPRINT is true to indicate that we do want to print a void
value, so invert it for parse_expression. */
expression_up expr = parse_expression (exp, nullptr, !voidprint);
+
/* This setting allows large arrays to be printed by limiting the
number of elements that are loaded into GDB's memory; we only
need to load as many array elements as we plan to print. */
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno.c b/gdb/testsuite/gdb.dwarf2/dw2-errno.c
new file mode 100644
--- /dev/null

View File

@ -235,7 +235,7 @@ diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4
diff --git a/gdb/build-id.c b/gdb/build-id.c
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -771,10 +771,10 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor)
@@ -780,10 +780,10 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor)
static rpmts (*rpmtsCreate_p) (void);
extern rpmts rpmtsFree(rpmts ts);
static rpmts (*rpmtsFree_p) (rpmts ts);
@ -248,7 +248,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
const void *keyp,
size_t keylen);
#else /* !DLOPEN_LIBRPM */
@@ -829,7 +829,7 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor)
@@ -838,7 +838,7 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor)
&& (rpmdbNextIterator_p = (Header (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbNextIterator"))
&& (rpmtsCreate_p = (rpmts (*) (void)) dlsym (h, "rpmtsCreate"))
&& (rpmtsFree_p = (rpmts (*) (rpmts ts)) dlsym (h, "rpmtsFree"))
@ -257,7 +257,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
{
warning (_("Opened library \"%s\" is incompatible (%s), "
"missing debuginfos notifications will not be displayed"),
@@ -917,7 +917,7 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor)
@@ -926,7 +926,7 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor)
/* RPMDBI_PACKAGES requires keylen == sizeof (int). */
/* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */
@ -269,7 +269,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
diff --git a/gdb/config.in b/gdb/config.in
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -39,6 +39,9 @@
@@ -42,6 +42,9 @@
/* Handle .ctf type-info sections */
#undef ENABLE_LIBCTF
@ -279,9 +279,9 @@ diff --git a/gdb/config.in b/gdb/config.in
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
@@ -259,6 +262,9 @@
/* Define if you have the mpfr library. */
#undef HAVE_LIBMPFR
@@ -265,6 +268,9 @@
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
+/* Define if librpm library is being used. */
+#undef HAVE_LIBRPM
@ -292,7 +292,7 @@ diff --git a/gdb/config.in b/gdb/config.in
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
@@ -783,6 +783,11 @@ TARGET_OBS
@@ -778,6 +778,11 @@ AMD_DBGAPI_CFLAGS
ENABLE_BFD_64_BIT_FALSE
ENABLE_BFD_64_BIT_TRUE
subdirs
@ -304,16 +304,16 @@ diff --git a/gdb/configure b/gdb/configure
GDB_DATADIR
DEBUGDIR
MAKEINFO_EXTRA_FLAGS
@@ -912,6 +917,7 @@ with_gdb_datadir
@@ -911,6 +916,7 @@ with_gdb_datadir
with_relocated_sources
with_auto_load_dir
with_auto_load_safe_path
+with_rpm
enable_targets
enable_64_bit_bfd
enable_gdbmi
@@ -992,6 +998,8 @@ PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
with_amd_dbgapi
@@ -988,6 +994,8 @@ AMD_DBGAPI_CFLAGS
AMD_DBGAPI_LIBS
DEBUGINFOD_CFLAGS
DEBUGINFOD_LIBS
+RPM_CFLAGS
@ -321,8 +321,8 @@ diff --git a/gdb/configure b/gdb/configure
YACC
YFLAGS
ZSTD_CFLAGS
@@ -1678,6 +1686,8 @@ Optional Packages:
do not restrict auto-loaded files locations
@@ -1679,6 +1687,8 @@ Optional Packages:
--with-amd-dbgapi support for the amd-dbgapi target (yes / no / auto)
--with-debuginfod Enable debuginfo lookups with debuginfod
(auto/yes/no)
+ --with-rpm query rpm database for missing debuginfos (yes/no,
@ -330,7 +330,7 @@ diff --git a/gdb/configure b/gdb/configure
--with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
--with-curses use the curses library instead of the termcap
library
@@ -1761,6 +1771,8 @@ Some influential environment variables:
@@ -1759,6 +1769,8 @@ Some influential environment variables:
C compiler flags for DEBUGINFOD, overriding pkg-config
DEBUGINFOD_LIBS
linker flags for DEBUGINFOD, overriding pkg-config
@ -339,7 +339,7 @@ diff --git a/gdb/configure b/gdb/configure
YACC The `Yet Another Compiler Compiler' implementation to use.
Defaults to the first program found out of: `bison -y', `byacc',
`yacc'.
@@ -17848,6 +17860,495 @@ _ACEOF
@@ -18039,6 +18051,495 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
$as_echo "$with_auto_load_safe_path" >&6; }
@ -838,7 +838,7 @@ diff --git a/gdb/configure b/gdb/configure
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -160,6 +160,200 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
@@ -173,6 +173,200 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
[Directories safe to hold auto-loaded files.])
AC_MSG_RESULT([$with_auto_load_safe_path])
@ -1050,7 +1050,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c
/* readline include files. */
#include "readline/readline.h"
@@ -391,6 +392,8 @@ display_gdb_prompt (const char *new_prompt)
@@ -404,6 +405,8 @@ display_gdb_prompt (const char *new_prompt)
/* Reset the nesting depth used when trace-commands is set. */
reset_command_nest_depth ();
@ -1059,7 +1059,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c
/* Do not call the python hook on an explicit prompt change as
passed to this function, as this forms a secondary/local prompt,
IE, displayed but not set. */
@@ -852,7 +855,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
@@ -788,7 +791,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
command_handler (cmd);
if (ui->prompt_state != PROMPTED)
@ -1074,7 +1074,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c
diff --git a/gdb/symfile.h b/gdb/symfile.h
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -352,6 +352,7 @@ extern void generic_load (const char *args, int from_tty);
@@ -367,6 +367,7 @@ extern void generic_load (const char *args, int from_tty);
/* build-id support. */
extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr);
extern void debug_print_missing (const char *binary, const char *debug);

View File

@ -14,7 +14,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1339862
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1321,14 +1321,28 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
@@ -1320,14 +1320,28 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
}
{
@ -45,7 +45,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
if (build_id != NULL)
{
char *name, *build_id_filename;
@@ -1343,23 +1357,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
@@ -1342,23 +1356,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
xfree (name);
}
else

View File

@ -9,7 +9,7 @@ Subject: gdb-6.6-buildid-locate.patch
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -115,7 +115,7 @@ static inline char *
@@ -110,7 +110,7 @@ static inline char *
bfd_strdup (const char *str)
{
size_t len = strlen (str) + 1;
@ -21,7 +21,7 @@ diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -121,7 +121,7 @@ static inline char *
@@ -116,7 +116,7 @@ static inline char *
bfd_strdup (const char *str)
{
size_t len = strlen (str) + 1;
@ -33,7 +33,7 @@ diff --git a/bfd/libbfd.h b/bfd/libbfd.h
diff --git a/gdb/build-id.c b/gdb/build-id.c
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -24,13 +24,71 @@
@@ -24,14 +24,72 @@
#include "gdbsupport/gdb_vecs.h"
#include "symfile.h"
#include "objfiles.h"
@ -46,6 +46,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+#include "gdb_bfd.h"
+#include "gdbcmd.h"
#include "gdbcore.h"
#include "cli/cli-style.h"
+#include "inferior.h"
+#include "objfiles.h"
+#include "observable.h"
@ -104,9 +105,9 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
-build_id_bfd_get (bfd *abfd)
+build_id_bfd_shdr_get (bfd *abfd)
{
if (!bfd_check_format (abfd, bfd_object)
&& !bfd_check_format (abfd, bfd_core))
@@ -43,6 +101,348 @@ build_id_bfd_get (bfd *abfd)
/* Dynamic objfiles such as ones created by JIT reader API
have no underlying bfd structure (that is, objfile->obfd
@@ -50,6 +108,348 @@ build_id_bfd_get (bfd *abfd)
return NULL;
}
@ -455,7 +456,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
/* See build-id.h. */
int
@@ -51,7 +451,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
@@ -58,7 +458,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
const struct bfd_build_id *found;
int retval = 0;
@ -464,7 +465,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
if (found == NULL)
warning (_("File \"%s\" has no build-id, file skipped"),
@@ -66,63 +466,166 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
@@ -73,63 +473,166 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
return retval;
}
@ -561,8 +562,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
- if (separate_debug_file_debug)
- gdb_printf (gdb_stdlog, _(" no, unable to open.\n"));
+ struct stat statbuf_trash;
- return {};
+
+ /* `access' automatically dereferences LINK. */
+ if (lstat (link.c_str (), &statbuf_trash) != 0)
+ {
@ -597,7 +597,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ {
+ if (separate_debug_file_debug)
+ gdb_printf (gdb_stdlog, _(" no, unable to open.\n"));
+
- return {};
+ continue;
+ }
+
@ -628,13 +629,13 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ /* If none of the real files is found report as missing file
+ always the non-.%u-suffixed file. */
+ std::string link0 = orig_link;
+
- return {};
+ /* If the symlink has target request to install the target.
+ BASE-debuginfo.rpm contains the symlink but BASE.rpm may be missing.
+ https://bugzilla.redhat.com/show_bug.cgi?id=981154 */
+ std::string link0_resolved (link_resolve (link0.c_str (), 0));
- return {};
+
+ if (link_all.empty ())
+ link_all = link0_resolved;
+ else
@ -664,7 +665,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
}
/* Common code for finding BFDs of a given build-id. This function
@@ -131,7 +634,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
@@ -138,7 +641,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
static gdb_bfd_ref_ptr
build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
@ -673,7 +674,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
{
/* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
cause "/.build-id/..." lookups. */
@@ -154,16 +657,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
@@ -161,16 +664,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
if (size > 0)
{
size--;
@ -694,7 +695,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
if (debug_bfd != NULL)
return debug_bfd;
@@ -174,7 +678,7 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
@@ -181,7 +685,7 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
if (!gdb_sysroot.empty ())
{
link = gdb_sysroot + link;
@ -703,7 +704,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
if (debug_bfd != NULL)
return debug_bfd;
}
@@ -183,30 +687,660 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
@@ -190,31 +694,663 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
return {};
}
@ -721,6 +722,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ return result;
+}
+
+void debug_flush_missing (void);
+
+#ifdef HAVE_LIBRPM
+
+#include <rpm/rpmlib.h>
@ -1220,7 +1223,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+}
+
+static void
+debug_print_executable_changed (void)
+debug_print_executable_changed (struct program_space *pspace, bool reload_p)
+{
+#ifdef HAVE_LIBRPM
+ missing_rpm_change ();
@ -1356,9 +1359,10 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
/* See build-id.h. */
std::string
-find_separate_debug_file_by_buildid (struct objfile *objfile)
+find_separate_debug_file_by_buildid (struct objfile *objfile,
+ gdb::unique_xmalloc_ptr<char> *build_id_filename_return)
find_separate_debug_file_by_buildid (struct objfile *objfile,
- deferred_warnings *warnings)
+ deferred_warnings *warnings,
+ gdb::unique_xmalloc_ptr<char> *build_id_filename_return)
{
const struct bfd_build_id *build_id;
@ -1370,7 +1374,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
if (build_id != NULL)
{
if (separate_debug_file_debug)
@@ -214,8 +1348,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
@@ -222,8 +1358,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile,
_("\nLooking for separate debug info (build-id) for "
"%s\n"), objfile_name (objfile));
@ -1393,7 +1397,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
/* Prevent looping on a stripped .debug file. */
if (abfd != NULL
&& filename_cmp (bfd_get_filename (abfd.get ()),
@@ -228,3 +1375,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
@@ -243,3 +1392,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile,
return std::string ();
}
@ -1432,7 +1436,7 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h
/* Return true if ABFD has NT_GNU_BUILD_ID matching the CHECK value.
Otherwise, issue a warning and return false. */
@@ -38,21 +39,26 @@ extern int build_id_verify (bfd *abfd,
@@ -38,14 +39,19 @@ extern int build_id_verify (bfd *abfd,
can be found, return NULL. */
extern gdb_bfd_ref_ptr build_id_to_debug_bfd (size_t build_id_len,
@ -1454,35 +1458,35 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h
/* Find the separate debug file for OBJFILE, by using the build-id
associated with OBJFILE's BFD. If successful, returns the file name for the
separate debug file, otherwise, return an empty string. */
@@ -58,7 +64,8 @@ extern gdb_bfd_ref_ptr build_id_to_exec_bfd (size_t build_id_len,
will be printed. */
-extern std::string find_separate_debug_file_by_buildid
- (struct objfile *objfile);
+extern std::string find_separate_debug_file_by_buildid (struct objfile *objfile,
+ gdb::unique_xmalloc_ptr<char> *build_id_filename_return);
extern std::string find_separate_debug_file_by_buildid
- (struct objfile *objfile, deferred_warnings *warnings);
+ (struct objfile *objfile, deferred_warnings *warnings,
+ gdb::unique_xmalloc_ptr<char> *build_id_filename_return);
/* Return an hex-string representation of BUILD_ID. */
diff --git a/gdb/coffread.c b/gdb/coffread.c
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -734,7 +734,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
/* Try to add separate debug file if no symbols table found. */
if (!objfile->has_partial_symbols ())
@@ -729,7 +729,7 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
{
- std::string debugfile = find_separate_debug_file_by_buildid (objfile);
+ std::string debugfile = find_separate_debug_file_by_buildid (objfile,
+ NULL);
deferred_warnings warnings;
std::string debugfile
- = find_separate_debug_file_by_buildid (objfile, &warnings);
+ = find_separate_debug_file_by_buildid (objfile, &warnings, NULL);
if (debugfile.empty ())
debugfile = find_separate_debug_file_by_debuglink (objfile);
debugfile
diff --git a/gdb/corelow.c b/gdb/corelow.c
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -22,6 +22,10 @@
#include <signal.h>
#include <fcntl.h>
#include "frame.h" /* required by inferior.h */
#include "frame.h"
+#include "auxv.h"
+#include "build-id.h"
+#include "elf/common.h"
@ -1490,7 +1494,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
#include "inferior.h"
#include "infrun.h"
#include "symtab.h"
@@ -391,6 +395,8 @@ add_to_thread_list (asection *asect, asection *reg_sect)
@@ -380,6 +384,8 @@ add_to_thread_list (asection *asect, asection *reg_sect, inferior *inf)
switch_to_thread (thr); /* Yes, make it current. */
}
@ -1499,7 +1503,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
/* Issue a message saying we have no core to debug, if FROM_TTY. */
static void
@@ -427,12 +433,14 @@ core_file_command (const char *filename, int from_tty)
@@ -563,12 +569,14 @@ rename_vmcore_idle_reg_sections (bfd *abfd, inferior *inf)
static void
locate_exec_from_corefile_build_id (bfd *abfd, int from_tty)
{
@ -1516,7 +1520,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
if (execbfd == nullptr)
{
@@ -460,7 +468,12 @@ locate_exec_from_corefile_build_id (bfd *abfd, int from_tty)
@@ -596,7 +604,12 @@ locate_exec_from_corefile_build_id (bfd *abfd, int from_tty)
exec_file_attach (bfd_get_filename (execbfd.get ()), from_tty);
symbol_file_add_main (bfd_get_filename (execbfd.get ()),
symfile_add_flag (from_tty ? SYMFILE_VERBOSE : 0));
@ -1529,7 +1533,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
}
/* See gdbcore.h. */
@@ -1325,4 +1338,11 @@ _initialize_corelow ()
@@ -1506,4 +1519,11 @@ _initialize_corelow ()
maintenance_print_core_file_backed_mappings,
_("Print core file's file-backed mappings."),
&maintenanceprintlist);
@ -1544,7 +1548,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -22037,6 +22037,27 @@ information files.
@@ -22296,6 +22296,27 @@ information files.
@end table
@ -1575,16 +1579,16 @@ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
--- a/gdb/dwarf2/index-cache.c
+++ b/gdb/dwarf2/index-cache.c
@@ -101,7 +101,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
@@ -96,7 +96,7 @@ index_cache_store_context::index_cache_store_context (const index_cache &ic,
return;
/* Get build id of objfile. */
- const bfd_build_id *build_id = build_id_bfd_get (obj->obfd.get ());
+ const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd.get ());
- const bfd_build_id *build_id = build_id_bfd_get (per_bfd->obfd);
+ const bfd_build_id *build_id = build_id_bfd_shdr_get (per_bfd->obfd);
if (build_id == nullptr)
{
index_cache_debug ("objfile %s has no build id",
@@ -118,7 +118,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
@@ -111,7 +111,8 @@ index_cache_store_context::index_cache_store_context (const index_cache &ic,
if (dwz != nullptr)
{
@ -1597,7 +1601,7 @@ diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -5328,7 +5328,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
@@ -3355,7 +3355,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
static gdb::array_view<const gdb_byte>
get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
{
@ -1606,7 +1610,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
if (build_id == nullptr)
return {};
@@ -5341,7 +5341,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
@@ -3368,7 +3368,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
static gdb::array_view<const gdb_byte>
get_gdb_index_contents_from_cache_dwz (objfile *obj, dwz_file *dwz)
{
@ -1618,18 +1622,19 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
diff --git a/gdb/elfread.c b/gdb/elfread.c
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -1213,7 +1213,9 @@ elf_symfile_read_dwarf2 (struct objfile *objfile,
&& objfile->separate_debug_objfile == NULL
&& objfile->separate_debug_objfile_backlink == NULL)
@@ -1220,8 +1220,10 @@ elf_symfile_read_dwarf2 (struct objfile *objfile,
{
- std::string debugfile = find_separate_debug_file_by_buildid (objfile);
deferred_warnings warnings;
+ gdb::unique_xmalloc_ptr<char> build_id_filename;
+ std::string debugfile
+ = find_separate_debug_file_by_buildid (objfile, &build_id_filename);
std::string debugfile
- = find_separate_debug_file_by_buildid (objfile, &warnings);
+ = find_separate_debug_file_by_buildid (objfile, &warnings,
+ &build_id_filename);
if (debugfile.empty ())
debugfile = find_separate_debug_file_by_debuglink (objfile);
@@ -1229,7 +1231,7 @@ elf_symfile_read_dwarf2 (struct objfile *objfile,
debugfile = find_separate_debug_file_by_debuglink (objfile, &warnings);
@@ -1239,7 +1241,7 @@ elf_symfile_read_dwarf2 (struct objfile *objfile,
{
has_dwarf2 = false;
const struct bfd_build_id *build_id
@ -1638,7 +1643,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
const char *filename = bfd_get_filename (objfile->obfd.get ());
if (build_id != nullptr)
@@ -1256,6 +1258,11 @@ elf_symfile_read_dwarf2 (struct objfile *objfile,
@@ -1265,6 +1267,11 @@ elf_symfile_read_dwarf2 (struct objfile *objfile,
has_dwarf2 = true;
}
}
@ -1649,7 +1654,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
+ debug_print_missing (objfile_name (objfile), build_id_filename.get ());
}
}
}
/* If all the methods to collect the debuginfo failed, print the
diff --git a/gdb/exec.c b/gdb/exec.c
--- a/gdb/exec.c
+++ b/gdb/exec.c
@ -1674,8 +1679,8 @@ diff --git a/gdb/exec.c b/gdb/exec.c
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -786,6 +786,10 @@ struct objfile
bool skip_jit_symbol_lookup = false;
@@ -884,6 +884,10 @@ struct objfile
bool object_format_has_copy_relocs = false;
};
+/* This file was loaded according to the BUILD_ID_CORE_LOADS rules. */
@ -1709,7 +1714,7 @@ diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -45,6 +45,7 @@
@@ -44,6 +44,7 @@
#include "auxv.h"
#include "gdb_bfd.h"
#include "probe.h"
@ -1717,7 +1722,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
#include <map>
@@ -1319,9 +1320,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
@@ -1318,9 +1319,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
continue;
}
@ -1775,7 +1780,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
diff --git a/gdb/source.c b/gdb/source.c
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1196,7 +1196,7 @@ open_source_file (struct symtab *s)
@@ -1167,7 +1167,7 @@ open_source_file (struct symtab *s)
}
const struct bfd_build_id *build_id
@ -1787,7 +1792,7 @@ diff --git a/gdb/source.c b/gdb/source.c
diff --git a/gdb/symfile.h b/gdb/symfile.h
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -342,12 +342,18 @@ bool expand_symtabs_matching
@@ -357,12 +357,18 @@ bool expand_symtabs_matching
void map_symbol_filenames (gdb::function_view<symbol_filename_ftype> fun,
bool need_fullname);
@ -1809,7 +1814,7 @@ diff --git a/gdb/symfile.h b/gdb/symfile.h
diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp
--- a/gdb/testsuite/gdb.base/corefile.exp
+++ b/gdb/testsuite/gdb.base/corefile.exp
@@ -349,3 +349,33 @@ gdb_test_multiple "core-file $corefile" $test {
@@ -347,3 +347,33 @@ gdb_test_multiple "core-file $corefile" $test {
pass $test
}
}
@ -1846,7 +1851,7 @@ diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefi
diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp
--- a/gdb/testsuite/gdb.base/gdbinit-history.exp
+++ b/gdb/testsuite/gdb.base/gdbinit-history.exp
@@ -185,7 +185,8 @@ proc test_empty_history_filename { } {
@@ -179,7 +179,8 @@ proc test_empty_history_filename { } {
global env
global gdb_prompt
@ -1870,17 +1875,17 @@ diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -217,7 +217,8 @@ if ![info exists INTERNAL_GDBFLAGS] {
"-nw" \
@@ -226,7 +226,8 @@ if ![info exists INTERNAL_GDBFLAGS] {
"-nx" \
"-q" \
{-iex "set height 0"} \
- {-iex "set width 0"}]]
+ {-iex "set width 0"} \
+ {-iex "set build-id-verbose 0"}]]
set INTERNAL_GDBFLAGS [append_gdb_data_directory_option $INTERNAL_GDBFLAGS]
}
@@ -2349,6 +2350,17 @@ proc default_gdb_start { } {
# If DEBUGINFOD_URLS is set, gdb will try to download sources and
# debug info for f.i. system libraries. Prevent this.
@@ -2434,6 +2435,17 @@ proc default_gdb_start { } {
}
}
@ -1901,7 +1906,7 @@ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -330,6 +330,16 @@ proc default_mi_gdb_start { { flags {} } } {
@@ -321,6 +321,16 @@ proc default_mi_gdb_start { { flags {} } } {
warning "Couldn't set the width to 0."
}
}

View File

@ -9,7 +9,7 @@ Subject: gdb-6.6-testsuite-timeouts.patch
diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
--- a/gdb/testsuite/gdb.base/annota1.exp
+++ b/gdb/testsuite/gdb.base/annota1.exp
@@ -39,6 +39,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
@@ -37,6 +37,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
clean_restart ${binfile}
@ -21,7 +21,7 @@ diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1
diff --git a/gdb/testsuite/gdb.base/annota3.exp b/gdb/testsuite/gdb.base/annota3.exp
--- a/gdb/testsuite/gdb.base/annota3.exp
+++ b/gdb/testsuite/gdb.base/annota3.exp
@@ -38,6 +38,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
@@ -36,6 +36,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
clean_restart ${binfile}

View File

@ -1,24 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Wed, 11 Jan 2023 12:13:46 +0000
Subject: gdb-binutils29988-read_indexed_address.patch
;; Backport "Fix a potential illegal memory access in the BFD library..."
;; (Nick Clifton, binutils/29988)
PR 29988
* dwarf2.c (read_indexed_address): Fix check for an out of range
offset.
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1412,7 +1412,7 @@ read_indexed_address (uint64_t idx, struct comp_unit *unit)
offset += unit->dwarf_addr_offset;
if (offset < unit->dwarf_addr_offset
|| offset > file->dwarf_addr_size
- || file->dwarf_addr_size - offset < unit->offset_size)
+ || file->dwarf_addr_size - offset < unit->addr_size)
return 0;
info_ptr = file->dwarf_addr_buffer + offset;

View File

@ -1,188 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Andrew Burgess <aburgess@redhat.com>
Date: Tue, 20 Jun 2023 09:46:35 +0100
Subject: gdb-bz2196395-debuginfod-legacy-openssl-crash.patch
;; Backport upstream commit f3eee5861743d635 to fix a crash triggered
;; when debuginfod makes use of particular openssl settings.
gdb/debuginfod: cleanup debuginfod earlier
A GDB crash was discovered on Fedora GDB that was tracked back to an
issue with the way that debuginfod is cleaned up.
The bug was reported on Fedora 37, 38, and 39. Here are the steps to
reproduce:
1. The file /etc/ssl/openssl.cnf contains the following lines:
[provider_sect]
default = default_sect
##legacy = legacy_sect
##
[default_sect]
activate = 1
##[legacy_sect]
##activate = 1
The bug will occur when the '##' characters are removed so that the
lines in question look like this:
[provider_sect]
default = default_sect
legacy = legacy_sect
[default_sect]
activate = 1
[legacy_sect]
activate = 1
2. Clean up any existing debuginfod cache data:
> rm -rf $HOME/.cache/debuginfod_client
3. Run GDB:
> gdb -nx -q -iex 'set trace-commands on' \
-iex 'set debuginfod enabled on' \
-iex 'set confirm off' \
-ex 'start' -ex 'quit' /bin/ls
+set debuginfod enabled on
+set confirm off
Reading symbols from /bin/ls...
Downloading separate debug info for /usr/bin/ls
... snip ...
Temporary breakpoint 1, main (argc=1, argv=0x7fffffffde38) at ../src/ls.c:1646
1646 {
+quit
Fatal signal: Segmentation fault
----- Backtrace -----
... snip ...
So GDB ends up crashing during exit.
What's happening is that when debuginfod is initialised
debuginfod_begin is called (this is in the debuginfod library), this
in turn sets up libcurl, which makes use of openssl. Somewhere during
this setup process an at_exit function is registered to cleanup some
state.
Back in GDB the debuginfod_client object is managed using this code:
/* Deleter for a debuginfod_client. */
struct debuginfod_client_deleter
{
void operator() (debuginfod_client *c)
{
debuginfod_end (c);
}
};
using debuginfod_client_up
= std::unique_ptr<debuginfod_client, debuginfod_client_deleter>;
And then a global debuginfod_client_up is created to hold a pointer to
the debuginfod_client object. As a global this will be cleaned up
using the standard C++ global object destructor mechanism, which is
run after the at_exit handlers.
However, it is expected that when debuginfod_end is called the
debuginfod_client object will still be in a usable state, that is, we
don't expect the at_exit handlers to have run and started cleaning up
the library state.
To fix this issue we need to ensure that debuginfod_end is called
before the at_exit handlers have a chance to run.
This commit removes the debuginfod_client_up type, and instead has GDB
hold a raw pointer to the debuginfod_client object. We then make use
of GDB's make_final_cleanup to register a function that will call
debuginfod_end.
As GDB's final cleanups are called before exit is called, this means
that debuginfod_end will be called before the at_exit handlers are
called, and the crash identified above is resolved.
It's not obvious how this issue can easily be tested for. The bug does
not appear to manifest when using a local debuginfod server, so we'd
need to setup something more involved. For now I'm proposing this
patch without any associated tests.
diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
--- a/gdb/debuginfod-support.c
+++ b/gdb/debuginfod-support.c
@@ -96,20 +96,6 @@ struct user_data
ui_out::progress_update progress;
};
-/* Deleter for a debuginfod_client. */
-
-struct debuginfod_client_deleter
-{
- void operator() (debuginfod_client *c)
- {
- debuginfod_end (c);
- }
-};
-
-using debuginfod_client_up
- = std::unique_ptr<debuginfod_client, debuginfod_client_deleter>;
-
-
/* Convert SIZE into a unit suitable for use with progress updates.
SIZE should in given in bytes and will be converted into KB, MB, GB
or remain unchanged. UNIT will be set to "B", "KB", "MB" or "GB"
@@ -180,20 +166,45 @@ progressfn (debuginfod_client *c, long cur, long total)
return 0;
}
+/* Cleanup ARG, which is a debuginfod_client pointer. */
+
+static void
+cleanup_debuginfod_client (void *arg)
+{
+ debuginfod_client *client = static_cast<debuginfod_client *> (arg);
+ debuginfod_end (client);
+}
+
+/* Return a pointer to the single global debuginfod_client, initialising it
+ first if needed. */
+
static debuginfod_client *
get_debuginfod_client ()
{
- static debuginfod_client_up global_client;
+ static debuginfod_client *global_client = nullptr;
if (global_client == nullptr)
{
- global_client.reset (debuginfod_begin ());
+ global_client = debuginfod_begin ();
if (global_client != nullptr)
- debuginfod_set_progressfn (global_client.get (), progressfn);
+ {
+ /* It is important that we cleanup the debuginfod_client object
+ before calling exit. Some of the libraries used by debuginfod
+ make use of at_exit handlers to perform cleanup.
+
+ If we wrapped the debuginfod_client in a unique_ptr and relied
+ on its destructor to cleanup then this would be run as part of
+ the global C++ object destructors, which is after the at_exit
+ handlers, which is too late.
+
+ So instead, we make use of GDB's final cleanup mechanism. */
+ make_final_cleanup (cleanup_debuginfod_client, global_client);
+ debuginfod_set_progressfn (global_client, progressfn);
+ }
}
- return global_client.get ();
+ return global_client;
}
/* Check if debuginfod is enabled. If configured to do so, ask the user

View File

@ -1,68 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Andrew Burgess <aburgess@redhat.com>
Date: Thu, 14 Sep 2023 13:06:26 +0100
Subject: gdb-bz2237392-dwarf-obstack-allocation.patch
;; Backport upstream commit 54392c4df604f20 to fix an incorrect
;; obstack allocation that wold lead to memory corruption.
gdb: fix buffer overflow in DWARF reader
In this commit:
commit 48ac197b0c209ccf1f2de9704eb6cdf7c5c73a8e
Date: Fri Nov 19 10:12:44 2021 -0700
Handle multiple addresses in call_site_target
a buffer overflow bug was introduced when the following code was
added:
CORE_ADDR *saved = XOBNEWVAR (&objfile->objfile_obstack, CORE_ADDR,
addresses.size ());
std::copy (addresses.begin (), addresses.end (), saved);
The definition of XOBNEWVAR is (from libiberty.h):
#define XOBNEWVAR(O, T, S) ((T *) obstack_alloc ((O), (S)))
So 'saved' is going to point to addresses.size () bytes of memory,
however, the std::copy will write addresses.size () number of
CORE_ADDR sized entries to the address pointed to by 'saved', this is
going to result in memory corruption.
The mistake is that we should have used XOBNEWVEC, which allocates a
vector of entries, the definition of XOBNEWVEC is:
#define XOBNEWVEC(O, T, N) \
((T *) obstack_alloc ((O), sizeof (T) * (N)))
Which means we will have set aside enough space to create a copy of
the contents of the addresses vector.
I'm not sure how to create a test for this problem, this issue cropped
up when debugging a particular i686 built binary, which just happened
to trigger a glibc assertion (likely due to random memory corruption),
debugging the same binary built for x86-64 appeared to work just fine.
Using valgrind on the failing GDB binary pointed straight to the cause
of the problem, and with this patch in place there are no longer
valgrind errors in this area.
If anyone has ideas for a test I'm happy to work on something.
Co-Authored-By: Keith Seitz <keiths@redhat.com>
Approved-By: Tom Tromey <tom@tromey.com>
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -12506,7 +12506,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
std::vector<CORE_ADDR> addresses;
dwarf2_ranges_read_low_addrs (ranges_offset, target_cu,
target_die->tag, addresses);
- CORE_ADDR *saved = XOBNEWVAR (&objfile->objfile_obstack, CORE_ADDR,
+ CORE_ADDR *saved = XOBNEWVEC (&objfile->objfile_obstack, CORE_ADDR,
addresses.size ());
std::copy (addresses.begin (), addresses.end (), saved);
call_site->target.set_loc_array (addresses.size (), saved);

View File

@ -1,102 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Tom Tromey <tromey@adacore.com>
Date: Tue, 6 Dec 2022 12:07:12 -0700
Subject: gdb-bz2237515-debuginfod-double-free.patch
;; Backport upstream commit f96328accde1e63 to fix a potential double
;; free issue in the debuginfod code.
Avoid double-free with debuginfod
PR gdb/29257 points out a possible double free when debuginfod is in
use. Aside from some ugly warts in the symbol code (an ongoing
issue), the underlying issue in this particular case is that elfread.c
seems to assume that symfile_bfd_open will return NULL on error,
whereas in reality it throws an exception. As this code isn't
prepared for an exception, bad things result.
This patch fixes the problem by introducing a non-throwing variant of
symfile_bfd_open and using it in the affected places.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29257
diff --git a/gdb/elfread.c b/gdb/elfread.c
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -1222,10 +1222,12 @@ elf_symfile_read_dwarf2 (struct objfile *objfile,
if (!debugfile.empty ())
{
- gdb_bfd_ref_ptr debug_bfd (symfile_bfd_open (debugfile.c_str ()));
+ gdb_bfd_ref_ptr debug_bfd
+ (symfile_bfd_open_no_error (debugfile.c_str ()));
- symbol_file_add_separate (debug_bfd, debugfile.c_str (),
- symfile_flags, objfile);
+ if (debug_bfd != nullptr)
+ symbol_file_add_separate (debug_bfd, debugfile.c_str (),
+ symfile_flags, objfile);
}
else
{
@@ -1245,13 +1247,12 @@ elf_symfile_read_dwarf2 (struct objfile *objfile,
if (fd.get () >= 0)
{
/* File successfully retrieved from server. */
- gdb_bfd_ref_ptr debug_bfd (symfile_bfd_open (symfile_path.get ()));
+ gdb_bfd_ref_ptr debug_bfd
+ (symfile_bfd_open_no_error (symfile_path.get ()));
- if (debug_bfd == nullptr)
- warning (_("File \"%s\" from debuginfod cannot be opened as bfd"),
- filename);
- else if (build_id_verify (debug_bfd.get (), build_id->size,
- build_id->data))
+ if (debug_bfd != nullptr
+ && build_id_verify (debug_bfd.get (), build_id->size,
+ build_id->data))
{
symbol_file_add_separate (debug_bfd, symfile_path.get (),
symfile_flags, objfile);
diff --git a/gdb/symfile.c b/gdb/symfile.c
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1744,6 +1744,23 @@ symfile_bfd_open (const char *name)
return sym_bfd;
}
+/* See symfile.h. */
+
+gdb_bfd_ref_ptr
+symfile_bfd_open_no_error (const char *name) noexcept
+{
+ try
+ {
+ return symfile_bfd_open (name);
+ }
+ catch (const gdb_exception_error &err)
+ {
+ warning ("%s", err.what ());
+ }
+
+ return nullptr;
+}
+
/* Return the section index for SECTION_NAME on OBJFILE. Return -1 if
the section was not found. */
diff --git a/gdb/symfile.h b/gdb/symfile.h
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -269,6 +269,11 @@ extern void set_initial_language (void);
extern gdb_bfd_ref_ptr symfile_bfd_open (const char *);
+/* Like symfile_bfd_open, but will not throw an exception on error.
+ Instead, it issues a warning and returns nullptr. */
+
+extern gdb_bfd_ref_ptr symfile_bfd_open_no_error (const char *) noexcept;
+
extern int get_section_index (struct objfile *, const char *);
extern int print_symbol_loading_p (int from_tty, int mainline, int full);

View File

@ -9,10 +9,10 @@ Subject: gdb-container-rh-pkg.patch
diff --git a/gdb/remote.c b/gdb/remote.c
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -14301,7 +14301,17 @@ remote_target::pid_to_exec_file (int pid)
@@ -14742,7 +14742,17 @@ remote_target::pid_to_exec_file (int pid)
char *annex = NULL;
if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE)
if (m_features.packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE)
- return NULL;
+ {
+ warning (_("Remote gdbserver does not support determining executable "

View File

@ -19,7 +19,7 @@ Date: Wed Sep 25 11:52:50 2013 +0000
diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/solib-symbol.exp
--- a/gdb/testsuite/gdb.base/solib-symbol.exp
+++ b/gdb/testsuite/gdb.base/solib-symbol.exp
@@ -29,6 +29,7 @@ set testfile "solib-symbol-main"
@@ -27,6 +27,7 @@ set testfile "solib-symbol-main"
set srcfile ${srcdir}/${subdir}/${testfile}.c
set binfile [standard_output_file ${testfile}]
set bin_flags [list debug shlib=${binfile_lib}]
@ -27,16 +27,14 @@ diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/so
if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
|| [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } {
@@ -66,8 +67,26 @@ gdb_test "br foo2" \
@@ -61,4 +62,28 @@ gdb_test "br foo2" \
"Breakpoint.*: foo2. .2 locations..*" \
"foo2 in mdlib"
-gdb_exit
+# Test GDB warns for shared libraris which have not been found.
-return 0
+
+gdb_test "info sharedlibrary" "/${libname}.*"
+
+clean_restart ${executable}
+gdb_breakpoint "main"
+gdb_run_cmd
@ -49,10 +47,12 @@ diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/so
+ pass $test
+ }
+}
+
+clean_restart ${executable}
+gdb_test_no_output "set solib-absolute-prefix /doESnotEXIST"
+gdb_breakpoint "main"
+gdb_run_cmd
+gdb_test "" "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\nBreakpoint \[0-9\]+, main .*" \
+ "warning for missing libraries"
+
gdb_exit

View File

@ -12,7 +12,269 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1270534
diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure
+++ b/gdb/configure
@@ -20916,6 +20916,7 @@ if test x"$prefer_curses" = xyes; then
@@ -780,9 +780,6 @@ ENABLE_BFD_64_BIT_TRUE
subdirs
RPM_LIBS
RPM_CFLAGS
-PKG_CONFIG_LIBDIR
-PKG_CONFIG_PATH
-PKG_CONFIG
GDB_DATADIR
DEBUGDIR
MAKEINFO_EXTRA_FLAGS
@@ -990,12 +987,12 @@ PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
MAKEINFO
MAKEINFOFLAGS
+RPM_CFLAGS
+RPM_LIBS
AMD_DBGAPI_CFLAGS
AMD_DBGAPI_LIBS
DEBUGINFOD_CFLAGS
DEBUGINFOD_LIBS
-RPM_CFLAGS
-RPM_LIBS
YACC
YFLAGS
ZSTD_CFLAGS
@@ -1684,11 +1681,11 @@ Optional Packages:
[--with-auto-load-dir]
--without-auto-load-safe-path
do not restrict auto-loaded files locations
+ --with-rpm query rpm database for missing debuginfos (yes/no,
+ def. auto=librpm.so)
--with-amd-dbgapi support for the amd-dbgapi target (yes / no / auto)
--with-debuginfod Enable debuginfo lookups with debuginfod
(auto/yes/no)
- --with-rpm query rpm database for missing debuginfos (yes/no,
- def. auto=librpm.so)
--with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
--with-curses use the curses library instead of the termcap
library
@@ -1761,6 +1758,8 @@ Some influential environment variables:
MAKEINFO Parent configure detects if it is of sufficient version.
MAKEINFOFLAGS
Parameters for MAKEINFO.
+ RPM_CFLAGS C compiler flags for RPM, overriding pkg-config
+ RPM_LIBS linker flags for RPM, overriding pkg-config
AMD_DBGAPI_CFLAGS
C compiler flags for AMD_DBGAPI, overriding pkg-config
AMD_DBGAPI_LIBS
@@ -1769,8 +1768,6 @@ Some influential environment variables:
C compiler flags for DEBUGINFOD, overriding pkg-config
DEBUGINFOD_LIBS
linker flags for DEBUGINFOD, overriding pkg-config
- RPM_CFLAGS C compiler flags for RPM, overriding pkg-config
- RPM_LIBS linker flags for RPM, overriding pkg-config
YACC The `Yet Another Compiler Compiler' implementation to use.
Defaults to the first program found out of: `bison -y', `byacc',
`yacc'.
@@ -11495,7 +11492,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11486 "configure"
+#line 11495 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11601,7 +11598,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11592 "configure"
+#line 11601 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -18102,8 +18099,8 @@ $as_echo_n "checking specific librpm version... " >&6; }
if test "$cross_compiling" = yes; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot run test program while cross compiling
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -18275,132 +18272,12 @@ $as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
$as_echo "no" >&6; }
LIBS="$save_LIBS"
if $DLOPEN_REQUIRE; then
- as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5
+ as_fn_error $? "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5
fi
-
-
-
-
-
-
-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- case $PKG_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_path_PKG_CONFIG"; then
- ac_pt_PKG_CONFIG=$PKG_CONFIG
- # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- case $ac_pt_PKG_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- ;;
-esac
-fi
-ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
-if test -n "$ac_pt_PKG_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
-$as_echo "$ac_pt_PKG_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_pt_PKG_CONFIG" = x; then
- PKG_CONFIG=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- PKG_CONFIG=$ac_pt_PKG_CONFIG
- fi
-else
- PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
-fi
-
-fi
-if test -n "$PKG_CONFIG"; then
- _pkg_min_version=0.9.0
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
-$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
- if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- PKG_CONFIG=""
- fi
-fi
-
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5
-$as_echo_n "checking for RPM... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rpm" >&5
+$as_echo_n "checking for rpm... " >&6; }
if test -n "$RPM_CFLAGS"; then
pkg_cv_RPM_CFLAGS="$RPM_CFLAGS"
@@ -18437,6 +18314,30 @@ fi
pkg_failed=untried
fi
+if test $pkg_failed = no; then
+ pkg_save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $pkg_cv_RPM_LIBS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+else
+ pkg_failed=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$pkg_save_LDFLAGS
+fi
+
if test $pkg_failed = yes; then
@@ -18531,7 +18432,7 @@ $as_echo "#define HAVE_LIBRPM 1" >>confdefs.h
LIBS="$LIBS $RPM_LIBS"
else
if $RPM_REQUIRE; then
- as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5
+ as_fn_error $? "$RPM_PKG_ERRORS" "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5
$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;}
@@ -21164,6 +21065,7 @@ if test x"$prefer_curses" = xyes; then
# search /usr/local/include, if ncurses is installed in /usr/local. A
# default installation of ncurses on alpha*-dec-osf* will lead to such
# a situation.
@ -20,7 +282,7 @@ diff --git a/gdb/configure b/gdb/configure
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing waddstr" >&5
$as_echo_n "checking for library containing waddstr... " >&6; }
if ${ac_cv_search_waddstr+:} false; then :
@@ -20940,7 +20941,7 @@ return waddstr ();
@@ -21188,7 +21090,7 @@ return waddstr ();
return 0;
}
_ACEOF
@ -29,7 +291,7 @@ diff --git a/gdb/configure b/gdb/configure
if test -z "$ac_lib"; then
ac_res="none required"
else
@@ -21014,6 +21015,7 @@ case $host_os in
@@ -21260,6 +21162,7 @@ case $host_os in
esac
# These are the libraries checked by Readline.
@ -37,7 +299,7 @@ diff --git a/gdb/configure b/gdb/configure
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5
$as_echo_n "checking for library containing tgetent... " >&6; }
if ${ac_cv_search_tgetent+:} false; then :
@@ -21038,7 +21040,7 @@ return tgetent ();
@@ -21284,7 +21187,7 @@ return tgetent ();
return 0;
}
_ACEOF
@ -49,17 +311,17 @@ diff --git a/gdb/configure b/gdb/configure
diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -705,7 +705,8 @@ if test x"$prefer_curses" = xyes; then
@@ -749,7 +749,8 @@ if test x"$prefer_curses" = xyes; then
# search /usr/local/include, if ncurses is installed in /usr/local. A
# default installation of ncurses on alpha*-dec-osf* will lead to such
# a situation.
- AC_SEARCH_LIBS(waddstr, [ncursesw ncurses cursesX curses])
- AC_SEARCH_LIBS(waddstr, [ncursesw ncurses cursesX curses],
+ # Fedora: Force libncursesw over libncurses to match the includes.
+ AC_SEARCH_LIBS(waddstr, [ncursesw])
if test "$ac_cv_search_waddstr" != no; then
curses_found=yes
@@ -747,7 +748,8 @@ case $host_os in
+ AC_SEARCH_LIBS(waddstr, [ncursesw],
[curses_found=yes
AC_DEFINE([HAVE_LIBCURSES], [1],
[Define to 1 if curses is enabled.])
@@ -789,7 +790,8 @@ case $host_os in
esac
# These are the libraries checked by Readline.

View File

@ -9,9 +9,9 @@ Subject: gdb-linux_perf-bundle.patch
diff --git a/gdb/gdb.c b/gdb/gdb.c
--- a/gdb/gdb.c
+++ b/gdb/gdb.c
@@ -20,11 +20,19 @@
#include "main.h"
@@ -21,6 +21,10 @@
#include "interps.h"
#include "run-on-main-thread.h"
+#ifdef PERF_ATTR_SIZE_VER5_BUNDLE
+extern "C" void __libipt_init(void);
@ -20,6 +20,8 @@ diff --git a/gdb/gdb.c b/gdb/gdb.c
int
main (int argc, char **argv)
{
@@ -32,6 +36,10 @@ main (int argc, char **argv)
struct captured_main_args args;
+#ifdef PERF_ATTR_SIZE_VER5_BUNDLE
@ -32,7 +34,7 @@ diff --git a/gdb/gdb.c b/gdb/gdb.c
diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h
--- a/gdb/nat/linux-btrace.h
+++ b/gdb/nat/linux-btrace.h
@@ -27,6 +27,177 @@
@@ -28,6 +28,177 @@
# include <linux/perf_event.h>
#endif
@ -213,7 +215,7 @@ diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h
diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4
--- a/gdbsupport/common.m4
+++ b/gdbsupport/common.m4
@@ -166,7 +166,7 @@ AC_DEFUN([GDB_AC_COMMON], [
@@ -168,7 +168,7 @@ AC_DEFUN([GDB_AC_COMMON], [
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
#include <linux/perf_event.h>
#ifndef PERF_ATTR_SIZE_VER5

View File

@ -206,7 +206,7 @@ diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
/* But it should still be a new element in the hash table. */
gdb_assert (slot->name == nullptr);
@@ -388,7 +437,7 @@ write_hash_table (mapped_symtab *symtab, data_buf &output, data_buf &cpool)
@@ -387,7 +436,7 @@ write_hash_table (mapped_symtab *symtab, data_buf &output, data_buf &cpool)
/* We add all the index vectors to the constant pool first, to
ensure alignment is ok. */
@ -215,7 +215,7 @@ diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
{
if (entry.name == NULL)
continue;
@@ -417,7 +466,7 @@ write_hash_table (mapped_symtab *symtab, data_buf &output, data_buf &cpool)
@@ -416,7 +465,7 @@ write_hash_table (mapped_symtab *symtab, data_buf &output, data_buf &cpool)
/* Now write out the hash table. */
std::unordered_map<c_str_view, offset_type, c_str_view_hasher> str_table;
@ -224,7 +224,7 @@ diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
{
offset_type str_off, vec_off;
@@ -1149,7 +1198,7 @@ write_cooked_index (cooked_index_vector *table,
@@ -1151,7 +1200,7 @@ write_cooked_index (cooked_index *table,
const auto it = cu_index_htab.find (entry->per_cu);
gdb_assert (it != cu_index_htab.cend ());
@ -233,16 +233,16 @@ diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
if (entry->per_cu->lang () == language_ada)
{
@@ -1169,7 +1218,7 @@ write_cooked_index (cooked_index_vector *table,
gdb, it has to use the encoded name, with any
suffixes stripped. */
std::string encoded = ada_encode (name, false);
- name = obstack_strdup (&symtab->m_string_obstack,
+ name = obstack_strdup (symtab->obstack (),
encoded.c_str ());
}
@@ -1159,7 +1208,7 @@ write_cooked_index (cooked_index *table,
gdb, it has to use the encoded name, with any
suffixes stripped. */
std::string encoded = ada_encode (name, false);
- name = obstack_strdup (&symtab->m_string_obstack,
+ name = obstack_strdup (symtab->obstack (),
encoded.c_str ());
}
@@ -1202,8 +1251,8 @@ write_cooked_index (cooked_index_vector *table,
else if (entry->per_cu->lang () == language_cplus
@@ -1191,8 +1240,8 @@ write_cooked_index (cooked_index *table,
else
kind = GDB_INDEX_SYMBOL_KIND_TYPE;
@ -253,7 +253,7 @@ diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
}
}
@@ -1281,8 +1330,6 @@ write_gdbindex (dwarf2_per_objfile *per_objfile,
@@ -1267,8 +1316,6 @@ write_gdbindex (dwarf2_per_bfd *per_bfd, cooked_index *table,
symtab.minimize ();
data_buf symtab_vec, constant_pool;

View File

@ -35,7 +35,7 @@ Approved-By: Tom Tromey <tom@tromey.com>
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -453,6 +453,11 @@ class c_str_view
@@ -452,6 +452,11 @@ class c_str_view
return strcmp (m_cstr, other.m_cstr) == 0;
}
@ -47,7 +47,7 @@ diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
/* Return the underlying C string. Note, the returned string is
only a reference with lifetime of this object. */
const char *c_str () const
@@ -770,10 +775,18 @@ class debug_names
@@ -771,10 +776,18 @@ class debug_names
}
for (size_t bucket_ix = 0; bucket_ix < bucket_hash.size (); ++bucket_ix)
{

View File

@ -138,7 +138,7 @@ diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
/* See class definition. */
void
@@ -1325,6 +1391,9 @@ write_gdbindex (dwarf2_per_objfile *per_objfile,
@@ -1311,6 +1377,9 @@ write_gdbindex (dwarf2_per_bfd *per_bfd, cooked_index *table,
for (auto map : table->get_addrmaps ())
write_address_map (map, addr_vec, cu_index_htab);
@ -206,8 +206,8 @@ diff --git a/gdb/testsuite/gdb.gdb/index-file.exp b/gdb/testsuite/gdb.gdb/index-
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -9274,6 +9274,21 @@ proc gdb_step_until { regexp {test_name ""} {max_steps 10} } {
}
@@ -10033,6 +10033,21 @@ proc is_target_non_stop { {testname ""} } {
return $is_non_stop
}
+# Return the number of worker threads that GDB is currently using.

View File

@ -1,105 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Kevin Buettner <kevinb@redhat.com>
Date: Mon, 2 Oct 2023 15:05:23 -0700
Subject: gdb-rhbz1773651-gdb-index-internal-error.patch
;; Backport upstream patch which prevents internal error when
;; generating a gdb-index file (RH BZ 1773651).
Throw error when creating an overly large gdb-index file
The header in a .gdb_index section uses 32-bit unsigned offsets to
refer to other areas of the section. Thus, there is a size limit of
2^32-1 which is currently unaccounted for by GDB's code for outputting
these sections.
At the moment, when GDB creates an overly large section, it will exit
abnormally due to an internal error, which is caused by a failed
assert in assert_file_size, which in turn is called from
write_gdbindex_1, both of which are in gdb/dwarf2/index-write.c.
This is what happens when that assert fails:
$ gdb -q -nx -iex 'set auto-load no' -iex 'set debuginfod enabled off' -ex file ./libgraph_tool_inference.so -ex "save gdb-index `pwd`/"
Reading symbols from ./libgraph_tool_inference.so...
No executable file now.
Discard symbol table from `libgraph_tool_inference.so'? (y or n) n
Not confirmed.
../../gdb/dwarf2/index-write.c:1069: internal-error: assert_file_size: Assertion `file_size == expected_size' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
----- Backtrace -----
0x55fddb4d78b0 gdb_internal_backtrace_1
../../gdb/bt-utils.c:122
0x55fddb4d78b0 _Z22gdb_internal_backtracev
../../gdb/bt-utils.c:168
0x55fddb98b5d4 internal_vproblem
../../gdb/utils.c:396
0x55fddb98b8de _Z15internal_verrorPKciS0_P13__va_list_tag
../../gdb/utils.c:476
0x55fddbb71654 _Z18internal_error_locPKciS0_z
../../gdbsupport/errors.cc:58
0x55fddb5a0f23 assert_file_size
../../gdb/dwarf2/index-write.c:1069
0x55fddb5a1ee0 assert_file_size
/usr/include/c++/13/bits/stl_iterator.h:1158
0x55fddb5a1ee0 write_gdbindex_1
../../gdb/dwarf2/index-write.c:1119
0x55fddb5a51be write_gdbindex
../../gdb/dwarf2/index-write.c:1273
[...]
---------------------
../../gdb/dwarf2/index-write.c:1069: internal-error: assert_file_size: Assertion `file_size == expected_size' failed.
This problem was encountered while building the python-graph-tool
package on Fedora. The Fedora bugzilla bug can be found here:
https://bugzilla.redhat.com/show_bug.cgi?id=1773651
This commit prevents the internal error from occurring by calling error()
when the file size exceeds 2^32-1.
Using a gdb built with this commit, I now see this behavior instead:
$ gdb -q -nx -iex 'set auto-load no' -iex 'set debuginfod enabled off' -ex file ./libgraph_tool_inference.so -ex "save gdb-index `pwd`/"
Reading symbols from ./libgraph_tool_inference.so...
No executable file now.
Discard symbol table from `/mesquite2/fedora-bugs/1773651/libgraph_tool_inference.so'? (y or n) n
Not confirmed.
Error while writing index for `/mesquite2/fedora-bugs/1773651/libgraph_tool_inference.so': gdb-index maximum file size of 4294967295 exceeded
(gdb)
I wish I could provide a test case, but due to the sizes of both the
input and output files, I think that testing resources would be
strained or exceeded in many environments.
My testing on Fedora 38 shows no regressions.
Approved-by: Tom Tromey <tom@tromey.com>
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -1082,7 +1082,7 @@ write_gdbindex_1 (FILE *out_file,
{
data_buf contents;
const offset_type size_of_header = 6 * sizeof (offset_type);
- offset_type total_len = size_of_header;
+ size_t total_len = size_of_header;
/* The version number. */
contents.append_offset (8);
@@ -1109,6 +1109,13 @@ write_gdbindex_1 (FILE *out_file,
gdb_assert (contents.size () == size_of_header);
+ /* The maximum size of an index file is limited by the maximum value
+ capable of being represented by 'offset_type'. Throw an error if
+ that length has been exceeded. */
+ size_t max_size = ~(offset_type) 0;
+ if (total_len > max_size)
+ error (_("gdb-index maximum file size of %zu exceeded"), max_size);
+
contents.file_write (out_file);
cu_list.file_write (out_file);
types_cu_list.file_write (out_file);

View File

@ -1,108 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Kevin Buettner <kevinb@redhat.com>
Date: Thu, 29 Jun 2023 18:20:30 -0700
Subject: gdb-rhbz2160211-excessive-core-file-warnings.patch
;; Backport two commits, 0ad504dd464 and ea70f941f9b, from Lancelot SIX
;; which prevent repeated warnings from being printed while loading a
;; core file. (RH BZ 2160211)
gdb/corelow.c: avoid repeated warnings in build_file_mappings
When GDB opens a coredump it tries to locate and then open all files
which were mapped in the process.
If a file is found but cannot be opened with BFD (bfd_open /
bfd_check_format fails), then a warning is printed to the user. If the
same file was mapped multiple times in the process's address space, the
warning is printed once for each time the file was mapped. I find this
un-necessarily noisy.
This patch makes it so the warning message is printed only once per
file.
There was a comment in the code assuming that if the file was found on
the system, opening it (bfd_open + bfd_check_format) should always
succeed. A recent change in BFD (014a602b86f "Don't optimise bfd_seek
to same position") showed that this assumption is not valid. For
example, it is possible to have a core dump of a process which had
mmaped an IO page from a DRI render node (/dev/dri/runderD$NUM). In
such case the core dump does contain the information that portions of
this special file were mapped in the host process, but trying to seek to
position 0 will fail, making bfd_check_format fail. This patch removes
this comment.
Reviewed-By: John Baldwin <jhb@FreeBSD.org>
Approved-By: Andrew Burgess <aburgess@redhat.com>
gdb/corelow.c: do not try to reopen a file if open failed once
In the current implementation, core_target::build_file_mappings will try
to locate and open files which were mapped in the process for which the
core dump was produced. If the file cannot be found or cannot be
opened, GDB will re-try to open it once for each time it was mapped in
the process's address space.
This patch makes it so GDB recognizes that it has already failed to open
a given file once and does not re-try the process for each mapping.
Reviewed-By: John Baldwin <jhb@FreeBSD.org>
Approved-By: Andrew Burgess <aburgess@redhat.com>
diff --git a/gdb/corelow.c b/gdb/corelow.c
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -237,6 +237,16 @@ core_target::build_file_mappings ()
weed out non-file-backed mappings. */
gdb_assert (filename != nullptr);
+ if (unavailable_paths.find (filename) != unavailable_paths.end ())
+ {
+ /* We have already seen some mapping for FILENAME but failed to
+ find/open the file. There is no point in trying the same
+ thing again so just record that the range [start, end) is
+ unavailable. */
+ m_core_unavailable_mappings.emplace_back (start, end - start);
+ return;
+ }
+
struct bfd *bfd = bfd_map[filename];
if (bfd == nullptr)
{
@@ -254,11 +264,10 @@ core_target::build_file_mappings ()
if (expanded_fname == nullptr)
{
m_core_unavailable_mappings.emplace_back (start, end - start);
- /* Print just one warning per path. */
- if (unavailable_paths.insert (filename).second)
- warning (_("Can't open file %s during file-backed mapping "
- "note processing"),
- filename);
+ unavailable_paths.insert (filename);
+ warning (_("Can't open file %s during file-backed mapping "
+ "note processing"),
+ filename);
return;
}
@@ -268,18 +277,11 @@ core_target::build_file_mappings ()
if (bfd == nullptr || !bfd_check_format (bfd, bfd_object))
{
m_core_unavailable_mappings.emplace_back (start, end - start);
- /* If we get here, there's a good chance that it's due to
- an internal error. We issue a warning instead of an
- internal error because of the possibility that the
- file was removed in between checking for its
- existence during the expansion in exec_file_find()
- and the calls to bfd_openr() / bfd_check_format().
- Output both the path from the core file note along
- with its expansion to make debugging this problem
- easier. */
+ unavailable_paths.insert (filename);
warning (_("Can't open file %s which was expanded to %s "
"during file-backed mapping note processing"),
filename, expanded_fname.get ());
+
if (bfd != nullptr)
bfd_close (bfd);
return;

View File

@ -1,107 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Kevin Buettner <kevinb@redhat.com>
Date: Wed, 3 May 2023 11:28:24 -0700
Subject: gdb-rhbz2192105-ftbs-dangling-pointer
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
;; Backport upstream patch fixing a "dangling pointer" build problem
;; first seen when building with GCC 13.1.1 20230426 (Red Hat ;; 13.1.1-1).
Pass const frame_info_ptr reference for skip_[language_]trampoline
g++ 13.1.1 produces a -Werror=dangling-pointer=
In file included from ../../binutils-gdb/gdb/frame.h:75,
from ../../binutils-gdb/gdb/symtab.h:40,
from ../../binutils-gdb/gdb/language.c:33:
In member function void intrusive_list<T, AsNode>::push_empty(T&) [with T = frame_info_ptr; AsNode = intrusive_base_node<frame_info_ptr>],
inlined from void intrusive_list<T, AsNode>::push_back(reference) [with T = frame_info_ptr; AsNode = intrusive_base_node<frame_info_ptr>] at gdbsupport/intrusive_list.h:332:24,
inlined from frame_info_ptr::frame_info_ptr(const frame_info_ptr&) at gdb/frame.h:241:26,
inlined from CORE_ADDR skip_language_trampoline(frame_info_ptr, CORE_ADDR) at gdb/language.c:530:49:
gdbsupport/intrusive_list.h:415:12: error: storing the address of local variable <anonymous> in frame_info_ptr::frame_list.intrusive_list<frame_info_ptr>::m_back [-Werror=dangling-pointer=]
415 | m_back = &elem;
| ~~~~~~~^~~~~~~
gdb/language.c: In function CORE_ADDR skip_language_trampoline(frame_info_ptr, CORE_ADDR):
gdb/language.c:530:49: note: <anonymous> declared here
530 | CORE_ADDR real_pc = lang->skip_trampoline (frame, pc);
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
gdb/frame.h:359:41: note: frame_info_ptr::frame_list declared here
359 | static intrusive_list<frame_info_ptr> frame_list;
| ^~~~~~~~~~
Each new frame_info_ptr is being pushed on a static frame list and g++
cannot see why that is safe in case the frame_info_ptr is created and
destroyed immediately when passed as value.
It isn't clear why only in this one place g++ sees the issue (probably
because it can inline enough code in this specific case).
Since passing the frame_info_ptr as const reference is cheaper, use
that as workaround for this warning.
PR build/30413
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30413
Tested-by: Kevin Buettner <kevinb@redhat.com>
Reviewed-by: Kevin Buettner <kevinb@redhat.com>
Reviewed-by: Tom Tromey <tom@tromey.com>
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -1003,7 +1003,7 @@ class cplus_language : public language_defn
/* See language.h. */
- CORE_ADDR skip_trampoline (frame_info_ptr fi,
+ CORE_ADDR skip_trampoline (const frame_info_ptr &fi,
CORE_ADDR pc) const override
{
return cplus_skip_trampoline (fi, pc);
diff --git a/gdb/language.c b/gdb/language.c
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -528,7 +528,7 @@ add_set_language_command ()
Return the result from the first that returns non-zero, or 0 if all
`fail'. */
CORE_ADDR
-skip_language_trampoline (frame_info_ptr frame, CORE_ADDR pc)
+skip_language_trampoline (const frame_info_ptr &frame, CORE_ADDR pc)
{
for (const auto &lang : language_defn::languages)
{
diff --git a/gdb/language.h b/gdb/language.h
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -471,7 +471,7 @@ struct language_defn
If that PC falls in a trampoline belonging to this language, return
the address of the first pc in the real function, or 0 if it isn't a
language tramp for this language. */
- virtual CORE_ADDR skip_trampoline (frame_info_ptr fi, CORE_ADDR pc) const
+ virtual CORE_ADDR skip_trampoline (const frame_info_ptr &fi, CORE_ADDR pc) const
{
return (CORE_ADDR) 0;
}
@@ -789,7 +789,7 @@ extern const char *language_str (enum language);
/* Check for a language-specific trampoline. */
-extern CORE_ADDR skip_language_trampoline (frame_info_ptr, CORE_ADDR pc);
+extern CORE_ADDR skip_language_trampoline (const frame_info_ptr &, CORE_ADDR pc);
/* Return demangled language symbol, or NULL. */
extern gdb::unique_xmalloc_ptr<char> language_demangle
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -282,7 +282,7 @@ class objc_language : public language_defn
/* See language.h. */
- CORE_ADDR skip_trampoline (frame_info_ptr frame,
+ CORE_ADDR skip_trampoline (const frame_info_ptr &frame,
CORE_ADDR stop_pc) const override
{
struct gdbarch *gdbarch = get_frame_arch (frame);

View File

@ -1,50 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= <ahajkova@redhat.com>
Date: Sun, 17 Sep 2023 13:36:13 +0200
Subject: gdb-rhbz2233961-CVE-2022-4806.patch
;; Backport PR29922, SHT_NOBITS section
;; avoids section size sanity check.
PR29922, SHT_NOBITS section avoids section size sanity check
PR 29922
* dwarf2.c (find_debug_info): Ignore sections without
SEC_HAS_CONTENTS.
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -4831,16 +4831,19 @@ find_debug_info (bfd *abfd, const struct dwarf_debug_section *debug_sections,
{
look = debug_sections[debug_info].uncompressed_name;
msec = bfd_get_section_by_name (abfd, look);
- if (msec != NULL)
+ /* Testing SEC_HAS_CONTENTS is an anti-fuzzer measure. Of
+ course debug sections always have contents. */
+ if (msec != NULL && (msec->flags & SEC_HAS_CONTENTS) != 0)
return msec;
look = debug_sections[debug_info].compressed_name;
msec = bfd_get_section_by_name (abfd, look);
- if (msec != NULL)
+ if (msec != NULL && (msec->flags & SEC_HAS_CONTENTS) != 0)
return msec;
for (msec = abfd->sections; msec != NULL; msec = msec->next)
- if (startswith (msec->name, GNU_LINKONCE_INFO))
+ if ((msec->flags & SEC_HAS_CONTENTS) != 0
+ && startswith (msec->name, GNU_LINKONCE_INFO))
return msec;
return NULL;
@@ -4848,6 +4851,9 @@ find_debug_info (bfd *abfd, const struct dwarf_debug_section *debug_sections,
for (msec = after_sec->next; msec != NULL; msec = msec->next)
{
+ if ((msec->flags & SEC_HAS_CONTENTS) == 0)
+ continue;
+
look = debug_sections[debug_info].uncompressed_name;
if (strcmp (msec->name, look) == 0)
return msec;

View File

@ -1,115 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= <ahajkova@redhat.com>
Date: Sun, 1 Oct 2023 10:36:06 +0200
Subject: gdb-rhbz2233965-memory-leak.patch
;; Backport PR29925, Memory leak in find_abstract_instance
PR29925, Memory leak in find_abstract_instance
The testcase in the PR had a variable with both DW_AT_decl_file and
DW_AT_specification, where the DW_AT_specification also specified
DW_AT_decl_file. This leads to a memory leak as the file name is
malloced and duplicates are not expected.
I've also changed find_abstract_instance to not use a temp for "name",
because that can result in a change in behaviour from the usual last
of duplicate attributes wins.
PR 29925
* dwarf2.c (find_abstract_instance): Delete "name" variable.
Free *filename_ptr before assigning new file name.
(scan_unit_for_symbols): Similarly free func->file and
var->file before assigning.
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -3441,7 +3441,6 @@ find_abstract_instance (struct comp_unit *unit,
struct abbrev_info *abbrev;
uint64_t die_ref = attr_ptr->u.val;
struct attribute attr;
- const char *name = NULL;
if (recur_count == 100)
{
@@ -3602,9 +3601,9 @@ find_abstract_instance (struct comp_unit *unit,
case DW_AT_name:
/* Prefer DW_AT_MIPS_linkage_name or DW_AT_linkage_name
over DW_AT_name. */
- if (name == NULL && is_str_form (&attr))
+ if (*pname == NULL && is_str_form (&attr))
{
- name = attr.u.str;
+ *pname = attr.u.str;
if (mangle_style (unit->lang) == 0)
*is_linkage = true;
}
@@ -3612,7 +3611,7 @@ find_abstract_instance (struct comp_unit *unit,
case DW_AT_specification:
if (is_int_form (&attr)
&& !find_abstract_instance (unit, &attr, recur_count + 1,
- &name, is_linkage,
+ pname, is_linkage,
filename_ptr, linenumber_ptr))
return false;
break;
@@ -3622,7 +3621,7 @@ find_abstract_instance (struct comp_unit *unit,
non-string forms into these attributes. */
if (is_str_form (&attr))
{
- name = attr.u.str;
+ *pname = attr.u.str;
*is_linkage = true;
}
break;
@@ -3630,8 +3629,11 @@ find_abstract_instance (struct comp_unit *unit,
if (!comp_unit_maybe_decode_line_info (unit))
return false;
if (is_int_form (&attr))
- *filename_ptr = concat_filename (unit->line_table,
- attr.u.val);
+ {
+ free (*filename_ptr);
+ *filename_ptr = concat_filename (unit->line_table,
+ attr.u.val);
+ }
break;
case DW_AT_decl_line:
if (is_int_form (&attr))
@@ -3643,7 +3645,6 @@ find_abstract_instance (struct comp_unit *unit,
}
}
}
- *pname = name;
return true;
}
@@ -4139,8 +4140,11 @@ scan_unit_for_symbols (struct comp_unit *unit)
case DW_AT_decl_file:
if (is_int_form (&attr))
- func->file = concat_filename (unit->line_table,
- attr.u.val);
+ {
+ free (func->file);
+ func->file = concat_filename (unit->line_table,
+ attr.u.val);
+ }
break;
case DW_AT_decl_line:
@@ -4182,8 +4186,11 @@ scan_unit_for_symbols (struct comp_unit *unit)
case DW_AT_decl_file:
if (is_int_form (&attr))
- var->file = concat_filename (unit->line_table,
- attr.u.val);
+ {
+ free (var->file);
+ var->file = concat_filename (unit->line_table,
+ attr.u.val);
+ }
break;
case DW_AT_decl_line:

View File

@ -53,11 +53,11 @@ Name: %{?scl_prefix}gdb
# See timestamp of source gnulib installed into gnulib/ .
%global snapgnulib 20220501
%global tarname gdb-%{version}
Version: 13.2
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: 12%{?dist}
Release: 1%{?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.
@ -639,9 +639,7 @@ COMMON_GDB_CONFIGURE_FLAGS="\
--without-mmap \
%endif
--enable-64-bit-bfd \
%if 0%{!?rhel:1} || 0%{?rhel} > 6
--with-mpfr \
%else
%if 0%{?rhel:1} && 0%{?rhel} <= 6
--without-mpfr \
%endif
--with-system-zlib \
@ -1252,6 +1250,33 @@ fi
%endif
%changelog
* Fri Dec 8 2023 Kevin Buettner <kevinb@redhat.com> - 14.1-1
- Rebase to FSF GDB 14.1.
- Update local patches:
gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
gdb-6.6-buildid-locate-rpm.patch
gdb-6.6-buildid-locate.patch
gdb-container-rh-pkg.patch
gdb-core-open-vdso-warning.patch
gdb-fedora-libncursesw.patch
gdb-linux_perf-bundle.patch
- Update backported patches which didn't make it into 14.1:
gdb-rhbz-2232086-cpp-ify-mapped-symtab.patch
gdb-rhbz-2232086-generate-gdb-index-consistently.patch
- Drop upstreamed local patches:
gdb-6.5-sharedlibrary-path.patch
- Drop gdb-13.2 backports (which are now in gdb-14.1):
gdb-binutils29988-read_indexed_address.patch
gdb-bz2196395-debuginfod-legacy-openssl-crash.patch
gdb-bz2237392-dwarf-obstack-allocation.patch
gdb-bz2237515-debuginfod-double-free.patch
gdb-rhbz2192105-ftbs-dangling-pointer
gdb-rhbz2233961-CVE-2022-4806.patch
gdb-rhbz2233965-memory-leak.patch
- Adjust gdb.spec so that --with-mpfr is no longer passed to
configure; doing so, combined with some configury changes triggered
a latent build problem.
* Mon Dec 4 2023 Kevin Buettner <kevinb@redhat.com>
- Remove gdb-6.5-missed-trap-on-step-test.patch. Testing what happens
when stepping over/through a statement which triggers a watchpoint

View File

@ -1,3 +1,3 @@
SHA512 (gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz) = a8b1c54dd348cfeb37da73f968742896be3dd13a4215f8d8519870c2abea915f5176c3fa6989ddd10f20020a16f0fab20cbae68ee8d58a82234d8778023520f8
SHA512 (v2.0.5.tar.gz) = 2e7ac2aede84671b15597d9c56dbe077a81357bbf44b6684802592246fb7729b4a5743238ddf02f6ea143b4d29872f581408135f9c1ea1ccc99dab905916d98d
SHA512 (gdb-13.2.tar.xz) = 8185d3e11ab60dafff5860a5016577bfe7dd7547ef01ebc867bc247603d82b74ff74c4f29492c7d2aee57076f52be33e289f4c6b414a4b870d4b3004909f4c34
SHA512 (gdb-14.1.tar.xz) = 575e198105076fc4a88f68591aa114ab9c1196e84386a3f7b9b58fe5f30cdeed33f6a5f957b68f08c47284ec922bb60c964627e238471419673fd913575ce427