Rebase to FSF GDB 13.1

Update gdb-6.3-rh-testversion-20041202.patch.
Update gdb-6.3-bz140532-ppc-unwinding-test.patch.
Update gdb-6.6-buildid-locate.patch.
Update gdb-6.6-buildid-locate-rpm.patch.
Remove 'Recommends: ' line for gcc-gdb-plugin for BZ2149246.
Add 'define _lto_cflags ' to avoid ODR violations.
Add -Wno-stringop-overflow to --enable-gdb-build-warnings to work around
  gcc problem.
This commit is contained in:
Kevin Buettner 2023-03-08 21:42:55 -07:00
parent 17914b3d53
commit 92d162c371
27 changed files with 249 additions and 30479 deletions

2
.gitignore vendored
View File

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

View File

@ -234,33 +234,3 @@ Patch054: gdb-libexec-add-index.patch
# =fedoratest # =fedoratest
Patch055: gdb-rhbz1553104-s390x-arch12-test.patch Patch055: gdb-rhbz1553104-s390x-arch12-test.patch
Patch056: gdb-backport-readline_support.patch
# [gdb/testsuite] Use prototype to call libc functions
# (Tom de Vries)
Patch057: gdb-backport-fix-break-main-file-remove-fail.patch
# Constify target_desc to fix PPC ODR violations.
# (Keith Seitz, build/22395)
Patch058: gdb-sw22395-constify-target_desc.patch
# libiberty: Fix C89-isms in configure tests
# (Florian Weimer, RHBZ 2143992)
Patch059: gdb-rhbz2143992-libiberty-fix-c89isms-in-configure.patch
Patch060: gdb-rhbz2152431-label-symbol-value.patch
#Backport replace deprecated distutils.sysconfig in
#python-config (Lancelot SIX)
Patch061: gdb-backport-python-config-replace-deprecated-distutils.patch
# gcc 13 fallout: Backport Jan-Benedict Glaw's fix for the self-move
# warning check
Patch062: gdb-gcc-13-backport-self-move-diagnostic-fix
# Backport "call check_typedef at beginning of dwarf_expr_context::fetch_result"
# (Simon Marchi, backtrace/29374)
Patch063: gdb-backport-call-check_typedef-at-beginning-of-dwarf_expr_context.patch

View File

@ -53,11 +53,3 @@
%patch053 -p1 %patch053 -p1
%patch054 -p1 %patch054 -p1
%patch055 -p1 %patch055 -p1
%patch056 -p1
%patch057 -p1
%patch058 -p1
%patch059 -p1
%patch060 -p1
%patch061 -p1
%patch062 -p1
%patch063 -p1

View File

@ -1 +1 @@
e53a8e8685685c97588f8319d993ea6cd5635e47 4f3e26ac6ee31f7bc4b04abd8bdb944e7f1fc5d2

View File

@ -53,11 +53,3 @@ gdb-container-rh-pkg.patch
gdb-linux_perf-bundle.patch gdb-linux_perf-bundle.patch
gdb-libexec-add-index.patch gdb-libexec-add-index.patch
gdb-rhbz1553104-s390x-arch12-test.patch gdb-rhbz1553104-s390x-arch12-test.patch
gdb-backport-readline_support.patch
gdb-backport-fix-break-main-file-remove-fail.patch
gdb-sw22395-constify-target_desc.patch
gdb-rhbz2143992-libiberty-fix-c89isms-in-configure.patch
gdb-rhbz2152431-label-symbol-value.patch
gdb-backport-python-config-replace-deprecated-distutils.patch
gdb-gcc-13-backport-self-move-diagnostic-fix
gdb-backport-call-check_typedef-at-beginning-of-dwarf_expr_context.patch

View File

@ -303,18 +303,3 @@ new file mode 100644
+ pass $test + pass $test
+ } + }
+} +}
diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue.exp b/gdb/testsuite/gdb.arch/powerpc-prologue.exp
--- a/gdb/testsuite/gdb.arch/powerpc-prologue.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-prologue.exp
@@ -16,8 +16,9 @@
# Test PowerPC prologue analyzer.
# Do not run on AIX (where we won't be able to build the tests without
-# some surgery) or on PowerPC64 (ditto, dot symbols).
-if {[istarget *-*-aix*] || ![istarget "powerpc-*-*"]} then {
+# some surgery). PowerPC64 target would break due to dot symbols but we build
+# there PowerPC32 inferior.
+if {[istarget *-*-aix*] || ![istarget "powerpc*-*-*"]} then {
verbose "Skipping PowerPC prologue tests."
return
}

View File

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

View File

@ -27,7 +27,7 @@ diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest
diff --git a/gdb/top.c b/gdb/top.c diff --git a/gdb/top.c b/gdb/top.c
--- a/gdb/top.c --- a/gdb/top.c
+++ b/gdb/top.c +++ b/gdb/top.c
@@ -2234,7 +2234,7 @@ init_gdb_version_vars (void) @@ -2382,7 +2382,7 @@ The second argument is the terminal the UI runs on."), &cmdlist);
struct internalvar *major_version_var = create_internalvar ("_gdb_major"); struct internalvar *major_version_var = create_internalvar ("_gdb_major");
struct internalvar *minor_version_var = create_internalvar ("_gdb_minor"); struct internalvar *minor_version_var = create_internalvar ("_gdb_minor");
int vmajor = 0, vminor = 0, vrevision = 0; int vmajor = 0, vminor = 0, vrevision = 0;

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 diff --git a/gdb/printcmd.c b/gdb/printcmd.c
--- a/gdb/printcmd.c --- a/gdb/printcmd.c
+++ b/gdb/printcmd.c +++ b/gdb/printcmd.c
@@ -1301,6 +1301,10 @@ process_print_command_args (const char *args, value_print_options *print_opts, @@ -1300,6 +1300,10 @@ process_print_command_args (const char *args, value_print_options *print_opts,
if (exp != nullptr && *exp) if (exp != nullptr && *exp)
{ {

View File

@ -1,6 +1,6 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Fedora GDB patches <invalid@email.com> From: Kevin Buettner <kevinb@redhat.com>
Date: Fri, 27 Oct 2017 21:07:50 +0200 Date: Wed, 22 Feb 2023 22:30:40 -0700
Subject: gdb-6.6-buildid-locate-rpm.patch Subject: gdb-6.6-buildid-locate-rpm.patch
;;=push+jan ;;=push+jan
@ -232,6 +232,40 @@ diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4
# AM_AUX_DIR_EXPAND -*- Autoconf -*- # AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2017 Free Software Foundation, Inc. # Copyright (C) 2001-2017 Free Software Foundation, Inc.
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)
static rpmts (*rpmtsCreate_p) (void);
extern rpmts rpmtsFree(rpmts ts);
static rpmts (*rpmtsFree_p) (rpmts ts);
- extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
+ extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag,
const void * keyp, size_t keylen);
static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts,
- rpmTag rpmtag,
+ rpmDbiTagVal rpmtag,
const void *keyp,
size_t keylen);
#else /* !DLOPEN_LIBRPM */
@@ -829,7 +829,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"))
- && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator"))))
+ && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmDbiTagVal rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator"))))
{
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)
/* RPMDBI_PACKAGES requires keylen == sizeof (int). */
/* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */
- mi_debuginfo = rpmtsInitIterator_p (ts, (rpmTag) RPMDBI_LABEL, debuginfo, 0);
+ mi_debuginfo = rpmtsInitIterator_p (ts, (rpmDbiTagVal) RPMDBI_LABEL, debuginfo, 0);
xfree (debuginfo);
if (mi_debuginfo)
{
diff --git a/gdb/config.in b/gdb/config.in diff --git a/gdb/config.in b/gdb/config.in
--- a/gdb/config.in --- a/gdb/config.in
+++ b/gdb/config.in +++ b/gdb/config.in
@ -258,7 +292,7 @@ diff --git a/gdb/config.in b/gdb/config.in
diff --git a/gdb/configure b/gdb/configure diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure --- a/gdb/configure
+++ b/gdb/configure +++ b/gdb/configure
@@ -775,6 +775,11 @@ TARGET_OBS @@ -783,6 +783,11 @@ TARGET_OBS
ENABLE_BFD_64_BIT_FALSE ENABLE_BFD_64_BIT_FALSE
ENABLE_BFD_64_BIT_TRUE ENABLE_BFD_64_BIT_TRUE
subdirs subdirs
@ -270,7 +304,7 @@ diff --git a/gdb/configure b/gdb/configure
GDB_DATADIR GDB_DATADIR
DEBUGDIR DEBUGDIR
MAKEINFO_EXTRA_FLAGS MAKEINFO_EXTRA_FLAGS
@@ -880,6 +885,7 @@ with_gdb_datadir @@ -912,6 +917,7 @@ with_gdb_datadir
with_relocated_sources with_relocated_sources
with_auto_load_dir with_auto_load_dir
with_auto_load_safe_path with_auto_load_safe_path
@ -278,7 +312,7 @@ diff --git a/gdb/configure b/gdb/configure
enable_targets enable_targets
enable_64_bit_bfd enable_64_bit_bfd
enable_gdbmi enable_gdbmi
@@ -959,6 +965,8 @@ PKG_CONFIG_PATH @@ -992,6 +998,8 @@ PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR PKG_CONFIG_LIBDIR
DEBUGINFOD_CFLAGS DEBUGINFOD_CFLAGS
DEBUGINFOD_LIBS DEBUGINFOD_LIBS
@ -286,8 +320,8 @@ diff --git a/gdb/configure b/gdb/configure
+RPM_LIBS +RPM_LIBS
YACC YACC
YFLAGS YFLAGS
XMKMF' ZSTD_CFLAGS
@@ -1635,6 +1643,8 @@ Optional Packages: @@ -1678,6 +1686,8 @@ Optional Packages:
do not restrict auto-loaded files locations do not restrict auto-loaded files locations
--with-debuginfod Enable debuginfo lookups with debuginfod --with-debuginfod Enable debuginfo lookups with debuginfod
(auto/yes/no) (auto/yes/no)
@ -296,7 +330,7 @@ diff --git a/gdb/configure b/gdb/configure
--with-libunwind-ia64 use libunwind frame unwinding for ia64 targets --with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
--with-curses use the curses library instead of the termcap --with-curses use the curses library instead of the termcap
library library
@@ -1715,6 +1725,8 @@ Some influential environment variables: @@ -1761,6 +1771,8 @@ Some influential environment variables:
C compiler flags for DEBUGINFOD, overriding pkg-config C compiler flags for DEBUGINFOD, overriding pkg-config
DEBUGINFOD_LIBS DEBUGINFOD_LIBS
linker flags for DEBUGINFOD, overriding pkg-config linker flags for DEBUGINFOD, overriding pkg-config
@ -305,7 +339,7 @@ diff --git a/gdb/configure b/gdb/configure
YACC The `Yet Another Compiler Compiler' implementation to use. YACC The `Yet Another Compiler Compiler' implementation to use.
Defaults to the first program found out of: `bison -y', `byacc', Defaults to the first program found out of: `bison -y', `byacc',
`yacc'. `yacc'.
@@ -6634,6 +6646,495 @@ _ACEOF @@ -17848,6 +17860,494 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
$as_echo "$with_auto_load_safe_path" >&6; } $as_echo "$with_auto_load_safe_path" >&6; }
@ -369,7 +403,6 @@ diff --git a/gdb/configure b/gdb/configure
+#include <rpm/rpmlib.h> +#include <rpm/rpmlib.h>
+#include <dlfcn.h> +#include <dlfcn.h>
+#include <errno.h> +#include <errno.h>
+#include <string.h>
+ +
+int +int
+main () +main ()
@ -804,7 +837,7 @@ diff --git a/gdb/configure b/gdb/configure
diff --git a/gdb/configure.ac b/gdb/configure.ac diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac --- a/gdb/configure.ac
+++ b/gdb/configure.ac +++ b/gdb/configure.ac
@@ -153,6 +153,200 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir, @@ -160,6 +160,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
[Directories safe to hold auto-loaded files.]) [Directories safe to hold auto-loaded files.])
AC_MSG_RESULT([$with_auto_load_safe_path]) AC_MSG_RESULT([$with_auto_load_safe_path])
@ -854,7 +887,6 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
+#include <rpm/rpmlib.h> +#include <rpm/rpmlib.h>
+#include <dlfcn.h> +#include <dlfcn.h>
+#include <errno.h> +#include <errno.h>
+#include <string.h>
+ ]], [[ + ]], [[
+ void *h; + void *h;
+ const char *const *rpmverp; + const char *const *rpmverp;
@ -1008,15 +1040,15 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
diff --git a/gdb/event-top.c b/gdb/event-top.c diff --git a/gdb/event-top.c b/gdb/event-top.c
--- a/gdb/event-top.c --- a/gdb/event-top.c
+++ b/gdb/event-top.c +++ b/gdb/event-top.c
@@ -42,6 +42,7 @@ @@ -43,6 +43,7 @@
#include "gdbsupport/gdb-sigmask.h"
#include "async-event.h" #include "async-event.h"
#include "bt-utils.h" #include "bt-utils.h"
#include "pager.h"
+#include "symfile.h" +#include "symfile.h"
/* readline include files. */ /* readline include files. */
#include "readline/readline.h" #include "readline/readline.h"
@@ -374,6 +375,8 @@ display_gdb_prompt (const char *new_prompt) @@ -391,6 +392,8 @@ display_gdb_prompt (const char *new_prompt)
/* Reset the nesting depth used when trace-commands is set. */ /* Reset the nesting depth used when trace-commands is set. */
reset_command_nest_depth (); reset_command_nest_depth ();
@ -1025,7 +1057,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 /* Do not call the python hook on an explicit prompt change as
passed to this function, as this forms a secondary/local prompt, passed to this function, as this forms a secondary/local prompt,
IE, displayed but not set. */ IE, displayed but not set. */
@@ -800,7 +803,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl) @@ -852,7 +855,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
command_handler (cmd); command_handler (cmd);
if (ui->prompt_state != PROMPTED) if (ui->prompt_state != PROMPTED)
@ -1040,7 +1072,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c
diff --git a/gdb/symfile.h b/gdb/symfile.h diff --git a/gdb/symfile.h b/gdb/symfile.h
--- a/gdb/symfile.h --- a/gdb/symfile.h
+++ b/gdb/symfile.h +++ b/gdb/symfile.h
@@ -342,6 +342,7 @@ extern void generic_load (const char *args, int from_tty); @@ -352,6 +352,7 @@ extern void generic_load (const char *args, int from_tty);
/* build-id support. */ /* build-id support. */
extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr); extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr);
extern void debug_print_missing (const char *binary, const char *debug); 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 diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
--- a/gdb/solib-svr4.c --- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c
@@ -1250,14 +1250,28 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, @@ -1321,14 +1321,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) if (build_id != NULL)
{ {
char *name, *build_id_filename; char *name, *build_id_filename;
@@ -1272,23 +1286,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, @@ -1343,23 +1357,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
xfree (name); xfree (name);
} }
else else

View File

@ -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 diff --git a/bfd/libbfd.h b/bfd/libbfd.h
--- a/bfd/libbfd.h --- a/bfd/libbfd.h
+++ b/bfd/libbfd.h +++ b/bfd/libbfd.h
@@ -120,7 +120,7 @@ static inline char * @@ -121,7 +121,7 @@ static inline char *
bfd_strdup (const char *str) bfd_strdup (const char *str)
{ {
size_t len = strlen (str) + 1; size_t len = strlen (str) + 1;
@ -59,7 +59,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+show_build_id_verbose (struct ui_file *file, int from_tty, +show_build_id_verbose (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value) + struct cmd_list_element *c, const char *value)
+{ +{
+ fprintf_filtered (file, _("Verbosity level of the build-id locator is %s.\n"), + gdb_printf (file, _("Verbosity level of the build-id locator is %s.\n"),
+ value); + value);
+} +}
+/* Locate NT_GNU_BUILD_ID and return its matching debug filename. +/* Locate NT_GNU_BUILD_ID and return its matching debug filename.
@ -517,9 +517,9 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ +
if (separate_debug_file_debug) if (separate_debug_file_debug)
{ {
- fprintf_unfiltered (gdb_stdlog, _(" Trying %s..."), link.c_str ()); - gdb_printf (gdb_stdlog, _(" Trying %s..."), link.c_str ());
- gdb_flush (gdb_stdlog); - gdb_flush (gdb_stdlog);
+ fprintf_unfiltered (gdb_stdlog, _(" Trying %s..."), orig_link.c_str ()); + gdb_printf (gdb_stdlog, _(" Trying %s..."), orig_link.c_str ());
+ gdb_flush (gdb_stdout); + gdb_flush (gdb_stdout);
} }
@ -539,7 +539,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
- if (filename == NULL) - if (filename == NULL)
- { - {
- if (separate_debug_file_debug) - if (separate_debug_file_debug)
- fprintf_unfiltered (gdb_stdlog, - gdb_printf (gdb_stdlog,
- _(" no, unable to compute real path\n")); - _(" no, unable to compute real path\n"));
+ if (seqno > 0) + if (seqno > 0)
+ { + {
@ -559,7 +559,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
- if (debug_bfd == NULL) - if (debug_bfd == NULL)
- { - {
- if (separate_debug_file_debug) - if (separate_debug_file_debug)
- fprintf_unfiltered (gdb_stdlog, _(" no, unable to open.\n")); - gdb_printf (gdb_stdlog, _(" no, unable to open.\n"));
+ struct stat statbuf_trash; + struct stat statbuf_trash;
+ +
+ /* `access' automatically dereferences LINK. */ + /* `access' automatically dereferences LINK. */
@ -568,8 +568,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ /* Stop increasing SEQNO. */ + /* Stop increasing SEQNO. */
+ break; + break;
+ } + }
+
- return {};
+ /* lrealpath() is expensive even for the usually non-existent files. */ + /* lrealpath() is expensive even for the usually non-existent files. */
+ gdb::unique_xmalloc_ptr<char> filename_holder; + gdb::unique_xmalloc_ptr<char> filename_holder;
+ const char *filename = nullptr; + const char *filename = nullptr;
@ -584,7 +583,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ if (filename == NULL) + if (filename == NULL)
+ { + {
+ if (separate_debug_file_debug) + if (separate_debug_file_debug)
+ fprintf_unfiltered (gdb_stdlog, + gdb_printf (gdb_stdlog,
+ _(" no, unable to compute real path\n")); + _(" no, unable to compute real path\n"));
+ +
+ continue; + continue;
@ -596,15 +595,16 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ if (debug_bfd == NULL) + if (debug_bfd == NULL)
+ { + {
+ if (separate_debug_file_debug) + if (separate_debug_file_debug)
+ fprintf_unfiltered (gdb_stdlog, _(" no, unable to open.\n")); + gdb_printf (gdb_stdlog, _(" no, unable to open.\n"));
+
- return {};
+ continue; + continue;
+ } + }
+ +
+ if (!build_id_verify (debug_bfd.get(), build_id_len, build_id)) + if (!build_id_verify (debug_bfd.get(), build_id_len, build_id))
+ { + {
+ if (separate_debug_file_debug) + if (separate_debug_file_debug)
+ fprintf_unfiltered (gdb_stdlog, + gdb_printf (gdb_stdlog,
+ _(" no, build-id does not match.\n")); + _(" no, build-id does not match.\n"));
+ +
+ continue; + continue;
@ -620,21 +620,21 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ if (ret_bfd != NULL) + if (ret_bfd != NULL)
{ {
if (separate_debug_file_debug) if (separate_debug_file_debug)
- fprintf_unfiltered (gdb_stdlog, _(" no, build-id does not match.\n")); - gdb_printf (gdb_stdlog, _(" no, build-id does not match.\n"));
+ fprintf_unfiltered (gdb_stdlog, _(" yes!\n")); + gdb_printf (gdb_stdlog, _(" yes!\n"));
+ } + }
+ else + else
+ { + {
+ /* If none of the real files is found report as missing file + /* If none of the real files is found report as missing file
+ always the non-.%u-suffixed file. */ + always the non-.%u-suffixed file. */
+ std::string link0 = orig_link; + std::string link0 = orig_link;
+
- return {};
+ /* If the symlink has target request to install the target. + /* If the symlink has target request to install the target.
+ BASE-debuginfo.rpm contains the symlink but BASE.rpm may be missing. + BASE-debuginfo.rpm contains the symlink but BASE.rpm may be missing.
+ https://bugzilla.redhat.com/show_bug.cgi?id=981154 */ + https://bugzilla.redhat.com/show_bug.cgi?id=981154 */
+ std::string link0_resolved (link_resolve (link0.c_str (), 0)); + std::string link0_resolved (link_resolve (link0.c_str (), 0));
+
- return {};
+ if (link_all.empty ()) + if (link_all.empty ())
+ link_all = link0_resolved; + link_all = link0_resolved;
+ else + else
@ -646,7 +646,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
} }
- if (separate_debug_file_debug) - if (separate_debug_file_debug)
- fprintf_unfiltered (gdb_stdlog, _(" yes!\n")); - gdb_printf (gdb_stdlog, _(" yes!\n"));
+ if (link_return != NULL) + if (link_return != NULL)
+ { + {
+ if (ret_bfd != NULL) + if (ret_bfd != NULL)
@ -703,7 +703,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
if (debug_bfd != NULL) if (debug_bfd != NULL)
return debug_bfd; return debug_bfd;
} }
@@ -183,30 +687,595 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, @@ -183,30 +687,655 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
return {}; return {};
} }
@ -765,7 +765,11 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+/* Returns the count of newly added rpms. */ +/* Returns the count of newly added rpms. */
+ +
+static int +static int
+#ifndef GDB_INDEX_VERIFY_VENDOR
+missing_rpm_enlist (const char *filename) +missing_rpm_enlist (const char *filename)
+#else
+missing_rpm_enlist_1 (const char *filename, int verify_vendor)
+#endif
+{ +{
+ static int rpm_init_done = 0; + static int rpm_init_done = 0;
+ rpmts ts; + rpmts ts;
@ -787,10 +791,10 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ static rpmts (*rpmtsCreate_p) (void); + static rpmts (*rpmtsCreate_p) (void);
+ extern rpmts rpmtsFree(rpmts ts); + extern rpmts rpmtsFree(rpmts ts);
+ static rpmts (*rpmtsFree_p) (rpmts ts); + static rpmts (*rpmtsFree_p) (rpmts ts);
+ extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, + extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
+ const void * keyp, size_t keylen); + const void * keyp, size_t keylen);
+ static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts, + static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts,
+ rpmDbiTagVal rpmtag, + rpmTag rpmtag,
+ const void *keyp, + const void *keyp,
+ size_t keylen); + size_t keylen);
+#else /* !DLOPEN_LIBRPM */ +#else /* !DLOPEN_LIBRPM */
@ -845,7 +849,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ && (rpmdbNextIterator_p = (Header (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbNextIterator")) + && (rpmdbNextIterator_p = (Header (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbNextIterator"))
+ && (rpmtsCreate_p = (rpmts (*) (void)) dlsym (h, "rpmtsCreate")) + && (rpmtsCreate_p = (rpmts (*) (void)) dlsym (h, "rpmtsCreate"))
+ && (rpmtsFree_p = (rpmts (*) (rpmts ts)) dlsym (h, "rpmtsFree")) + && (rpmtsFree_p = (rpmts (*) (rpmts ts)) dlsym (h, "rpmtsFree"))
+ && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmDbiTagVal rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator")))) + && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator"))))
+ { + {
+ warning (_("Opened library \"%s\" is incompatible (%s), " + warning (_("Opened library \"%s\" is incompatible (%s), "
+ "missing debuginfos notifications will not be displayed"), + "missing debuginfos notifications will not be displayed"),
@ -872,7 +876,11 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0); + mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
+ if (mi != NULL) + if (mi != NULL)
+ { + {
+#ifndef GDB_INDEX_VERIFY_VENDOR
+ for (;;) + for (;;)
+#else
+ if (!verify_vendor) for (;;)
+#endif
+ { + {
+ Header h; + Header h;
+ char *debuginfo, **slot, *s, *s2; + char *debuginfo, **slot, *s, *s2;
@ -990,6 +998,38 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ xfree (debuginfo); + xfree (debuginfo);
+ count++; + count++;
+ } + }
+#ifdef GDB_INDEX_VERIFY_VENDOR
+ else /* verify_vendor */
+ {
+ int vendor_pass = 0, vendor_fail = 0;
+
+ for (;;)
+ {
+ Header h;
+ errmsg_t err;
+ char *vendor;
+
+ h = rpmdbNextIterator_p (mi);
+ if (h == NULL)
+ break;
+
+ vendor = headerFormat_p (h, "%{vendor}", &err);
+ if (!vendor)
+ {
+ warning (_("Error querying the rpm file `%s': %s"), filename,
+ err);
+ continue;
+ }
+ if (strcmp (vendor, "Red Hat, Inc.") == 0)
+ vendor_pass = 1;
+ else
+ vendor_fail = 1;
+ xfree (vendor);
+ }
+ count = vendor_pass != 0 && vendor_fail == 0;
+ }
+#endif
+
+ rpmdbFreeIterator_p (mi); + rpmdbFreeIterator_p (mi);
+ } + }
+ +
@ -998,6 +1038,20 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ return count; + return count;
+} +}
+ +
+#ifdef GDB_INDEX_VERIFY_VENDOR
+missing_rpm_enlist (const char *filename)
+{
+ return missing_rpm_enlist_1 (filename, 0);
+}
+
+extern int rpm_verify_vendor (const char *filename);
+int
+rpm_verify_vendor (const char *filename)
+{
+ return missing_rpm_enlist_1 (filename, 1);
+}
+#endif
+
+static bool +static bool
+missing_rpm_list_compar (const char *ap, const char *bp) +missing_rpm_list_compar (const char *ap, const char *bp)
+{ +{
@ -1040,20 +1094,26 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ debug_flush_missing -> missing_rpm_list_print ... + debug_flush_missing -> missing_rpm_list_print ...
+ +
+ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero + For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero
+ *before* calling any print function. */ + *before* calling any print function.
+
+ Note: kevinb/2023-02-22: The code below used to call
+ puts_unfiltered() and printf_unfiltered(), but calls to these
+ functions have been replaced by calls to gdb_printf(). The call
+ chain shown above (probably) used to be the case at one time and
+ hopefully something similar is still the case now that
+ gdb_printf() is being used instead. */
+ missing_rpm_list_entries = 0; + missing_rpm_list_entries = 0;
+ +
+ printf_unfiltered (_("Missing separate debuginfos, use: %s"), + gdb_printf (_("Missing separate debuginfos, use: %s"),
+#ifdef DNF_DEBUGINFO_INSTALL +#ifdef DNF_DEBUGINFO_INSTALL
+ "dnf " + "dnf "
+#endif +#endif
+ "debuginfo-install"); + "debuginfo-install");
+ for (const char *el : array) + for (const char *el : array)
+ { + {
+ puts_unfiltered (" "); + gdb_printf (" %s", el);
+ puts_unfiltered (el);
+ } + }
+ puts_unfiltered ("\n"); + gdb_printf ("\n");
+ +
+ while (missing_rpm_list != NULL) + while (missing_rpm_list != NULL)
+ { + {
@ -1252,10 +1312,10 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ /* We do not collect and flush these messages as each such message + /* We do not collect and flush these messages as each such message
+ already requires its own separate lines. */ + already requires its own separate lines. */
+ +
+ fprintf_unfiltered (gdb_stdlog, + gdb_printf (gdb_stdlog,
+ _("Missing separate debuginfo for %s\n"), binary); + _("Missing separate debuginfo for %s\n"), binary);
+ if (debug != NULL) + if (debug != NULL)
+ fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"), + gdb_printf (gdb_stdlog, _("Try: %s %s\n"),
+#ifdef DNF_DEBUGINFO_INSTALL +#ifdef DNF_DEBUGINFO_INSTALL
+ "dnf" + "dnf"
+#else +#else
@ -1297,15 +1357,15 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
{ {
const struct bfd_build_id *build_id; const struct bfd_build_id *build_id;
- build_id = build_id_bfd_get (objfile->obfd); - build_id = build_id_bfd_get (objfile->obfd.get ());
+ if (build_id_filename_return) + if (build_id_filename_return)
+ *build_id_filename_return = NULL; + *build_id_filename_return = NULL;
+ +
+ build_id = build_id_bfd_shdr_get (objfile->obfd); + build_id = build_id_bfd_shdr_get (objfile->obfd.get ());
if (build_id != NULL) if (build_id != NULL)
{ {
if (separate_debug_file_debug) if (separate_debug_file_debug)
@@ -214,8 +1283,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) @@ -214,8 +1343,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
_("\nLooking for separate debug info (build-id) for " _("\nLooking for separate debug info (build-id) for "
"%s\n"), objfile_name (objfile)); "%s\n"), objfile_name (objfile));
@ -1328,7 +1388,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
/* Prevent looping on a stripped .debug file. */ /* Prevent looping on a stripped .debug file. */
if (abfd != NULL if (abfd != NULL
&& filename_cmp (bfd_get_filename (abfd.get ()), && filename_cmp (bfd_get_filename (abfd.get ()),
@@ -228,3 +1310,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) @@ -228,3 +1370,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
return std::string (); return std::string ();
} }
@ -1401,7 +1461,7 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h
diff --git a/gdb/coffread.c b/gdb/coffread.c diff --git a/gdb/coffread.c b/gdb/coffread.c
--- a/gdb/coffread.c --- a/gdb/coffread.c
+++ b/gdb/coffread.c +++ b/gdb/coffread.c
@@ -710,7 +710,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) @@ -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. */ /* Try to add separate debug file if no symbols table found. */
if (!objfile->has_partial_symbols ()) if (!objfile->has_partial_symbols ())
{ {
@ -1425,7 +1485,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
#include "inferior.h" #include "inferior.h"
#include "infrun.h" #include "infrun.h"
#include "symtab.h" #include "symtab.h"
@@ -356,6 +360,8 @@ add_to_thread_list (asection *asect, asection *reg_sect) @@ -391,6 +395,8 @@ add_to_thread_list (asection *asect, asection *reg_sect)
switch_to_thread (thr); /* Yes, make it current. */ switch_to_thread (thr); /* Yes, make it current. */
} }
@ -1434,7 +1494,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
/* Issue a message saying we have no core to debug, if FROM_TTY. */ /* Issue a message saying we have no core to debug, if FROM_TTY. */
static void static void
@@ -392,19 +398,26 @@ core_file_command (const char *filename, int from_tty) @@ -427,12 +433,14 @@ core_file_command (const char *filename, int from_tty)
static void static void
locate_exec_from_corefile_build_id (bfd *abfd, int from_tty) locate_exec_from_corefile_build_id (bfd *abfd, int from_tty)
{ {
@ -1449,8 +1509,9 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
+ = build_id_to_exec_bfd (build_id->size, build_id->data, + = build_id_to_exec_bfd (build_id->size, build_id->data,
+ &build_id_filename); + &build_id_filename);
if (execbfd != nullptr) if (execbfd == nullptr)
{ {
@@ -460,7 +468,12 @@ locate_exec_from_corefile_build_id (bfd *abfd, int from_tty)
exec_file_attach (bfd_get_filename (execbfd.get ()), from_tty); exec_file_attach (bfd_get_filename (execbfd.get ()), from_tty);
symbol_file_add_main (bfd_get_filename (execbfd.get ()), symbol_file_add_main (bfd_get_filename (execbfd.get ()),
symfile_add_flag (from_tty ? SYMFILE_VERBOSE : 0)); symfile_add_flag (from_tty ? SYMFILE_VERBOSE : 0));
@ -1463,7 +1524,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
} }
/* See gdbcore.h. */ /* See gdbcore.h. */
@@ -1209,4 +1222,11 @@ _initialize_corelow () @@ -1325,4 +1338,11 @@ _initialize_corelow ()
maintenance_print_core_file_backed_mappings, maintenance_print_core_file_backed_mappings,
_("Print core file's file-backed mappings."), _("Print core file's file-backed mappings."),
&maintenanceprintlist); &maintenanceprintlist);
@ -1478,7 +1539,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
--- a/gdb/doc/gdb.texinfo --- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo
@@ -21524,6 +21524,27 @@ information files. @@ -22037,6 +22037,27 @@ information files.
@end table @end table
@ -1509,16 +1570,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 diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
--- a/gdb/dwarf2/index-cache.c --- a/gdb/dwarf2/index-cache.c
+++ b/gdb/dwarf2/index-cache.c +++ b/gdb/dwarf2/index-cache.c
@@ -97,7 +97,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile) @@ -101,7 +101,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
return; return;
/* Get build id of objfile. */ /* Get build id of objfile. */
- const bfd_build_id *build_id = build_id_bfd_get (obj->obfd); - 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); + const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd.get ());
if (build_id == nullptr) if (build_id == nullptr)
{ {
index_cache_debug ("objfile %s has no build id", index_cache_debug ("objfile %s has no build id",
@@ -114,7 +114,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile) @@ -118,7 +118,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
if (dwz != nullptr) if (dwz != nullptr)
{ {
@ -1531,16 +1592,16 @@ 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 diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
--- a/gdb/dwarf2/read.c --- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c
@@ -5476,7 +5476,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner) @@ -5328,7 +5328,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
static gdb::array_view<const gdb_byte> static gdb::array_view<const gdb_byte>
get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd) get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
{ {
- const bfd_build_id *build_id = build_id_bfd_get (obj->obfd); - 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); + const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd.get ());
if (build_id == nullptr) if (build_id == nullptr)
return {}; return {};
@@ -5489,7 +5489,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd) @@ -5341,7 +5341,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
static gdb::array_view<const gdb_byte> static gdb::array_view<const gdb_byte>
get_gdb_index_contents_from_cache_dwz (objfile *obj, dwz_file *dwz) get_gdb_index_contents_from_cache_dwz (objfile *obj, dwz_file *dwz)
{ {
@ -1552,7 +1613,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
diff --git a/gdb/elfread.c b/gdb/elfread.c diff --git a/gdb/elfread.c b/gdb/elfread.c
--- a/gdb/elfread.c --- a/gdb/elfread.c
+++ b/gdb/elfread.c +++ b/gdb/elfread.c
@@ -1270,7 +1270,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) @@ -1213,7 +1213,9 @@ elf_symfile_read_dwarf2 (struct objfile *objfile,
&& objfile->separate_debug_objfile == NULL && objfile->separate_debug_objfile == NULL
&& objfile->separate_debug_objfile_backlink == NULL) && objfile->separate_debug_objfile_backlink == NULL)
{ {
@ -1563,21 +1624,22 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
if (debugfile.empty ()) if (debugfile.empty ())
debugfile = find_separate_debug_file_by_debuglink (objfile); debugfile = find_separate_debug_file_by_debuglink (objfile);
@@ -1285,7 +1287,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) @@ -1229,7 +1231,7 @@ elf_symfile_read_dwarf2 (struct objfile *objfile,
else
{ {
has_dwarf2 = false; has_dwarf2 = false;
- const struct bfd_build_id *build_id = build_id_bfd_get (objfile->obfd); const struct bfd_build_id *build_id
+ const struct bfd_build_id *build_id = build_id_bfd_shdr_get (objfile->obfd); - = build_id_bfd_get (objfile->obfd.get ());
+ = build_id_bfd_shdr_get (objfile->obfd.get ());
const char *filename = bfd_get_filename (objfile->obfd.get ());
if (build_id != nullptr) if (build_id != nullptr)
{ @@ -1256,6 +1258,11 @@ elf_symfile_read_dwarf2 (struct objfile *objfile,
@@ -1310,6 +1312,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
has_dwarf2 = true; has_dwarf2 = true;
} }
} }
+ /* Check if any separate debug info has been extracted out. */ + /* Check if any separate debug info has been extracted out. */
+ else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink") + else if (bfd_get_section_by_name (objfile->obfd.get (),
+ ".gnu_debuglink")
+ != NULL) + != NULL)
+ debug_print_missing (objfile_name (objfile), build_id_filename.get ()); + debug_print_missing (objfile_name (objfile), build_id_filename.get ());
} }
@ -1586,7 +1648,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
diff --git a/gdb/exec.c b/gdb/exec.c diff --git a/gdb/exec.c b/gdb/exec.c
--- a/gdb/exec.c --- a/gdb/exec.c
+++ b/gdb/exec.c +++ b/gdb/exec.c
@@ -238,7 +238,7 @@ validate_exec_file (int from_tty) @@ -237,7 +237,7 @@ validate_exec_file (int from_tty)
current_exec_file = get_exec_file (0); current_exec_file = get_exec_file (0);
const bfd_build_id *exec_file_build_id const bfd_build_id *exec_file_build_id
@ -1595,7 +1657,7 @@ diff --git a/gdb/exec.c b/gdb/exec.c
if (exec_file_build_id != nullptr) if (exec_file_build_id != nullptr)
{ {
/* Prepend the target prefix, to force gdb_bfd_open to open the /* Prepend the target prefix, to force gdb_bfd_open to open the
@@ -251,7 +251,7 @@ validate_exec_file (int from_tty) @@ -250,7 +250,7 @@ validate_exec_file (int from_tty)
if (abfd != nullptr) if (abfd != nullptr)
{ {
const bfd_build_id *target_exec_file_build_id const bfd_build_id *target_exec_file_build_id
@ -1607,7 +1669,7 @@ diff --git a/gdb/exec.c b/gdb/exec.c
diff --git a/gdb/objfiles.h b/gdb/objfiles.h diff --git a/gdb/objfiles.h b/gdb/objfiles.h
--- a/gdb/objfiles.h --- a/gdb/objfiles.h
+++ b/gdb/objfiles.h +++ b/gdb/objfiles.h
@@ -769,6 +769,10 @@ struct objfile @@ -786,6 +786,10 @@ struct objfile
bool skip_jit_symbol_lookup = false; bool skip_jit_symbol_lookup = false;
}; };
@ -1621,24 +1683,24 @@ diff --git a/gdb/objfiles.h b/gdb/objfiles.h
diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
--- a/gdb/python/py-objfile.c --- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c +++ b/gdb/python/py-objfile.c
@@ -132,7 +132,7 @@ objfpy_get_build_id (PyObject *self, void *closure) @@ -158,7 +158,7 @@ objfpy_get_build_id (PyObject *self, void *closure)
try try
{ {
- build_id = build_id_bfd_get (objfile->obfd); - build_id = build_id_bfd_get (objfile->obfd.get ());
+ build_id = build_id_bfd_shdr_get (objfile->obfd); + build_id = build_id_bfd_shdr_get (objfile->obfd.get ());
} }
catch (const gdb_exception &except) catch (const gdb_exception &except)
{ {
@@ -600,7 +600,7 @@ objfpy_lookup_objfile_by_build_id (const char *build_id) @@ -629,7 +629,7 @@ gdbpy_lookup_objfile (PyObject *self, PyObject *args, PyObject *kw)
/* Don't return separate debug files. */ if (obfd == nullptr)
if (objfile->separate_debug_objfile_backlink != NULL) return 0;
continue;
- obfd_build_id = build_id_bfd_get (objfile->obfd); - const bfd_build_id *obfd_build_id = build_id_bfd_get (obfd);
+ obfd_build_id = build_id_bfd_shdr_get (objfile->obfd); + const bfd_build_id *obfd_build_id = build_id_bfd_shdr_get (obfd);
if (obfd_build_id == NULL) if (obfd_build_id == nullptr)
continue; return 0;
if (objfpy_build_id_matches (obfd_build_id, build_id))
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
--- a/gdb/solib-svr4.c --- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c
@ -1648,9 +1710,9 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
#include "probe.h" #include "probe.h"
+#include "build-id.h" +#include "build-id.h"
static struct link_map_offsets *svr4_fetch_link_map_offsets (void); #include <map>
static int svr4_have_link_map_offsets (void);
@@ -1248,9 +1249,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, @@ -1319,9 +1320,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
continue; continue;
} }
@ -1708,19 +1770,19 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
diff --git a/gdb/source.c b/gdb/source.c diff --git a/gdb/source.c b/gdb/source.c
--- a/gdb/source.c --- a/gdb/source.c
+++ b/gdb/source.c +++ b/gdb/source.c
@@ -1199,7 +1199,7 @@ open_source_file (struct symtab *s) @@ -1196,7 +1196,7 @@ open_source_file (struct symtab *s)
srcpath += s->filename;
} }
- const struct bfd_build_id *build_id = build_id_bfd_get (ofp->obfd); const struct bfd_build_id *build_id
+ const struct bfd_build_id *build_id = build_id_bfd_shdr_get (ofp->obfd); - = build_id_bfd_get (ofp->obfd.get ());
+ = build_id_bfd_shdr_get (ofp->obfd.get ());
/* Query debuginfod for the source file. */ /* Query debuginfod for the source file. */
if (build_id != nullptr && !srcpath.empty ()) if (build_id != nullptr && !srcpath.empty ())
diff --git a/gdb/symfile.h b/gdb/symfile.h diff --git a/gdb/symfile.h b/gdb/symfile.h
--- a/gdb/symfile.h --- a/gdb/symfile.h
+++ b/gdb/symfile.h +++ b/gdb/symfile.h
@@ -332,12 +332,18 @@ bool expand_symtabs_matching @@ -342,12 +342,18 @@ bool expand_symtabs_matching
void map_symbol_filenames (gdb::function_view<symbol_filename_ftype> fun, void map_symbol_filenames (gdb::function_view<symbol_filename_ftype> fun,
bool need_fullname); bool need_fullname);
@ -1742,7 +1804,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 diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp
--- a/gdb/testsuite/gdb.base/corefile.exp --- a/gdb/testsuite/gdb.base/corefile.exp
+++ b/gdb/testsuite/gdb.base/corefile.exp +++ b/gdb/testsuite/gdb.base/corefile.exp
@@ -343,3 +343,33 @@ gdb_test_multiple "core-file $corefile" $test { @@ -349,3 +349,33 @@ gdb_test_multiple "core-file $corefile" $test {
pass $test pass $test
} }
} }
@ -1803,17 +1865,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 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
--- a/gdb/testsuite/lib/gdb.exp --- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp
@@ -141,7 +141,8 @@ if ![info exists INTERNAL_GDBFLAGS] { @@ -217,7 +217,8 @@ if ![info exists INTERNAL_GDBFLAGS] {
"-nw" \
"-nx" \ "-nx" \
"-data-directory $BUILD_DATA_DIRECTORY" \
{-iex "set height 0"} \ {-iex "set height 0"} \
- {-iex "set width 0"}]] - {-iex "set width 0"}]]
+ {-iex "set width 0"} \ + {-iex "set width 0"} \
+ {-iex "set build-id-verbose 0"}]] + {-iex "set build-id-verbose 0"}]]
}
# The variable gdb_prompt is a regexp which matches the gdb prompt. set INTERNAL_GDBFLAGS [append_gdb_data_directory_option $INTERNAL_GDBFLAGS]
@@ -2200,6 +2201,17 @@ proc default_gdb_start { } { }
@@ -2349,6 +2350,17 @@ proc default_gdb_start { } {
} }
} }
@ -1834,7 +1896,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 diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
--- a/gdb/testsuite/lib/mi-support.exp --- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp
@@ -322,6 +322,16 @@ proc default_mi_gdb_start { args } { @@ -330,6 +330,16 @@ proc default_mi_gdb_start { { flags {} } } {
warning "Couldn't set the width to 0." warning "Couldn't set the width to 0."
} }
} }

View File

@ -72,7 +72,7 @@ diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.e
} }
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
@@ -47,7 +47,8 @@ set dir2 [standard_output_file dir2.fileio.test] @@ -40,7 +40,8 @@ set dir2 [standard_output_file dir2.fileio.test]
if {[file exists $dir2] && ![file writable $dir2]} { if {[file exists $dir2] && ![file writable $dir2]} {
system "chmod +w $dir2" system "chmod +w $dir2"
} }
@ -82,7 +82,7 @@ diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.e
set oldtimeout $timeout set oldtimeout $timeout
set timeout [expr "$timeout + 60"] set timeout [expr "$timeout + 60"]
@@ -89,7 +90,7 @@ gdb_test continue \ @@ -81,7 +82,7 @@ gdb_test continue \
gdb_test "continue" ".*" "" gdb_test "continue" ".*" ""
@ -91,7 +91,7 @@ diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.e
gdb_test continue \ gdb_test continue \
"Continuing\\..*open 5:.*EACCES$stop_msg" \ "Continuing\\..*open 5:.*EACCES$stop_msg" \
@@ -276,9 +277,7 @@ gdb_test continue \ @@ -268,9 +269,7 @@ gdb_test continue \
gdb_exit gdb_exit
# Make dir2 writable again so rm -rf of a build tree Just Works. # Make dir2 writable again so rm -rf of a build tree Just Works.

View File

@ -1,101 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Bruno Larsen <blarsen@redhat.com>
Date: Tue, 18 Oct 2022 11:10:41 +0200
Subject: gdb-backport-fix-break-main-file-remove-fail.patch
;; [gdb/testsuite] Use prototype to call libc functions
;; (Tom de Vries)
On openSUSE Tumbleweed (using glibc 2.36), I run into:
...
(gdb) print /d (int) munmap (4198400, 4096)^M
Invalid cast.^M
(gdb) FAIL: gdb.base/break-main-file-remove-fail.exp: cmdline: \
get integer valueof "(int) munmap (4198400, 4096)"
...
The problem is that after starting the executable, the symbol has type
"void (*) (void)":
...
(gdb) p munmap
$1 = {<text variable, no debug info>} 0x401030 <munmap@plt>
(gdb) start
...
(gdb) p munmap
$2 = {void (void)} 0x7ffff7feb9a0 <__GI_munmap>
...
which causes the "Invalid cast" error.
Looking at the debug info for glibc for symbol __GI_munmap:
...
<0><189683>: Abbrev Number: 1 (DW_TAG_compile_unit)
<189691> DW_AT_name : ../sysdeps/unix/syscall-template.S
<189699> DW_AT_producer : GNU AS 2.39.0
<1><1896ae>: Abbrev Number: 2 (DW_TAG_subprogram)
<1896af> DW_AT_name : __GI___munmap
<1896b3> DW_AT_external : 1
<1896b4> DW_AT_low_pc : 0x10cad0
<1896bc> DW_AT_high_pc : 37
...
that's probably caused by this bit (or similar bits for other munmap aliases).
This is fixed in gas on trunk by commit 5578fbf672e ("GAS: Add a return type
tag to DWARF DIEs generated for function symbols").
Work around this (for say gas 2.39) by explicitly specifying the prototype for
munmap.
Likewise for getpid in a couple of other test-cases.
Tested on x86_64-linux.
diff --git a/gdb/testsuite/gdb.base/break-main-file-remove-fail.exp b/gdb/testsuite/gdb.base/break-main-file-remove-fail.exp
--- a/gdb/testsuite/gdb.base/break-main-file-remove-fail.exp
+++ b/gdb/testsuite/gdb.base/break-main-file-remove-fail.exp
@@ -87,7 +87,9 @@ proc test_remove_bp { initial_load } {
# should warn the user about it.
set pagesize [get_integer_valueof "pg_size" 0]
set align_addr [expr $bp_addr - $bp_addr % $pagesize]
- set munmap [get_integer_valueof "(int) munmap ($align_addr, $pagesize)" -1]
+ set munmap_prototype "int (*) (void *, size_t)"
+ set munmap_expr "(($munmap_prototype) munmap) ($align_addr, $pagesize)"
+ set munmap [get_integer_valueof $munmap_expr -1]
if {$munmap != 0} {
unsupported "can't munmap foo's page"
diff --git a/gdb/testsuite/gdb.base/dprintf-detach.exp b/gdb/testsuite/gdb.base/dprintf-detach.exp
--- a/gdb/testsuite/gdb.base/dprintf-detach.exp
+++ b/gdb/testsuite/gdb.base/dprintf-detach.exp
@@ -52,7 +52,7 @@ proc dprintf_detach_test { breakpoint_always_inserted dprintf_style disconnected
# Get PID of test program.
set inferior_pid -1
set test "get inferior process ID"
- gdb_test_multiple "call (int) getpid ()" $test {
+ gdb_test_multiple "call ((int (*) (void)) getpid) ()" $test {
-re ".* = ($decimal).*$gdb_prompt $" {
set inferior_pid $expect_out(1,string)
pass $test
diff --git a/gdb/testsuite/gdb.base/info-os.exp b/gdb/testsuite/gdb.base/info-os.exp
--- a/gdb/testsuite/gdb.base/info-os.exp
+++ b/gdb/testsuite/gdb.base/info-os.exp
@@ -39,7 +39,7 @@ if ![runto_main] then {
# Get PID of test program.
set inferior_pid ""
set test "get inferior process ID"
-gdb_test_multiple "call (int) getpid()" $test {
+gdb_test_multiple "call ((int (*) (void)) getpid) ()" $test {
-re ".* = ($decimal).*$gdb_prompt $" {
set inferior_pid $expect_out(1,string)
pass $test
diff --git a/gdb/testsuite/gdb.threads/siginfo-threads.exp b/gdb/testsuite/gdb.threads/siginfo-threads.exp
--- a/gdb/testsuite/gdb.threads/siginfo-threads.exp
+++ b/gdb/testsuite/gdb.threads/siginfo-threads.exp
@@ -41,7 +41,7 @@ gdb_breakpoint [gdb_get_line_number "break-at-exit"]
set test "get pid"
set pid ""
-gdb_test_multiple "p (int) getpid ()" $test {
+gdb_test_multiple "p ((int (*) (void))getpid) ()" $test {
-re " = (\[0-9\]+)\r\n$gdb_prompt $" {
set pid $expect_out(1,string)
pass $test

View File

@ -1,88 +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: Thu, 19 Jan 2023 19:18:58 +0100
Subject: gdb-backport-python-config-replace-deprecated-distutils.patch
;;Backport replace deprecated distutils.sysconfig in
;;python-config (Lancelot SIX)
gdb/python-config: replace deprecated distutils.sysconfig
When running the gdb/configure script on ubuntu 22.04 with
python-3.10.4, I see:
checking for python... no
checking for python3... /usr/bin/python3
[...]/gdb/python/python-config.py:7: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils import sysconfig
[...]/gdb/python/python-config.py:7: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
from distutils import sysconfig
[...]/gdb/python/python-config.py:7: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils import sysconfig
[...]/gdb/python/python-config.py:7: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
from distutils import sysconfig
[...]/gdb/python/python-config.py:7: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils import sysconfig
[...]/gdb/python/python-config.py:7: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
from distutils import sysconfig
checking for python... yes
The distutils module is deprecated as per the PEP 632[1] and will be
removed in python-3.12.
This patch migrates gdb/python/python-config.py from distutils.sysconfig
to the sysconfig module[2].
The sysconfig module has has been introduced in the standard library in
python 3.2. Given that support for python < 3.2 has been removed by
edae3fd6600f: "gdb/python: remove Python 2 support", this patch does not
need to support both implementations for backward compatibility.
Tested on ubuntu-22.04 and ubuntu 20.04.
[1] https://peps.python.org/pep-0632/
[2] https://docs.python.org/3/library/sysconfig.html
Change-Id: Id0df2baf3ee6ce68bd01c236b829ab4c0a4526f6
diff --git a/gdb/python/python-config.py b/gdb/python/python-config.py
--- a/gdb/python/python-config.py
+++ b/gdb/python/python-config.py
@@ -4,7 +4,7 @@
import sys
import os
import getopt
-from distutils import sysconfig
+import sysconfig
valid_opts = ["prefix", "exec-prefix", "includes", "libs", "cflags", "ldflags", "help"]
@@ -49,15 +49,15 @@ def to_unix_path(path):
for opt in opt_flags:
if opt == "--prefix":
- print(to_unix_path(sysconfig.PREFIX))
+ print(to_unix_path(os.path.normpath(sys.prefix)))
elif opt == "--exec-prefix":
- print(to_unix_path(sysconfig.EXEC_PREFIX))
+ print(to_unix_path(os.path.normpath(sys.exec_prefix)))
elif opt in ("--includes", "--cflags"):
flags = [
- "-I" + sysconfig.get_python_inc(),
- "-I" + sysconfig.get_python_inc(plat_specific=True),
+ "-I" + sysconfig.get_path("include"),
+ "-I" + sysconfig.get_path("platinclude"),
]
if opt == "--cflags":
flags.extend(getvar("CFLAGS").split())
@@ -76,7 +76,7 @@ for opt in opt_flags:
if getvar("LIBPL") is not None:
libs.insert(0, "-L" + getvar("LIBPL"))
elif os.name == "nt":
- libs.insert(0, "-L" + sysconfig.PREFIX + "/libs")
+ libs.insert(0, "-L" + os.path.normpath(sys.prefix) + "/libs")
if getvar("LINKFORSHARED") is not None:
libs.extend(getvar("LINKFORSHARED").split())
print(to_unix_path(" ".join(libs)))

View File

@ -1,31 +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: Mon, 10 Oct 2022 15:44:52 +0200
Subject: gdb-backport-readline_support.patch
Add support for readline 8.2
In readline 8.2 the type of rl_completer_word_break_characters changed to
include const.
diff --git a/gdb/completer.c b/gdb/completer.c
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -36,7 +36,7 @@
calling a hook instead so we eliminate the CLI dependency. */
#include "gdbcmd.h"
-/* Needed for rl_completer_word_break_characters() and for
+/* Needed for rl_completer_word_break_characters and for
rl_filename_completion_function. */
#include "readline/readline.h"
@@ -2011,7 +2011,7 @@ gdb_completion_word_break_characters_throw ()
rl_basic_quote_characters = NULL;
}
- return rl_completer_word_break_characters;
+ return (char *) rl_completer_word_break_characters;
}
char *

View File

@ -9,9 +9,9 @@ Subject: gdb-ccache-workaround.patch
diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp
--- a/gdb/testsuite/gdb.base/macscp.exp --- a/gdb/testsuite/gdb.base/macscp.exp
+++ b/gdb/testsuite/gdb.base/macscp.exp +++ b/gdb/testsuite/gdb.base/macscp.exp
@@ -27,6 +27,14 @@ if { [test_compiler_info "gcc-*"] } { @@ -20,6 +20,14 @@ set objfile [standard_output_file ${testfile}.o]
lappend options additional_flags=-fdebug-macro
} set options {debug macros additional_flags=-DFROM_COMMANDLINE=ARG}
+# Workaround ccache making lineno non-zero for command-line definitions. +# Workaround ccache making lineno non-zero for command-line definitions.
+if {[find_gcc] == "gcc" && [file executable "/usr/bin/gcc"]} { +if {[find_gcc] == "gcc" && [file executable "/usr/bin/gcc"]} {

View File

@ -9,7 +9,7 @@ Subject: gdb-container-rh-pkg.patch
diff --git a/gdb/remote.c b/gdb/remote.c diff --git a/gdb/remote.c b/gdb/remote.c
--- a/gdb/remote.c --- a/gdb/remote.c
+++ b/gdb/remote.c +++ b/gdb/remote.c
@@ -14343,7 +14343,17 @@ remote_target::pid_to_exec_file (int pid) @@ -14301,7 +14301,17 @@ remote_target::pid_to_exec_file (int pid)
char *annex = NULL; char *annex = NULL;
if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE) if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE)

View File

@ -25,9 +25,9 @@ diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/so
set bin_flags [list debug shlib=${binfile_lib}] set bin_flags [list debug shlib=${binfile_lib}]
+set executable ${testfile} +set executable ${testfile}
if [get_compiler_info] { if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
return -1 || [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } {
@@ -70,8 +71,26 @@ gdb_test "br foo2" \ @@ -66,8 +67,26 @@ gdb_test "br foo2" \
"Breakpoint.*: foo2. .2 locations..*" \ "Breakpoint.*: foo2. .2 locations..*" \
"foo2 in mdlib" "foo2 in mdlib"

View File

@ -12,7 +12,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1270534
diff --git a/gdb/configure b/gdb/configure diff --git a/gdb/configure b/gdb/configure
--- a/gdb/configure --- a/gdb/configure
+++ b/gdb/configure +++ b/gdb/configure
@@ -9568,6 +9568,7 @@ if test x"$prefer_curses" = xyes; then @@ -20915,6 +20915,7 @@ if test x"$prefer_curses" = xyes; then
# search /usr/local/include, if ncurses is installed in /usr/local. A # search /usr/local/include, if ncurses is installed in /usr/local. A
# default installation of ncurses on alpha*-dec-osf* will lead to such # default installation of ncurses on alpha*-dec-osf* will lead to such
# a situation. # a situation.
@ -20,7 +20,7 @@ diff --git a/gdb/configure b/gdb/configure
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing waddstr" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing waddstr" >&5
$as_echo_n "checking for library containing waddstr... " >&6; } $as_echo_n "checking for library containing waddstr... " >&6; }
if ${ac_cv_search_waddstr+:} false; then : if ${ac_cv_search_waddstr+:} false; then :
@@ -9592,7 +9593,7 @@ return waddstr (); @@ -20939,7 +20940,7 @@ return waddstr ();
return 0; return 0;
} }
_ACEOF _ACEOF
@ -29,7 +29,7 @@ diff --git a/gdb/configure b/gdb/configure
if test -z "$ac_lib"; then if test -z "$ac_lib"; then
ac_res="none required" ac_res="none required"
else else
@@ -9666,6 +9667,7 @@ case $host_os in @@ -21013,6 +21014,7 @@ case $host_os in
esac esac
# These are the libraries checked by Readline. # These are the libraries checked by Readline.
@ -37,7 +37,7 @@ diff --git a/gdb/configure b/gdb/configure
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5
$as_echo_n "checking for library containing tgetent... " >&6; } $as_echo_n "checking for library containing tgetent... " >&6; }
if ${ac_cv_search_tgetent+:} false; then : if ${ac_cv_search_tgetent+:} false; then :
@@ -9690,7 +9692,7 @@ return tgetent (); @@ -21037,7 +21039,7 @@ return tgetent ();
return 0; return 0;
} }
_ACEOF _ACEOF
@ -49,7 +49,7 @@ diff --git a/gdb/configure b/gdb/configure
diff --git a/gdb/configure.ac b/gdb/configure.ac diff --git a/gdb/configure.ac b/gdb/configure.ac
--- a/gdb/configure.ac --- a/gdb/configure.ac
+++ b/gdb/configure.ac +++ b/gdb/configure.ac
@@ -714,7 +714,8 @@ if test x"$prefer_curses" = xyes; then @@ -704,7 +704,8 @@ if test x"$prefer_curses" = xyes; then
# search /usr/local/include, if ncurses is installed in /usr/local. A # search /usr/local/include, if ncurses is installed in /usr/local. A
# default installation of ncurses on alpha*-dec-osf* will lead to such # default installation of ncurses on alpha*-dec-osf* will lead to such
# a situation. # a situation.
@ -59,7 +59,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac
if test "$ac_cv_search_waddstr" != no; then if test "$ac_cv_search_waddstr" != no; then
curses_found=yes curses_found=yes
@@ -756,7 +757,8 @@ case $host_os in @@ -746,7 +747,8 @@ case $host_os in
esac esac
# These are the libraries checked by Readline. # These are the libraries checked by Readline.

View File

@ -213,7 +213,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 diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4
--- a/gdbsupport/common.m4 --- a/gdbsupport/common.m4
+++ b/gdbsupport/common.m4 +++ b/gdbsupport/common.m4
@@ -156,7 +156,7 @@ AC_DEFUN([GDB_AC_COMMON], [ @@ -166,7 +166,7 @@ AC_DEFUN([GDB_AC_COMMON], [
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
#include <linux/perf_event.h> #include <linux/perf_event.h>
#ifndef PERF_ATTR_SIZE_VER5 #ifndef PERF_ATTR_SIZE_VER5

View File

@ -1,109 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Keith Seitz <keiths@redhat.com>
Date: Tue, 29 Nov 2022 13:43:34 -0800
Subject: gdb-rhbz2143992-libiberty-fix-c89isms-in-configure.patch
;; libiberty: Fix C89-isms in configure tests
;; (Florian Weimer, RHBZ 2143992)
libiberty/
* acinclude.m4 (ac_cv_func_strncmp_works): Add missing
int return type and parameter list to the definition of main.
Include <stdlib.h> and <string.h> for prototypes.
(ac_cv_c_stack_direction): Add missing
int return type and parameter list to the definitions of
main, find_stack_direction. Include <stdlib.h> for exit
prototype.
* configure: Regenerate.
diff --git a/libiberty/acinclude.m4 b/libiberty/acinclude.m4
--- a/libiberty/acinclude.m4
+++ b/libiberty/acinclude.m4
@@ -24,6 +24,8 @@ AC_CACHE_CHECK([for working strncmp], ac_cv_func_strncmp_works,
[AC_TRY_RUN([
/* Test by Jim Wilson and Kaveh Ghazi.
Check whether strncmp reads past the end of its string parameters. */
+#include <stdlib.h>
+#include <string.h>
#include <sys/types.h>
#ifdef HAVE_FCNTL_H
@@ -51,7 +53,8 @@ AC_CACHE_CHECK([for working strncmp], ac_cv_func_strncmp_works,
#define MAP_LEN 0x10000
-main ()
+int
+main (void)
{
#if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE)
char *p;
@@ -157,7 +160,10 @@ if test $ac_cv_os_cray = yes; then
fi
AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
-[AC_TRY_RUN([find_stack_direction ()
+[AC_TRY_RUN([#include <stdlib.h>
+
+int
+find_stack_direction (void)
{
static char *addr = 0;
auto char dummy;
@@ -169,7 +175,9 @@ AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
else
return (&dummy > addr) ? 1 : -1;
}
-main ()
+
+int
+main (void)
{
exit (find_stack_direction() < 0);
}],
diff --git a/libiberty/configure b/libiberty/configure
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -6918,7 +6918,10 @@ else
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-find_stack_direction ()
+#include <stdlib.h>
+
+int
+find_stack_direction (void)
{
static char *addr = 0;
auto char dummy;
@@ -6930,7 +6933,9 @@ find_stack_direction ()
else
return (&dummy > addr) ? 1 : -1;
}
-main ()
+
+int
+main (void)
{
exit (find_stack_direction() < 0);
}
@@ -7755,6 +7760,8 @@ else
/* Test by Jim Wilson and Kaveh Ghazi.
Check whether strncmp reads past the end of its string parameters. */
+#include <stdlib.h>
+#include <string.h>
#include <sys/types.h>
#ifdef HAVE_FCNTL_H
@@ -7782,7 +7789,8 @@ else
#define MAP_LEN 0x10000
-main ()
+int
+main (void)
{
#if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE)
char *p;

View File

@ -1,181 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Andrew Burgess <aburgess@redhat.com>
Date: Mon, 19 Dec 2022 15:57:59 +0000
Subject: gdb-rhbz2152431-label-symbol-value.patch
Backport these two upstream commits to fix bug 2152431:
commit 38665d717a3e65c70e6432243d5eed9728a4888a
Date: Mon Dec 12 14:09:40 2022 +0000
gdb: use gdb_assert not internal_error
And:
commit c3efaf0afd9d37004c42cdfd3ce0c1bfa979c45e
Date: Mon Dec 12 14:05:22 2022 +0000
gdb: fix crash when getting the value of a label symbol
diff --git a/gdb/findvar.c b/gdb/findvar.c
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -152,11 +152,7 @@ extract_long_unsigned_integer (const gdb_byte *addr, int orig_len,
CORE_ADDR
extract_typed_address (const gdb_byte *buf, struct type *type)
{
- if (!type->is_pointer_or_reference ())
- internal_error (__FILE__, __LINE__,
- _("extract_typed_address: "
- "type is not a pointer or reference"));
-
+ gdb_assert (type->is_pointer_or_reference ());
return gdbarch_pointer_to_address (type->arch (), type, buf);
}
@@ -205,11 +201,7 @@ template void store_integer (gdb_byte *addr, int len,
void
store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr)
{
- if (!type->is_pointer_or_reference ())
- internal_error (__FILE__, __LINE__,
- _("store_typed_address: "
- "type is not a pointer or reference"));
-
+ gdb_assert (type->is_pointer_or_reference ());
gdbarch_address_to_pointer (type->arch (), type, buf, addr);
}
@@ -634,19 +626,32 @@ language_defn::read_var_value (struct symbol *var,
case LOC_LABEL:
/* Put the constant back in target format. */
- v = allocate_value (type);
- if (overlay_debugging)
- {
- struct objfile *var_objfile = symbol_objfile (var);
- addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
- var->obj_section (var_objfile));
- store_typed_address (value_contents_raw (v).data (), type, addr);
- }
- else
- store_typed_address (value_contents_raw (v).data (), type,
- SYMBOL_VALUE_ADDRESS (var));
- VALUE_LVAL (v) = not_lval;
- return v;
+ {
+ /* Put the constant back in target format. */
+ if (overlay_debugging)
+ {
+ struct objfile *var_objfile = symbol_objfile (var);
+ addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
+ var->obj_section (var_objfile));
+ }
+ else
+ addr = SYMBOL_VALUE_ADDRESS (var);
+
+ /* First convert the CORE_ADDR to a function pointer type, this
+ ensures the gdbarch knows what type of pointer we are
+ manipulating when value_from_pointer is called. */
+ type = builtin_type (symbol_arch (var))->builtin_func_ptr;
+ v = value_from_pointer (type, addr);
+
+ /* But we want to present the value as 'void *', so cast it to the
+ required type now, this will not change the values bit
+ representation. */
+ struct type *void_ptr_type
+ = builtin_type (symbol_arch (var))->builtin_data_ptr;
+ v = value_cast_pointers (void_ptr_type, v, 0);
+ VALUE_LVAL (v) = not_lval;
+ return v;
+ }
case LOC_CONST_BYTES:
if (is_dynamic_type (type))
diff --git a/gdb/testsuite/gdb.python/py-label-symbol-value.c b/gdb/testsuite/gdb.python/py-label-symbol-value.c
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.python/py-label-symbol-value.c
@@ -0,0 +1,38 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2022 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+volatile int global_var = 1;
+
+int
+get_value ()
+{
+ return global_var;
+}
+
+int
+main (void)
+{
+ int value = get_value ();
+ if (value > 0)
+ goto some_label;
+
+ return 1;
+
+ some_label:
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.python/py-label-symbol-value.exp b/gdb/testsuite/gdb.python/py-label-symbol-value.exp
new file mode 100644
--- /dev/null
+++ b/gdb/testsuite/gdb.python/py-label-symbol-value.exp
@@ -0,0 +1,39 @@
+# Copyright 2022 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that GDB handles the user asking for the value of a label
+# symbol (i.e. a symbol for a goto label).
+
+load_lib gdb-python.exp
+standard_testfile
+
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
+ return -1
+}
+
+# Skip all tests if Python scripting is not enabled.
+if { [skip_python_tests] } { continue }
+
+if ![runto_main] {
+ return -1
+}
+
+# Use Python to print the value of the 'some_label' symbol.
+gdb_test "python frame = gdb.selected_frame()"
+gdb_test "python frame_pc = frame.pc()"
+gdb_test "python block = gdb.current_progspace().block_for_pc(frame_pc)"
+gdb_test "python symbol,_ = gdb.lookup_symbol('some_label', block, gdb.SYMBOL_LABEL_DOMAIN)"
+gdb_test "python print(str(symbol.value()))" "$hex <main\\+$decimal>"
+gdb_test "python print(str(symbol.value().type))" "void \\*"

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,9 @@
# Turn off the brp-python-bytecompile automagic # Turn off the brp-python-bytecompile automagic
%global _python_bytecompile_extra 0 %global _python_bytecompile_extra 0
# Disable LTO until upstream fixes GDB's ODR woes.
%define _lto_cflags %{nil}
# Only build on x86 for RHEL6 SCL, defining missing parallel make macros. # Only build on x86 for RHEL6 SCL, defining missing parallel make macros.
%if 0%{?scl:1} && 0%{?el6:1} %if 0%{?scl:1} && 0%{?el6:1}
ExclusiveArch: %{ix86} x86_64 ExclusiveArch: %{ix86} x86_64
@ -48,13 +51,13 @@ Name: %{?scl_prefix}gdb
# Freeze it when GDB gets branched # Freeze it when GDB gets branched
%global snapsrc 20220501 %global snapsrc 20220501
# See timestamp of source gnulib installed into gnulib/ . # See timestamp of source gnulib installed into gnulib/ .
%global snapgnulib 20210105 %global snapgnulib 20220501
%global tarname gdb-%{version} %global tarname gdb-%{version}
Version: 12.1 Version: 13.1
# The release always contains a leading reserved number, start it at 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. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
Release: 16%{?dist} Release: 1%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL
# Do not provide URL for snapshots as the file lasts there only for 2 days. # Do not provide URL for snapshots as the file lasts there only for 2 days.
@ -75,9 +78,7 @@ URL: https://gnu.org/software/gdb/
%undefine _debuginfo_subpackages %undefine _debuginfo_subpackages
# For DTS RHEL<=7 GDB it is better to use none than a Requires dependency. # For DTS RHEL<=7 GDB it is better to use none than a Requires dependency.
# We don't support gcc-gdb-plugin on RHEL anymore.
%if 0%{!?rhel:1} %if 0%{!?rhel:1}
Recommends: %{?scl_prefix}gcc-gdb-plugin%{?_isa}
Recommends: dnf-command(debuginfo-install) Recommends: dnf-command(debuginfo-install)
%endif %endif
@ -559,7 +560,7 @@ COMMON_GDB_CONFIGURE_FLAGS="\
--mandir=%{_mandir} \ --mandir=%{_mandir} \
--infodir=%{_infodir} \ --infodir=%{_infodir} \
--with-gdb-datadir=%{_datadir}/gdb \ --with-gdb-datadir=%{_datadir}/gdb \
--enable-gdb-build-warnings=,-Wno-unused,-Wno-deprecated-declarations,-Wno-unused-function\ --enable-gdb-build-warnings=,-Wno-unused,-Wno-deprecated-declarations,-Wno-unused-function,-Wno-stringop-overflow\
%ifarch %{ix86} %ifarch %{ix86}
,-Wno-format-overflow\ ,-Wno-format-overflow\
%endif %endif
@ -1038,10 +1039,11 @@ rm -rf $RPM_BUILD_ROOT%{_datadir}/locale/
rm -f $RPM_BUILD_ROOT%{_infodir}/bfd* rm -f $RPM_BUILD_ROOT%{_infodir}/bfd*
rm -f $RPM_BUILD_ROOT%{_infodir}/standard* rm -f $RPM_BUILD_ROOT%{_infodir}/standard*
rm -f $RPM_BUILD_ROOT%{_infodir}/configure* rm -f $RPM_BUILD_ROOT%{_infodir}/configure*
rm -f $RPM_BUILD_ROOT%{_infodir}/sframe-spec*
# Just exclude the header files in the top directory, and don't exclude # Just exclude the header files in the top directory, and don't exclude
# the gdb/ directory, as it contains jit-reader.h. # the gdb/ directory, as it contains jit-reader.h.
rm -rf $RPM_BUILD_ROOT%{_includedir}/*.h rm -rf $RPM_BUILD_ROOT%{_includedir}/*.h
rm -rf $RPM_BUILD_ROOT/%{_libdir}/lib{bfd*,opcodes*,iberty*,ctf*} rm -rf $RPM_BUILD_ROOT/%{_libdir}/lib{bfd*,opcodes*,iberty*,ctf*,sframe*}
# pstack obsoletion # pstack obsoletion
@ -1190,6 +1192,17 @@ fi
%endif %endif
%changelog %changelog
* Wed Mar 8 2023 Kevin Buettner <kevinb@redhat.com> - 13.1-1
- Rebase to FSF GDB 13.1.
- Update gdb-6.3-rh-testversion-20041202.patch.
- Update gdb-6.3-bz140532-ppc-unwinding-test.patch.
- Update gdb-6.6-buildid-locate.patch.
- Update gdb-6.6-buildid-locate-rpm.patch.
- Remove 'Recommends: ' line for gcc-gdb-plugin for BZ2149246.
- Add 'define _lto_cflags %{nil}' to avoid ODR violations.
- Add -Wno-stringop-overflow to --enable-gdb-build-warnings to work around
gcc problem.
* Fri Jan 27 2023 Kevin Buettner <kevinb@redhat.com> - 12.1-16 * Fri Jan 27 2023 Kevin Buettner <kevinb@redhat.com> - 12.1-16
- Tweak gdb-6.3-rh-testversion-20041202.patch so that $_gdb_major - Tweak gdb-6.3-rh-testversion-20041202.patch so that $_gdb_major
and $_gdb_minor will be obtained correctly. and $_gdb_minor will be obtained correctly.

View File

@ -1,3 +1,3 @@
SHA512 (gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz) = a8b1c54dd348cfeb37da73f968742896be3dd13a4215f8d8519870c2abea915f5176c3fa6989ddd10f20020a16f0fab20cbae68ee8d58a82234d8778023520f8 SHA512 (gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz) = a8b1c54dd348cfeb37da73f968742896be3dd13a4215f8d8519870c2abea915f5176c3fa6989ddd10f20020a16f0fab20cbae68ee8d58a82234d8778023520f8
SHA512 (v2.0.5.tar.gz) = 2e7ac2aede84671b15597d9c56dbe077a81357bbf44b6684802592246fb7729b4a5743238ddf02f6ea143b4d29872f581408135f9c1ea1ccc99dab905916d98d SHA512 (v2.0.5.tar.gz) = 2e7ac2aede84671b15597d9c56dbe077a81357bbf44b6684802592246fb7729b4a5743238ddf02f6ea143b4d29872f581408135f9c1ea1ccc99dab905916d98d
SHA512 (gdb-12.1.tar.xz) = 425568d2e84672177d0fb87b1ad7daafdde097648d605e30cf0656970f66adc6a82ca2d83375ea4be583e9683a340e5bfdf5819668ddf66728200141ae50ff2d SHA512 (gdb-13.1.tar.xz) = e65054ffbc0357eeed4b17e1edc5ef45aa73c9ddf3b1210651e3d859576e27c1d27b266800fe26328eda58857455ccd8632f4000cfc5f63f90854096290187ca