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.
This commit is contained in:
Kevin Buettner 2023-03-01 18:31:14 -07:00
parent cabda4d404
commit 47c2626ca3
24 changed files with 148 additions and 369 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

@ -310,9 +310,3 @@ Patch073: gdb-rhbz1398387-tab-crash-test.patch
# =fedoratest # =fedoratest
Patch074: gdb-rhbz1553104-s390x-arch12-test.patch Patch074: gdb-rhbz1553104-s390x-arch12-test.patch
Patch075: gdb-backport-readline_support.patch
Patch076: gdb-rhbz2152431-label-symbol-value.patch

View File

@ -72,5 +72,3 @@
%patch072 -p1 %patch072 -p1
%patch073 -p1 %patch073 -p1
%patch074 -p1 %patch074 -p1
%patch075 -p1
%patch076 -p1

View File

@ -1 +1 @@
e53a8e8685685c97588f8319d993ea6cd5635e47 4f3e26ac6ee31f7bc4b04abd8bdb944e7f1fc5d2

View File

@ -72,5 +72,3 @@ gdb-linux_perf-bundle.patch
gdb-libexec-add-index.patch gdb-libexec-add-index.patch
gdb-rhbz1398387-tab-crash-test.patch gdb-rhbz1398387-tab-crash-test.patch
gdb-rhbz1553104-s390x-arch12-test.patch gdb-rhbz1553104-s390x-arch12-test.patch
gdb-backport-readline_support.patch
gdb-rhbz2152431-label-symbol-value.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

@ -12,7 +12,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=953585
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
@@ -2797,6 +2797,16 @@ read_gdb_index_from_buffer (const char *filename, @@ -2568,6 +2568,16 @@ read_gdb_index_from_buffer (const char *filename,
"set use-deprecated-index-sections on". */ "set use-deprecated-index-sections on". */
if (version < 6 && !deprecated_ok) if (version < 6 && !deprecated_ok)
{ {
@ -29,7 +29,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
static int warning_printed = 0; static int warning_printed = 0;
if (!warning_printed) if (!warning_printed)
{ {
@@ -2808,6 +2818,10 @@ to use the section anyway."), @@ -2579,6 +2589,10 @@ to use the section anyway."),
warning_printed = 1; warning_printed = 1;
} }
return 0; return 0;

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
@ -258,7 +258,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 +270,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 +278,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 +286,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 +296,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 +305,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,494 @@ _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; }
@ -803,7 +803,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,199 @@ 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])
@ -1006,15 +1006,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 ();
@ -1023,7 +1023,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)
@ -1038,7 +1038,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,8 +59,8 @@ 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.
+ FIXME: NOTE decoding should be unified with the BFD core notes decoding. */ + FIXME: NOTE decoding should be unified with the BFD core notes decoding. */
@ -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,8 +539,8 @@ 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)
+ { + {
+ /* There can be multiple build-id symlinks pointing to real files + /* There can be multiple build-id symlinks pointing to real files
@ -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. */
@ -583,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;
@ -595,7 +595,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"));
- return {}; - return {};
+ continue; + continue;
@ -604,8 +604,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ 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,8 +620,8 @@ 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
+ { + {
@ -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,649 @@ 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 {};
} }
@ -1094,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)
+ { + {
@ -1143,7 +1149,6 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ }; + };
+static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED; +static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED;
+ +
+#endif /* HAVE_LIBRPM */
+ +
+void +void
+debug_flush_missing (void) +debug_flush_missing (void)
@ -1152,6 +1157,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ missing_rpm_list_print (); + missing_rpm_list_print ();
+#endif +#endif
+} +}
+#endif /* HAVE_LIBRPM */
+ +
+/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages +/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
+ yum --enablerepo='*debug*' install ... + yum --enablerepo='*debug*' install ...
@ -1306,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
@ -1351,17 +1357,17 @@ 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 +1337,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));
+ char *build_id_filename_cstr = NULL; + char *build_id_filename_cstr = NULL;
gdb_bfd_ref_ptr abfd (build_id_to_debug_bfd (build_id->size, gdb_bfd_ref_ptr abfd (build_id_to_debug_bfd (build_id->size,
@ -1382,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 +1364,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 ();
} }
@ -1455,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 ())
{ {
@ -1479,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. */
} }
@ -1488,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)
{ {
@ -1503,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));
@ -1517,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);
@ -1532,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
@ -1563,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)
{ {
@ -1585,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)
{ {
@ -1606,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)
{ {
@ -1617,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 ());
} }
@ -1640,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
@ -1649,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
@ -1661,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;
}; };
@ -1675,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
@ -1702,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;
} }
@ -1762,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);
@ -1796,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
} }
} }
@ -1857,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 { } {
} }
} }
@ -1888,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,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
@@ -9567,6 +9567,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 :
@@ -9591,7 +9592,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
@@ -9665,6 +9666,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 :
@@ -9689,7 +9691,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
@@ -713,7 +713,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
@@ -755,7 +756,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,181 +0,0 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Andrew Burgess <aburgess@redhat.com>
Date: Mon, 19 Dec 2022 17:24:51 +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 \\*"

View File

@ -36,7 +36,7 @@ diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
if {[info exists CFLAGS_FOR_TARGET]} { if {[info exists CFLAGS_FOR_TARGET]} {
append add_flags " $CFLAGS_FOR_TARGET" append add_flags " $CFLAGS_FOR_TARGET"
} }
@@ -531,10 +535,6 @@ proc gdb_default_target_compile_1 {source destfile type options} { @@ -516,10 +520,6 @@ proc gdb_default_target_compile_1 {source destfile type options} {
} }
} }

View File

@ -45,13 +45,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: 7%{?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.
@ -1037,10 +1037,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
@ -1189,6 +1190,13 @@ fi
%endif %endif
%changelog %changelog
* Wed Mar 1 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.
* Fri Jan 27 2023 Kevin Buettner <kevinb@redhat.com> - 12.1-7 * Fri Jan 27 2023 Kevin Buettner <kevinb@redhat.com> - 12.1-7
- 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