From: Jakub Bogusz Date: Fri, 12 Jan 2024 17:46:23 +0000 (+0100) Subject: - updated to 14.1 + rebased Fedora buildid patches set X-Git-Tag: auto/th/gdb-14.1-1 X-Git-Url: http://git.pld-linux.org/?p=packages%2Fgdb.git;a=commitdiff_plain - updated to 14.1 + rebased Fedora buildid patches set --- diff --git a/buildid-locate-rpm-pld.patch b/buildid-locate-rpm-pld.patch index a571282..d5e0914 100644 --- a/buildid-locate-rpm-pld.patch +++ b/buildid-locate-rpm-pld.patch @@ -1,18 +1,18 @@ ---- gdb-7.7.1/gdb/build-id.c.old 2014-06-05 14:31:11.000000000 +0200 -+++ gdb-7.7.1/gdb/build-id.c 2014-06-05 14:33:12.248235380 +0200 -@@ -1190,13 +1190,8 @@ - fprintf_unfiltered (gdb_stdlog, - _("Missing separate debuginfo for %s\n"), binary); - if (debug != NULL) -- fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"), +--- gdb-14.1/gdb/build-id.c.old 2014-06-05 14:31:11.000000000 +0200 ++++ gdb-14.1/gdb/build-id.c 2014-06-05 14:33:12.248235380 +0200 +@@ -1306,13 +1306,8 @@ debug_print_missing (const char *binary, + if (debug != NULL) + { + if (access (debug, F_OK) == 0) { +- gdb_printf (gdb_stdlog, _("Try: %s %s\n"), -#ifdef DNF_DEBUGINFO_INSTALL -- "dnf" +- "dnf" -#else -- "yum" +- "yum" -#endif -- " --enablerepo='*debug*' install", debug); -+ fprintf_unfiltered (gdb_stdlog, _("Try to install package that provides `%s' file\n"), -+ debug); - } - } - +- " --enablerepo='*debug*' install", debug); ++ gdb_printf (gdb_stdlog, _("Try to install package that provides `%s' file\n"), ++ debug); + } else + gdb_printf (gdb_stdlog, _("The debuginfo package for this file is probably broken.\n")); + } diff --git a/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch index 6f6ecfb..01e8ffa 100644 --- a/gdb-6.3-gstack-20050411.patch +++ b/gdb-6.3-gstack-20050411.patch @@ -16,7 +16,7 @@ Subject: gdb-6.3-gstack-20050411.patch diff --git a/gdb/Makefile.in b/gdb/Makefile.in --- a/gdb/Makefile.in +++ b/gdb/Makefile.in -@@ -1767,7 +1767,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force +@@ -2035,7 +2035,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force install: all @$(MAKE) $(FLAGS_TO_PASS) install-only @@ -25,7 +25,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in transformed_name=`t='$(program_transform_name)'; \ echo gdb | sed -e "$$t"` ; \ if test "x$$transformed_name" = x; then \ -@@ -1816,7 +1816,25 @@ install-guile: +@@ -2085,7 +2085,25 @@ install-guile: install-python: $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb @@ -52,7 +52,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in transformed_name=`t='$(program_transform_name)'; \ echo gdb | sed -e $$t` ; \ if test "x$$transformed_name" = x; then \ -@@ -1847,6 +1865,18 @@ uninstall: force $(CONFIG_UNINSTALL) +@@ -2116,6 +2134,18 @@ uninstall: force $(CONFIG_UNINSTALL) rm -f $(DESTDIR)$(bindir)/$$transformed_name @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do diff --git a/gdb-6.6-buildid-locate-rpm-scl.patch b/gdb-6.6-buildid-locate-rpm-scl.patch deleted file mode 100644 index 7d4389a..0000000 --- a/gdb-6.6-buildid-locate-rpm-scl.patch +++ /dev/null @@ -1,42 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 -Subject: gdb-6.6-buildid-locate-rpm-scl.patch - -;; [SCL] Skip deprecated .gdb_index warning for Red Hat built files (BZ 953585). -;;=push+jan - -warning: Skipping deprecated .gdb_index section -https://bugzilla.redhat.com/show_bug.cgi?id=953585 - -diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c ---- a/gdb/dwarf2/read.c -+++ b/gdb/dwarf2/read.c -@@ -2797,6 +2797,16 @@ read_gdb_index_from_buffer (const char *filename, - "set use-deprecated-index-sections on". */ - if (version < 6 && !deprecated_ok) - { -+#ifdef GDB_INDEX_VERIFY_VENDOR -+ extern int rpm_verify_vendor (const char *filename); -+ -+ /* Red Hat Developer Toolset exception. */ -+ if (rpm_verify_vendor (filename)) -+ {} -+ else -+ { -+ -+#endif - static int warning_printed = 0; - if (!warning_printed) - { -@@ -2808,6 +2818,10 @@ to use the section anyway."), - warning_printed = 1; - } - return 0; -+#ifdef GDB_INDEX_VERIFY_VENDOR -+ -+ } -+#endif - } - /* Version 7 indices generated by gold refer to the CU for a symbol instead - of the TU (for symbols coming from TUs), diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch index efaf989..f38fdd5 100644 --- a/gdb-6.6-buildid-locate-rpm.patch +++ b/gdb-6.6-buildid-locate-rpm.patch @@ -1,6 +1,6 @@ From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Fedora GDB patches -Date: Fri, 27 Oct 2017 21:07:50 +0200 +From: Kevin Buettner +Date: Wed, 22 Feb 2023 22:30:40 -0700 Subject: gdb-6.6-buildid-locate-rpm.patch ;;=push+jan @@ -232,10 +232,44 @@ diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 # AM_AUX_DIR_EXPAND -*- Autoconf -*- # 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 +@@ -780,10 +780,10 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor) + static rpmts (*rpmtsCreate_p) (void); + extern rpmts rpmtsFree(rpmts ts); + static rpmts (*rpmtsFree_p) (rpmts ts); +- 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 */ +@@ -838,7 +838,7 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor) + && (rpmdbNextIterator_p = (Header (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbNextIterator")) + && (rpmtsCreate_p = (rpmts (*) (void)) dlsym (h, "rpmtsCreate")) + && (rpmtsFree_p = (rpmts (*) (rpmts ts)) dlsym (h, "rpmtsFree")) +- && (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"), +@@ -926,7 +926,7 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor) + + /* RPMDBI_PACKAGES requires keylen == sizeof (int). */ + /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */ +- 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 --- a/gdb/config.in +++ b/gdb/config.in -@@ -39,6 +39,9 @@ +@@ -42,6 +42,9 @@ /* Handle .ctf type-info sections */ #undef ENABLE_LIBCTF @@ -245,9 +279,9 @@ diff --git a/gdb/config.in b/gdb/config.in /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS -@@ -259,6 +262,9 @@ - /* Define if you have the mpfr library. */ - #undef HAVE_LIBMPFR +@@ -265,6 +268,9 @@ + /* Define to 1 if you have the `m' library (-lm). */ + #undef HAVE_LIBM +/* Define if librpm library is being used. */ +#undef HAVE_LIBRPM @@ -258,7 +292,7 @@ diff --git a/gdb/config.in b/gdb/config.in diff --git a/gdb/configure b/gdb/configure --- a/gdb/configure +++ b/gdb/configure -@@ -775,6 +775,11 @@ TARGET_OBS +@@ -778,6 +778,11 @@ AMD_DBGAPI_CFLAGS ENABLE_BFD_64_BIT_FALSE ENABLE_BFD_64_BIT_TRUE subdirs @@ -270,25 +304,25 @@ diff --git a/gdb/configure b/gdb/configure GDB_DATADIR DEBUGDIR MAKEINFO_EXTRA_FLAGS -@@ -880,6 +885,7 @@ with_gdb_datadir +@@ -911,6 +916,7 @@ with_gdb_datadir with_relocated_sources with_auto_load_dir with_auto_load_safe_path +with_rpm enable_targets enable_64_bit_bfd - enable_gdbmi -@@ -959,6 +965,8 @@ PKG_CONFIG_PATH - PKG_CONFIG_LIBDIR + with_amd_dbgapi +@@ -988,6 +994,8 @@ AMD_DBGAPI_CFLAGS + AMD_DBGAPI_LIBS DEBUGINFOD_CFLAGS DEBUGINFOD_LIBS +RPM_CFLAGS +RPM_LIBS YACC YFLAGS - XMKMF' -@@ -1635,6 +1643,8 @@ Optional Packages: - do not restrict auto-loaded files locations + ZSTD_CFLAGS +@@ -1679,6 +1687,8 @@ Optional Packages: + --with-amd-dbgapi support for the amd-dbgapi target (yes / no / auto) --with-debuginfod Enable debuginfo lookups with debuginfod (auto/yes/no) + --with-rpm query rpm database for missing debuginfos (yes/no, @@ -296,7 +330,7 @@ diff --git a/gdb/configure b/gdb/configure --with-libunwind-ia64 use libunwind frame unwinding for ia64 targets --with-curses use the curses library instead of the termcap library -@@ -1715,6 +1725,8 @@ Some influential environment variables: +@@ -1759,6 +1769,8 @@ Some influential environment variables: C compiler flags for DEBUGINFOD, overriding pkg-config DEBUGINFOD_LIBS linker flags for DEBUGINFOD, overriding pkg-config @@ -305,7 +339,7 @@ diff --git a/gdb/configure b/gdb/configure YACC The `Yet Another Compiler Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. -@@ -6634,6 +6646,494 @@ _ACEOF +@@ -18039,6 +18051,495 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5 $as_echo "$with_auto_load_safe_path" >&6; } @@ -369,6 +403,7 @@ diff --git a/gdb/configure b/gdb/configure +#include +#include +#include ++#include + +int +main () @@ -485,7 +520,7 @@ diff --git a/gdb/configure b/gdb/configure +extern Header rpmdbNextIterator(rpmdbMatchIterator mi); +extern rpmts rpmtsCreate(void); +extern rpmts rpmtsFree(rpmts ts); -+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, + const void * keyp, size_t keylen); + +int @@ -747,7 +782,7 @@ diff --git a/gdb/configure b/gdb/configure +extern Header rpmdbNextIterator(rpmdbMatchIterator mi); +extern rpmts rpmtsCreate(void); +extern rpmts rpmtsFree(rpmts ts); -+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, + const void * keyp, size_t keylen); + +int @@ -803,7 +838,7 @@ diff --git a/gdb/configure b/gdb/configure diff --git a/gdb/configure.ac b/gdb/configure.ac --- a/gdb/configure.ac +++ b/gdb/configure.ac -@@ -153,6 +153,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir, +@@ -173,6 +173,200 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir, [Directories safe to hold auto-loaded files.]) AC_MSG_RESULT([$with_auto_load_safe_path]) @@ -853,6 +888,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac +#include +#include +#include ++#include + ]], [[ + void *h; + const char *const *rpmverp; @@ -947,7 +983,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac +extern Header rpmdbNextIterator(rpmdbMatchIterator mi); +extern rpmts rpmtsCreate(void); +extern rpmts rpmtsFree(rpmts ts); -+extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, + const void * keyp, size_t keylen); + ]]), [ + LIBRPM_COMPAT=true @@ -1006,15 +1042,15 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac diff --git a/gdb/event-top.c b/gdb/event-top.c --- a/gdb/event-top.c +++ b/gdb/event-top.c -@@ -42,6 +42,7 @@ - #include "gdbsupport/gdb-sigmask.h" +@@ -43,6 +43,7 @@ #include "async-event.h" #include "bt-utils.h" + #include "pager.h" +#include "symfile.h" /* readline include files. */ #include "readline/readline.h" -@@ -374,6 +375,8 @@ display_gdb_prompt (const char *new_prompt) +@@ -404,6 +405,8 @@ display_gdb_prompt (const char *new_prompt) /* Reset the nesting depth used when trace-commands is set. */ reset_command_nest_depth (); @@ -1023,7 +1059,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c /* Do not call the python hook on an explicit prompt change as passed to this function, as this forms a secondary/local prompt, IE, displayed but not set. */ -@@ -800,7 +803,10 @@ command_line_handler (gdb::unique_xmalloc_ptr &&rl) +@@ -788,7 +791,10 @@ command_line_handler (gdb::unique_xmalloc_ptr &&rl) command_handler (cmd); if (ui->prompt_state != PROMPTED) @@ -1038,7 +1074,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c diff --git a/gdb/symfile.h b/gdb/symfile.h --- a/gdb/symfile.h +++ b/gdb/symfile.h -@@ -342,6 +342,7 @@ extern void generic_load (const char *args, int from_tty); +@@ -367,6 +367,7 @@ extern void generic_load (const char *args, int from_tty); /* build-id support. */ extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr); extern void debug_print_missing (const char *binary, const char *debug); diff --git a/gdb-6.6-buildid-locate-solib-missing-ids.patch b/gdb-6.6-buildid-locate-solib-missing-ids.patch index df45319..e9ec7b5 100644 --- a/gdb-6.6-buildid-locate-solib-missing-ids.patch +++ b/gdb-6.6-buildid-locate-solib-missing-ids.patch @@ -14,7 +14,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1339862 diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c -@@ -1250,14 +1250,28 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, +@@ -1320,14 +1320,28 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, } { @@ -45,7 +45,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c if (build_id != NULL) { char *name, *build_id_filename; -@@ -1272,23 +1286,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, +@@ -1342,23 +1356,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, xfree (name); } else diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch index 6229244..1350051 100644 --- a/gdb-6.6-buildid-locate.patch +++ b/gdb-6.6-buildid-locate.patch @@ -9,7 +9,7 @@ Subject: gdb-6.6-buildid-locate.patch diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h -@@ -115,7 +115,7 @@ static inline char * +@@ -110,7 +110,7 @@ static inline char * bfd_strdup (const char *str) { size_t len = strlen (str) + 1; @@ -21,7 +21,7 @@ diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h diff --git a/bfd/libbfd.h b/bfd/libbfd.h --- a/bfd/libbfd.h +++ b/bfd/libbfd.h -@@ -120,7 +120,7 @@ static inline char * +@@ -116,7 +116,7 @@ static inline char * bfd_strdup (const char *str) { size_t len = strlen (str) + 1; @@ -33,7 +33,7 @@ diff --git a/bfd/libbfd.h b/bfd/libbfd.h diff --git a/gdb/build-id.c b/gdb/build-id.c --- a/gdb/build-id.c +++ b/gdb/build-id.c -@@ -24,13 +24,71 @@ +@@ -24,14 +24,72 @@ #include "gdbsupport/gdb_vecs.h" #include "symfile.h" #include "objfiles.h" @@ -46,6 +46,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c +#include "gdb_bfd.h" +#include "gdbcmd.h" #include "gdbcore.h" + #include "cli/cli-style.h" +#include "inferior.h" +#include "objfiles.h" +#include "observable.h" @@ -59,8 +60,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c +show_build_id_verbose (struct ui_file *file, int from_tty, + struct cmd_list_element *c, const char *value) +{ -+ fprintf_filtered (file, _("Verbosity level of the build-id locator is %s.\n"), -+ value); ++ gdb_printf (file, _("Verbosity level of the build-id locator is %s.\n"), ++ value); +} +/* Locate NT_GNU_BUILD_ID and return its matching debug filename. + FIXME: NOTE decoding should be unified with the BFD core notes decoding. */ @@ -104,9 +105,9 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c -build_id_bfd_get (bfd *abfd) +build_id_bfd_shdr_get (bfd *abfd) { - if (!bfd_check_format (abfd, bfd_object) - && !bfd_check_format (abfd, bfd_core)) -@@ -43,6 +101,348 @@ build_id_bfd_get (bfd *abfd) + /* Dynamic objfiles such as ones created by JIT reader API + have no underlying bfd structure (that is, objfile->obfd +@@ -50,6 +108,348 @@ build_id_bfd_get (bfd *abfd) return NULL; } @@ -455,7 +456,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c /* See build-id.h. */ int -@@ -51,7 +451,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) +@@ -58,7 +458,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) const struct bfd_build_id *found; int retval = 0; @@ -464,7 +465,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c if (found == NULL) warning (_("File \"%s\" has no build-id, file skipped"), -@@ -66,63 +466,166 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) +@@ -73,63 +473,166 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) return retval; } @@ -517,9 +518,9 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + 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); -+ fprintf_unfiltered (gdb_stdlog, _(" Trying %s..."), orig_link.c_str ()); ++ gdb_printf (gdb_stdlog, _(" Trying %s..."), orig_link.c_str ()); + gdb_flush (gdb_stdout); } @@ -539,8 +540,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c - if (filename == NULL) - { - if (separate_debug_file_debug) -- fprintf_unfiltered (gdb_stdlog, -- _(" no, unable to compute real path\n")); +- gdb_printf (gdb_stdlog, +- _(" no, unable to compute real path\n")); + if (seqno > 0) + { + /* There can be multiple build-id symlinks pointing to real files @@ -559,7 +560,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c - if (debug_bfd == NULL) - { - 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; + + /* `access' automatically dereferences LINK. */ @@ -583,7 +584,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + if (filename == NULL) + { + if (separate_debug_file_debug) -+ fprintf_unfiltered (gdb_stdlog, ++ gdb_printf (gdb_stdlog, + _(" no, unable to compute real path\n")); + + continue; @@ -595,7 +596,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + if (debug_bfd == NULL) + { + 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; @@ -604,8 +605,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 (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")); + + continue; + } @@ -620,8 +621,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + if (ret_bfd != NULL) { if (separate_debug_file_debug) -- fprintf_unfiltered (gdb_stdlog, _(" no, build-id does not match.\n")); -+ fprintf_unfiltered (gdb_stdlog, _(" yes!\n")); +- gdb_printf (gdb_stdlog, _(" no, build-id does not match.\n")); ++ gdb_printf (gdb_stdlog, _(" yes!\n")); + } + else + { @@ -646,7 +647,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c } - if (separate_debug_file_debug) -- fprintf_unfiltered (gdb_stdlog, _(" yes!\n")); +- gdb_printf (gdb_stdlog, _(" yes!\n")); + if (link_return != NULL) + { + if (ret_bfd != NULL) @@ -664,7 +665,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c } /* Common code for finding BFDs of a given build-id. This function -@@ -131,7 +634,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len, +@@ -138,7 +641,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len, static gdb_bfd_ref_ptr build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, @@ -673,7 +674,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c { /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will cause "/.build-id/..." lookups. */ -@@ -154,16 +657,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, +@@ -161,16 +664,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, if (size > 0) { size--; @@ -694,17 +695,16 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c if (debug_bfd != NULL) return debug_bfd; -@@ -174,7 +678,8 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, +@@ -181,7 +685,7 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, if (!gdb_sysroot.empty ()) { link = gdb_sysroot + link; - debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id); -+ debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id, -+ link_return); ++ debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id, NULL); if (debug_bfd != NULL) return debug_bfd; } -@@ -183,30 +688,649 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, +@@ -190,31 +694,663 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, return {}; } @@ -722,6 +722,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + return result; +} + ++void debug_flush_missing (void); ++ +#ifdef HAVE_LIBRPM + +#include @@ -1095,20 +1097,26 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + debug_flush_missing -> missing_rpm_list_print ... + + 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; + -+ printf_unfiltered (_("Missing separate debuginfos, use: %s"), ++ gdb_printf (_("Missing separate debuginfos, use: %s"), +#ifdef DNF_DEBUGINFO_INSTALL + "dnf " +#endif + "debuginfo-install"); + for (const char *el : array) + { -+ puts_unfiltered (" "); -+ puts_unfiltered (el); ++ gdb_printf (" %s", el); + } -+ puts_unfiltered ("\n"); ++ gdb_printf ("\n"); + + while (missing_rpm_list != NULL) + { @@ -1215,7 +1223,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c +} + +static void -+debug_print_executable_changed (void) ++debug_print_executable_changed (struct program_space *pspace, bool reload_p) +{ +#ifdef HAVE_LIBRPM + missing_rpm_change (); @@ -1307,16 +1315,21 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + /* We do not collect and flush these messages as each such message + already requires its own separate lines. */ + -+ fprintf_unfiltered (gdb_stdlog, -+ _("Missing separate debuginfo for %s\n"), binary); -+ if (debug != NULL) -+ fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"), ++ gdb_printf (gdb_stdlog, ++ _("Missing separate debuginfo for %s.\n"), binary); ++ if (debug != NULL) ++ { ++ if (access (debug, F_OK) == 0) { ++ gdb_printf (gdb_stdlog, _("Try: %s %s\n"), +#ifdef DNF_DEBUGINFO_INSTALL -+ "dnf" ++ "dnf" +#else -+ "yum" ++ "yum" +#endif -+ " --enablerepo='*debug*' install", debug); ++ " --enablerepo='*debug*' install", debug); ++ } else ++ gdb_printf (gdb_stdlog, _("The debuginfo package for this file is probably broken.\n")); ++ } + } +} + @@ -1346,23 +1359,24 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c /* See build-id.h. */ std::string --find_separate_debug_file_by_buildid (struct objfile *objfile) -+find_separate_debug_file_by_buildid (struct objfile *objfile, -+ gdb::unique_xmalloc_ptr *build_id_filename_return) + find_separate_debug_file_by_buildid (struct objfile *objfile, +- deferred_warnings *warnings) ++ deferred_warnings *warnings, ++ gdb::unique_xmalloc_ptr *build_id_filename_return) { 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) + *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 (separate_debug_file_debug) -@@ -214,8 +1338,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) - _("\nLooking for separate debug info (build-id) for " - "%s\n"), objfile_name (objfile)); +@@ -222,8 +1358,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile, + _("\nLooking for separate debug info (build-id) for " + "%s\n"), objfile_name (objfile)); + char *build_id_filename_cstr = NULL; gdb_bfd_ref_ptr abfd (build_id_to_debug_bfd (build_id->size, @@ -1383,7 +1397,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c /* Prevent looping on a stripped .debug file. */ if (abfd != NULL && filename_cmp (bfd_get_filename (abfd.get ()), -@@ -228,3 +1365,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) +@@ -243,3 +1392,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile, return std::string (); } @@ -1422,7 +1436,7 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h /* Return true if ABFD has NT_GNU_BUILD_ID matching the CHECK value. Otherwise, issue a warning and return false. */ -@@ -38,21 +39,26 @@ extern int build_id_verify (bfd *abfd, +@@ -38,14 +39,19 @@ extern int build_id_verify (bfd *abfd, can be found, return NULL. */ extern gdb_bfd_ref_ptr build_id_to_debug_bfd (size_t build_id_len, @@ -1444,35 +1458,35 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h /* Find the separate debug file for OBJFILE, by using the build-id associated with OBJFILE's BFD. If successful, returns the file name for the - separate debug file, otherwise, return an empty string. */ +@@ -58,7 +64,8 @@ extern gdb_bfd_ref_ptr build_id_to_exec_bfd (size_t build_id_len, + will be printed. */ --extern std::string find_separate_debug_file_by_buildid -- (struct objfile *objfile); -+extern std::string find_separate_debug_file_by_buildid (struct objfile *objfile, -+ gdb::unique_xmalloc_ptr *build_id_filename_return); + extern std::string find_separate_debug_file_by_buildid +- (struct objfile *objfile, deferred_warnings *warnings); ++ (struct objfile *objfile, deferred_warnings *warnings, ++ gdb::unique_xmalloc_ptr *build_id_filename_return); /* Return an hex-string representation of BUILD_ID. */ diff --git a/gdb/coffread.c b/gdb/coffread.c --- a/gdb/coffread.c +++ b/gdb/coffread.c -@@ -710,7 +710,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) - /* Try to add separate debug file if no symbols table found. */ - if (!objfile->has_partial_symbols ()) +@@ -729,7 +729,7 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) { -- std::string debugfile = find_separate_debug_file_by_buildid (objfile); -+ std::string debugfile = find_separate_debug_file_by_buildid (objfile, -+ NULL); + deferred_warnings warnings; + std::string debugfile +- = find_separate_debug_file_by_buildid (objfile, &warnings); ++ = find_separate_debug_file_by_buildid (objfile, &warnings, NULL); if (debugfile.empty ()) - debugfile = find_separate_debug_file_by_debuglink (objfile); + debugfile diff --git a/gdb/corelow.c b/gdb/corelow.c --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -22,6 +22,10 @@ #include #include - #include "frame.h" /* required by inferior.h */ + #include "frame.h" +#include "auxv.h" +#include "build-id.h" +#include "elf/common.h" @@ -1480,7 +1494,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c #include "inferior.h" #include "infrun.h" #include "symtab.h" -@@ -356,6 +360,8 @@ add_to_thread_list (asection *asect, asection *reg_sect) +@@ -380,6 +384,8 @@ add_to_thread_list (asection *asect, asection *reg_sect, inferior *inf) switch_to_thread (thr); /* Yes, make it current. */ } @@ -1489,7 +1503,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c /* Issue a message saying we have no core to debug, if FROM_TTY. */ static void -@@ -392,19 +398,26 @@ core_file_command (const char *filename, int from_tty) +@@ -563,12 +569,14 @@ rename_vmcore_idle_reg_sections (bfd *abfd, inferior *inf) static void locate_exec_from_corefile_build_id (bfd *abfd, int from_tty) { @@ -1504,8 +1518,9 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c + = build_id_to_exec_bfd (build_id->size, build_id->data, + &build_id_filename); - if (execbfd != nullptr) + if (execbfd == nullptr) { +@@ -596,7 +604,12 @@ locate_exec_from_corefile_build_id (bfd *abfd, int from_tty) exec_file_attach (bfd_get_filename (execbfd.get ()), from_tty); symbol_file_add_main (bfd_get_filename (execbfd.get ()), symfile_add_flag (from_tty ? SYMFILE_VERBOSE : 0)); @@ -1518,7 +1533,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c } /* See gdbcore.h. */ -@@ -1209,4 +1222,11 @@ _initialize_corelow () +@@ -1506,4 +1519,11 @@ _initialize_corelow () maintenance_print_core_file_backed_mappings, _("Print core file's file-backed mappings."), &maintenanceprintlist); @@ -1533,7 +1548,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo -@@ -21524,6 +21524,27 @@ information files. +@@ -22296,6 +22296,27 @@ information files. @end table @@ -1564,16 +1579,16 @@ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c --- a/gdb/dwarf2/index-cache.c +++ b/gdb/dwarf2/index-cache.c -@@ -97,7 +97,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile) +@@ -96,7 +96,7 @@ index_cache_store_context::index_cache_store_context (const index_cache &ic, return; /* Get build id of objfile. */ -- const bfd_build_id *build_id = build_id_bfd_get (obj->obfd); -+ const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd); +- const bfd_build_id *build_id = build_id_bfd_get (per_bfd->obfd); ++ const bfd_build_id *build_id = build_id_bfd_shdr_get (per_bfd->obfd); if (build_id == nullptr) { index_cache_debug ("objfile %s has no build id", -@@ -114,7 +114,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile) +@@ -111,7 +111,8 @@ index_cache_store_context::index_cache_store_context (const index_cache &ic, if (dwz != nullptr) { @@ -1586,16 +1601,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 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c -@@ -5476,7 +5476,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner) +@@ -3355,7 +3355,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner) static gdb::array_view 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_shdr_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.get ()); if (build_id == nullptr) return {}; -@@ -5489,7 +5489,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd) +@@ -3368,7 +3368,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd) static gdb::array_view get_gdb_index_contents_from_cache_dwz (objfile *obj, dwz_file *dwz) { @@ -1607,41 +1622,43 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c diff --git a/gdb/elfread.c b/gdb/elfread.c --- a/gdb/elfread.c +++ b/gdb/elfread.c -@@ -1270,7 +1270,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) - && objfile->separate_debug_objfile == NULL - && objfile->separate_debug_objfile_backlink == NULL) +@@ -1220,8 +1220,10 @@ elf_symfile_read_dwarf2 (struct objfile *objfile, { -- std::string debugfile = find_separate_debug_file_by_buildid (objfile); + deferred_warnings warnings; + + gdb::unique_xmalloc_ptr build_id_filename; -+ std::string debugfile -+ = find_separate_debug_file_by_buildid (objfile, &build_id_filename); + std::string debugfile +- = find_separate_debug_file_by_buildid (objfile, &warnings); ++ = find_separate_debug_file_by_buildid (objfile, &warnings, ++ &build_id_filename); if (debugfile.empty ()) - debugfile = find_separate_debug_file_by_debuglink (objfile); -@@ -1285,7 +1287,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) - else + debugfile = find_separate_debug_file_by_debuglink (objfile, &warnings); +@@ -1239,7 +1241,7 @@ elf_symfile_read_dwarf2 (struct objfile *objfile, { has_dwarf2 = false; -- const struct bfd_build_id *build_id = build_id_bfd_get (objfile->obfd); -+ const struct bfd_build_id *build_id = build_id_bfd_shdr_get (objfile->obfd); + const struct bfd_build_id *build_id +- = 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) - { -@@ -1310,6 +1312,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) +@@ -1265,6 +1267,11 @@ elf_symfile_read_dwarf2 (struct objfile *objfile, has_dwarf2 = true; } } + /* 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) + debug_print_missing (objfile_name (objfile), build_id_filename.get ()); } } - } + /* If all the methods to collect the debuginfo failed, print the diff --git a/gdb/exec.c b/gdb/exec.c --- a/gdb/exec.c +++ b/gdb/exec.c -@@ -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); const bfd_build_id *exec_file_build_id @@ -1650,7 +1667,7 @@ diff --git a/gdb/exec.c b/gdb/exec.c if (exec_file_build_id != nullptr) { /* 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) { const bfd_build_id *target_exec_file_build_id @@ -1662,8 +1679,8 @@ diff --git a/gdb/exec.c b/gdb/exec.c diff --git a/gdb/objfiles.h b/gdb/objfiles.h --- a/gdb/objfiles.h +++ b/gdb/objfiles.h -@@ -769,6 +769,10 @@ struct objfile - bool skip_jit_symbol_lookup = false; +@@ -884,6 +884,10 @@ struct objfile + bool object_format_has_copy_relocs = false; }; +/* This file was loaded according to the BUILD_ID_CORE_LOADS rules. */ @@ -1676,36 +1693,36 @@ diff --git a/gdb/objfiles.h b/gdb/objfiles.h diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c --- a/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 { -- build_id = build_id_bfd_get (objfile->obfd); -+ build_id = build_id_bfd_shdr_get (objfile->obfd); +- build_id = build_id_bfd_get (objfile->obfd.get ()); ++ build_id = build_id_bfd_shdr_get (objfile->obfd.get ()); } catch (const gdb_exception &except) { -@@ -600,7 +600,7 @@ objfpy_lookup_objfile_by_build_id (const char *build_id) - /* Don't return separate debug files. */ - if (objfile->separate_debug_objfile_backlink != NULL) - continue; -- obfd_build_id = build_id_bfd_get (objfile->obfd); -+ obfd_build_id = build_id_bfd_shdr_get (objfile->obfd); - if (obfd_build_id == NULL) - continue; - if (objfpy_build_id_matches (obfd_build_id, build_id)) +@@ -629,7 +629,7 @@ gdbpy_lookup_objfile (PyObject *self, PyObject *args, PyObject *kw) + if (obfd == nullptr) + return 0; + +- const bfd_build_id *obfd_build_id = build_id_bfd_get (obfd); ++ const bfd_build_id *obfd_build_id = build_id_bfd_shdr_get (obfd); + if (obfd_build_id == nullptr) + return 0; + diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c -@@ -45,6 +45,7 @@ +@@ -44,6 +44,7 @@ #include "auxv.h" #include "gdb_bfd.h" #include "probe.h" +#include "build-id.h" - static struct link_map_offsets *svr4_fetch_link_map_offsets (void); - 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, + #include + +@@ -1318,9 +1319,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, continue; } @@ -1763,19 +1780,19 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c diff --git a/gdb/source.c b/gdb/source.c --- a/gdb/source.c +++ b/gdb/source.c -@@ -1199,7 +1199,7 @@ open_source_file (struct symtab *s) - srcpath += s->filename; +@@ -1167,7 +1167,7 @@ open_source_file (struct symtab *s) } -- const struct bfd_build_id *build_id = build_id_bfd_get (ofp->obfd); -+ const struct bfd_build_id *build_id = build_id_bfd_shdr_get (ofp->obfd); + const struct bfd_build_id *build_id +- = build_id_bfd_get (ofp->obfd.get ()); ++ = build_id_bfd_shdr_get (ofp->obfd.get ()); /* Query debuginfod for the source file. */ if (build_id != nullptr && !srcpath.empty ()) diff --git a/gdb/symfile.h b/gdb/symfile.h --- a/gdb/symfile.h +++ b/gdb/symfile.h -@@ -332,12 +332,18 @@ bool expand_symtabs_matching +@@ -357,12 +357,18 @@ bool expand_symtabs_matching void map_symbol_filenames (gdb::function_view fun, bool need_fullname); @@ -1797,7 +1814,7 @@ diff --git a/gdb/symfile.h b/gdb/symfile.h diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp --- a/gdb/testsuite/gdb.base/corefile.exp +++ b/gdb/testsuite/gdb.base/corefile.exp -@@ -343,3 +343,33 @@ gdb_test_multiple "core-file $corefile" $test { +@@ -347,3 +347,33 @@ gdb_test_multiple "core-file $corefile" $test { pass $test } } @@ -1834,7 +1851,7 @@ diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefi diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp --- a/gdb/testsuite/gdb.base/gdbinit-history.exp +++ b/gdb/testsuite/gdb.base/gdbinit-history.exp -@@ -185,7 +185,8 @@ proc test_empty_history_filename { } { +@@ -179,7 +179,8 @@ proc test_empty_history_filename { } { global env global gdb_prompt @@ -1858,17 +1875,17 @@ diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp -@@ -141,7 +141,8 @@ if ![info exists INTERNAL_GDBFLAGS] { +@@ -226,7 +226,8 @@ if ![info exists INTERNAL_GDBFLAGS] { "-nx" \ - "-data-directory $BUILD_DATA_DIRECTORY" \ + "-q" \ {-iex "set height 0"} \ - {-iex "set width 0"}]] + {-iex "set width 0"} \ + {-iex "set build-id-verbose 0"}]] - } - # The variable gdb_prompt is a regexp which matches the gdb prompt. -@@ -2200,6 +2201,17 @@ proc default_gdb_start { } { + # If DEBUGINFOD_URLS is set, gdb will try to download sources and + # debug info for f.i. system libraries. Prevent this. +@@ -2434,6 +2435,17 @@ proc default_gdb_start { } { } } @@ -1889,7 +1906,7 @@ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp -@@ -322,6 +322,16 @@ proc default_mi_gdb_start { args } { +@@ -321,6 +321,16 @@ proc default_mi_gdb_start { { flags {} } } { warning "Couldn't set the width to 0." } } diff --git a/gdb-pretty-print-by-default.patch b/gdb-pretty-print-by-default.patch index a27638d..da28c49 100644 --- a/gdb-pretty-print-by-default.patch +++ b/gdb-pretty-print-by-default.patch @@ -1,19 +1,20 @@ ---- gdb-7.7.1/gdb/valprint.c.orig 2014-06-04 16:13:46.353948386 +0200 -+++ gdb-7.7.1/gdb/valprint.c 2014-06-04 16:15:55.599699077 +0200 -@@ -108,12 +108,12 @@ +--- gdb-14.1/gdb/valprint.c.orig 2014-06-04 16:13:46.353948386 +0200 ++++ gdb-14.1/gdb/valprint.c 2014-06-04 16:15:55.599699077 +0200 +@@ -106,13 +106,13 @@ static void val_print_type_code_flags (s struct value_print_options user_print_options = { Val_prettyformat_default, /* prettyformat */ -- 0, /* prettyformat_arrays */ -- 0, /* prettyformat_structs */ -- 0, /* vtblprint */ -+ 1, /* prettyformat_arrays */ -+ 1, /* prettyformat_structs */ -+ 1, /* vtblprint */ - 1, /* unionprint */ - 1, /* addressprint */ -- 0, /* objectprint */ -+ 1, /* objectprint */ +- false, /* prettyformat_arrays */ +- false, /* prettyformat_structs */ +- false, /* vtblprint */ ++ true, /* prettyformat_arrays */ ++ true, /* prettyformat_structs */ ++ true, /* vtblprint */ + true, /* unionprint */ + true, /* addressprint */ + false, /* nibblesprint */ +- false, /* objectprint */ ++ true, /* objectprint */ PRINT_MAX_DEFAULT, /* print_max */ + PRINT_MAX_CHARS_DEFAULT, /* print_max_chars */ 10, /* repeat_count_threshold */ - 0, /* output_format */ diff --git a/gdb-readline.patch b/gdb-readline.patch index 1566be5..2bd4c77 100644 --- a/gdb-readline.patch +++ b/gdb-readline.patch @@ -1,5 +1,5 @@ ---- gdb-12.1/gdb/Makefile.in.orig 2022-06-23 22:08:57.971168251 +0200 -+++ gdb-12.1/gdb/Makefile.in 2022-06-23 22:15:34.112355503 +0200 +--- gdb-14.1/gdb/Makefile.in.orig 2022-06-23 22:08:57.971168251 +0200 ++++ gdb-14.1/gdb/Makefile.in 2022-06-23 22:15:34.112355503 +0200 @@ -180,11 +180,11 @@ LIBDECNUMBER_SRC = $(srcdir)/$(LIBDECNUM LIBDECNUMBER_CFLAGS = -I$(LIBDECNUMBER_DIR) -I$(LIBDECNUMBER_SRC) @@ -17,15 +17,6 @@ # Where is expat? This will be empty if expat was not available. LIBEXPAT = @LIBEXPAT@ -@@ -652,7 +652,7 @@ CLIBS = $(SIM) $(READLINE) $(OPCODES) $( - $(WIN32LIBS) $(LIBGNU) $(LIBGNU_EXTRA_LIBS) $(LIBICONV) \ - $(LIBMPFR) $(LIBGMP) $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS) \ - $(DEBUGINFOD_LIBS) $(LIBBABELTRACE_LIB) --CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) $(CTF_DEPS) \ -+CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(CTF_DEPS) \ - $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) \ - $(LIBSUPPORT) - --- gdb-12.1/Makefile.in.orig 2022-05-01 20:47:43.000000000 +0200 +++ gdb-12.1/Makefile.in 2022-06-23 22:06:05.298770364 +0200 @@ -1087,7 +1087,6 @@ configure-host: \ diff --git a/gdb-readline8.2.patch b/gdb-readline8.2.patch deleted file mode 100644 index ce1cd55..0000000 --- a/gdb-readline8.2.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 1add37b567a7dee39d99f37b37802034c3fce9c4 Mon Sep 17 00:00:00 2001 -From: Andreas Schwab -Date: Sun, 20 Mar 2022 14:01:54 +0100 -Subject: [PATCH] Add support for readline 8.2 - -In readline 8.2 the type of rl_completer_word_break_characters changed to -include const. ---- - gdb/completer.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/gdb/completer.c b/gdb/completer.c -index d3900ae2014..a51c16ac7f8 100644 ---- 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 * --- -2.31.1 - diff --git a/gdb.spec b/gdb.spec index 1a7c794..5ce5af4 100644 --- a/gdb.spec +++ b/gdb.spec @@ -2,7 +2,7 @@ # TODO # - debuginfod (BR: elfutils-debuginfod-devel >= 0.179) -# - rpm5 librpm support (gdb/configure.ac checks for 4.x or so) +# - amd-dbgapi (BR: pkgconfig(amd-dbgapi) >= 0.68.0) # - change install msg to poldek in buildid-locate-rpm-pld.patch when poldek allows it. LP#493922 # # Conditional build: @@ -21,12 +21,12 @@ Summary(uk.UTF-8): Символьний відладчик для С та інш Summary(zh_CN.UTF-8): [开发]C和其他语言的调试器 Summary(zh_TW.UTF-8): [.-A開發]C和.$)B其.-A他語.$)B言的調試器 Name: gdb -Version: 12.1 +Version: 14.1 Release: 1 License: GPL v3+ Group: Development/Debuggers Source0: https://ftp.gnu.org/gnu/gdb/%{name}-%{version}.tar.xz -# Source0-md5: 759a1b8d2b4d403367dd0e14fa04643d +# Source0-md5: 4a084d03915b271f67e9b8ea2ab24972 Source1: http://www.mif.pg.gda.pl/homepages/ankry/man-PLD/%{name}-non-english-man-pages.tar.bz2 # Source1-md5: 2e8a48939ae282c12bbacdd54e398247 Source3: %{name}-gstack.man @@ -35,12 +35,10 @@ Patch101: gdb-6.6-buildid-locate-solib-missing-ids.patch Patch102: gdb-6.6-buildid-locate-rpm.patch Patch104: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch Patch105: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch -Patch106: gdb-6.6-buildid-locate-rpm-scl.patch Patch110: gdb-6.3-gstack-20050411.patch Patch1000: %{name}-readline.patch Patch1001: %{name}-info.patch Patch1002: %{name}-passflags.patch -Patch1003: %{name}-readline8.2.patch Patch1005: %{name}-pretty-print-by-default.patch Patch1006: buildid-locate-rpm-pld.patch URL: http://www.gnu.org/software/gdb/ @@ -51,7 +49,7 @@ BuildRequires: bison BuildRequires: expat-devel BuildRequires: flex >= 2.6.4 BuildRequires: gettext-tools >= 0.12.1 -BuildRequires: gmp-devel +BuildRequires: gmp-devel >= 4.3.2 %if %{with guile} BuildRequires: guile-devel >= 5:2.0 BuildRequires: guile-devel < 5:3.2 @@ -59,16 +57,16 @@ BuildRequires: guile-devel < 5:3.2 %ifarch %{ix86} %{x8664} BuildRequires: libipt-devel %endif -BuildRequires: libmpc-devel +BuildRequires: libmpc-devel >= 0.8.1 BuildRequires: libselinux-devel BuildRequires: libstdc++-devel >= 6:4.8 BuildRequires: libtool >= 2:2 BuildRequires: make >= 3.81 -BuildRequires: mpfr-devel +BuildRequires: mpfr-devel >= 3.1.6 BuildRequires: ncurses-devel >= 5.2 BuildRequires: pkgconfig BuildRequires: readline-devel -BuildRequires: rpm-devel >= 4.6 +BuildRequires: rpm-devel >= 1:4.6 BuildRequires: rpmbuild(macros) >= 1.219 BuildRequires: source-highlight-devel >= 3.0 BuildRequires: tar >= 1:1.22 @@ -198,13 +196,11 @@ GDB w postaci biblioteki statycznej. %patch102 -p1 %patch104 -p1 %patch105 -p1 -%patch106 -p1 %patch110 -p1 %patch1000 -p1 %patch1001 -p1 %patch1002 -p1 -%patch1003 -p1 %patch1005 -p1 %patch1006 -p1 @@ -326,7 +322,7 @@ cp -p build/libdecnumber/libdecnumber.a $RPM_BUILD_ROOT%{_libdir} # Remove the files that are part of a gdb build but that are owned and provided by other packages. # These are part of binutils: %{__rm} $RPM_BUILD_ROOT%{_localedir}/*/LC_MESSAGES/{bfd,opcodes}.mo -%{__rm} $RPM_BUILD_ROOT%{_infodir}/{bfd,ctf-spec}.info* +%{__rm} $RPM_BUILD_ROOT%{_infodir}/{bfd,ctf-spec,sframe-spec}.info* %{__rm} $RPM_BUILD_ROOT%{_includedir}/{ansidecl,bfd,bfdlink,ctf,ctf-api,diagnostics,dis-asm,symcat,plugin-api}.h %{__rm} $RPM_BUILD_ROOT%{_libdir}/lib{bfd,ctf,ctf-nobfd,opcodes}.la %{__rm} $RPM_BUILD_ROOT%{_libdir}/lib{bfd,ctf,ctf-nobfd,opcodes}.a