Rebase to FSF GDB 12.1.
Update gdb-6.6-buildid-locate.patch. Update gdb-6.6-buildid-locate-rpm.patch. Dropped backported patches from GDB 11.1 and 11.2.
This commit is contained in:
parent
148a0e2e0a
commit
1f1906c4c7
2
.gitignore
vendored
2
.gitignore
vendored
@ -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-11.2.tar.xz
|
/gdb-12.1.tar.xz
|
||||||
/v2.0.5.tar.gz
|
/v2.0.5.tar.gz
|
||||||
|
@ -310,56 +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
|
||||||
|
|
||||||
#Backport upstream patch which fixes internal-error: Unexpected
|
|
||||||
#type field location kind (RHBZ 1976887).
|
|
||||||
Patch075: gdb-rhbz1976887-field-location-kind.patch
|
|
||||||
|
|
||||||
# Backport test for RHBZ 1976887 (Kevin Buettner).
|
|
||||||
Patch076: gdb-test-for-rhbz1976887.patch
|
|
||||||
|
|
||||||
# Backport gdb.fortran testsuite changes in order to avoid Fortran
|
|
||||||
# lexical analyzer bug.
|
|
||||||
Patch077: gdb-rhbz2012976-paper-over-fortran-lex-problems.patch
|
|
||||||
|
|
||||||
# Backport manpage update
|
|
||||||
Patch078: gdb-rhbz-853071-update-manpages.patch
|
|
||||||
|
|
||||||
# Backport fix for dprintf bug (RH BZ 2022177).
|
|
||||||
Patch079: gdb-rhbz2022177-dprintf-1.patch
|
|
||||||
|
|
||||||
# Backport test case for dprintf bug (RH BZ 2022177).
|
|
||||||
Patch080: gdb-rhbz2022177-dprintf-2.patch
|
|
||||||
|
|
||||||
#Backport upstream commit from Aaron Merey
|
|
||||||
#3ea44f21299 gdb.texinfo: Expand documentation for debuginfod
|
|
||||||
Patch081: gdb-rhbz2024875-expand-documentation-for-debuginfod.patch
|
|
||||||
|
|
||||||
#Backport upstream commit from Aaron Merey
|
|
||||||
#7811fa5995f gdb: add set/show commands for managing debuginfo
|
|
||||||
Patch082: gdb-rhbz2024875-set_show-for-managing-debuginfod.patch
|
|
||||||
|
|
||||||
#Backport upstream commit from Tom Tromey
|
|
||||||
#2a8f1f47446 Fix unittest.exp failure due to 'set debuginfod' addition
|
|
||||||
Patch083: gdb-rhbz2024875-fix-unittest-failure.patch
|
|
||||||
|
|
||||||
#Backport upstream commit from Simon Marchi
|
|
||||||
#333f35b6315 gdb: pass/return setting setter/getter
|
|
||||||
#scalar values by value
|
|
||||||
Patch084: gdb-rhbz202487-rework-set-debuginfod.patch
|
|
||||||
|
|
||||||
#Backport upstream commit from Aaron Merey
|
|
||||||
#b9db26b4c44 [PR gdb/27026] CTRL-C is ignored when debug info is downloaded
|
|
||||||
Patch085: gdb-rhbz2024875-pr27026.patch
|
|
||||||
|
|
||||||
# Fix build problems.
|
|
||||||
# (RHBZ 2042257, Keith Seitz, Andrew Burgess)
|
|
||||||
Patch086: gdb-rhbz2042257-ftbs-updates.patch
|
|
||||||
|
|
||||||
# Backport fix which fixes internal error due to libcc_s lacking a
|
|
||||||
# .data section.
|
|
||||||
Patch087: gdb-rhbz2042664-fix-sect_index_data-internal-error
|
|
||||||
|
|
||||||
# Backport upstream patch from Aaron Merey which suppresses debuginfod
|
|
||||||
# progress messages when size is zero. (RH BZ 2068280).
|
|
||||||
Patch088: gdb-rhbz2068280-debuginfod-unavailable-size.patch
|
|
||||||
|
|
||||||
|
@ -72,17 +72,3 @@
|
|||||||
%patch072 -p1
|
%patch072 -p1
|
||||||
%patch073 -p1
|
%patch073 -p1
|
||||||
%patch074 -p1
|
%patch074 -p1
|
||||||
%patch075 -p1
|
|
||||||
%patch076 -p1
|
|
||||||
%patch077 -p1
|
|
||||||
%patch078 -p1
|
|
||||||
%patch079 -p1
|
|
||||||
%patch080 -p1
|
|
||||||
%patch081 -p1
|
|
||||||
%patch082 -p1
|
|
||||||
%patch083 -p1
|
|
||||||
%patch084 -p1
|
|
||||||
%patch085 -p1
|
|
||||||
%patch086 -p1
|
|
||||||
%patch087 -p1
|
|
||||||
%patch088 -p1
|
|
||||||
|
@ -1 +1 @@
|
|||||||
ef6ec3333e80e39ce207c6c5d5628bdd5402111d
|
e53a8e8685685c97588f8319d993ea6cd5635e47
|
||||||
|
14
_patch_order
14
_patch_order
@ -72,17 +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-rhbz1976887-field-location-kind.patch
|
|
||||||
gdb-test-for-rhbz1976887.patch
|
|
||||||
gdb-rhbz2012976-paper-over-fortran-lex-problems.patch
|
|
||||||
gdb-rhbz-853071-update-manpages.patch
|
|
||||||
gdb-rhbz2022177-dprintf-1.patch
|
|
||||||
gdb-rhbz2022177-dprintf-2.patch
|
|
||||||
gdb-rhbz2024875-expand-documentation-for-debuginfod.patch
|
|
||||||
gdb-rhbz2024875-set_show-for-managing-debuginfod.patch
|
|
||||||
gdb-rhbz2024875-fix-unittest-failure.patch
|
|
||||||
gdb-rhbz202487-rework-set-debuginfod.patch
|
|
||||||
gdb-rhbz2024875-pr27026.patch
|
|
||||||
gdb-rhbz2042257-ftbs-updates.patch
|
|
||||||
gdb-rhbz2042664-fix-sect_index_data-internal-error
|
|
||||||
gdb-rhbz2068280-debuginfod-unavailable-size.patch
|
|
||||||
|
@ -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
|
||||||
@@ -1753,7 +1753,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
|
@@ -1767,7 +1767,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 \
|
||||||
@@ -1802,7 +1802,25 @@ install-guile:
|
@@ -1816,7 +1816,25 @@ install-guile:
|
||||||
install-python:
|
install-python:
|
||||||
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
|
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
|
||||||
|
|
||||||
@ -52,8 +52,8 @@ 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 \
|
||||||
@@ -1825,6 +1843,18 @@ uninstall: force $(CONFIG_UNINSTALL)
|
@@ -1847,6 +1865,18 @@ uninstall: force $(CONFIG_UNINSTALL)
|
||||||
fi
|
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
|
||||||
|
|
||||||
+.PHONY: uninstall-gstack
|
+.PHONY: uninstall-gstack
|
||||||
|
@ -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
|
||||||
@@ -2195,7 +2195,7 @@ init_gdb_version_vars (void)
|
@@ -2234,7 +2234,7 @@ init_gdb_version_vars (void)
|
||||||
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;
|
||||||
|
@ -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
|
||||||
@@ -1306,6 +1306,10 @@ process_print_command_args (const char *args, value_print_options *print_opts,
|
@@ -1301,6 +1301,10 @@ process_print_command_args (const char *args, value_print_options *print_opts,
|
||||||
|
|
||||||
if (exp != nullptr && *exp)
|
if (exp != nullptr && *exp)
|
||||||
{
|
{
|
||||||
|
@ -6,29 +6,6 @@ Subject: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
|
|||||||
;; Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879).
|
;; Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879).
|
||||||
;;=push+jan
|
;;=push+jan
|
||||||
|
|
||||||
diff --git a/gdb/build-id.c b/gdb/build-id.c
|
|
||||||
--- a/gdb/build-id.c
|
|
||||||
+++ b/gdb/build-id.c
|
|
||||||
@@ -708,6 +708,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
|
|
||||||
#include <dlfcn.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+/* Workarodun https://bugzilla.redhat.com/show_bug.cgi?id=643031
|
|
||||||
+ librpm must not exit() an application on SIGINT
|
|
||||||
+
|
|
||||||
+ Enable or disable a signal handler. SIGNUM: signal to enable (or disable
|
|
||||||
+ if negative). HANDLER: sa_sigaction handler (or NULL to use
|
|
||||||
+ rpmsqHandler()). Returns: no. of refs, -1 on error. */
|
|
||||||
+extern int rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler);
|
|
||||||
+int
|
|
||||||
+rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler)
|
|
||||||
+{
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
|
|
||||||
and avoid their duplicities during a single inferior run. */
|
|
||||||
|
|
||||||
diff --git a/gdb/proc-service.list b/gdb/proc-service.list
|
diff --git a/gdb/proc-service.list b/gdb/proc-service.list
|
||||||
--- a/gdb/proc-service.list
|
--- a/gdb/proc-service.list
|
||||||
+++ b/gdb/proc-service.list
|
+++ b/gdb/proc-service.list
|
||||||
|
@ -9,96 +9,10 @@ Subject: gdb-6.6-buildid-locate-rpm-scl.patch
|
|||||||
warning: Skipping deprecated .gdb_index section
|
warning: Skipping deprecated .gdb_index section
|
||||||
https://bugzilla.redhat.com/show_bug.cgi?id=953585
|
https://bugzilla.redhat.com/show_bug.cgi?id=953585
|
||||||
|
|
||||||
diff --git a/gdb/build-id.c b/gdb/build-id.c
|
|
||||||
--- a/gdb/build-id.c
|
|
||||||
+++ b/gdb/build-id.c
|
|
||||||
@@ -742,7 +742,11 @@ static int missing_rpm_list_entries;
|
|
||||||
/* Returns the count of newly added rpms. */
|
|
||||||
|
|
||||||
static int
|
|
||||||
+#ifndef GDB_INDEX_VERIFY_VENDOR
|
|
||||||
missing_rpm_enlist (const char *filename)
|
|
||||||
+#else
|
|
||||||
+missing_rpm_enlist_1 (const char *filename, int verify_vendor)
|
|
||||||
+#endif
|
|
||||||
{
|
|
||||||
static int rpm_init_done = 0;
|
|
||||||
rpmts ts;
|
|
||||||
@@ -849,7 +853,11 @@ missing_rpm_enlist (const char *filename)
|
|
||||||
mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
|
|
||||||
if (mi != NULL)
|
|
||||||
{
|
|
||||||
+#ifndef GDB_INDEX_VERIFY_VENDOR
|
|
||||||
for (;;)
|
|
||||||
+#else
|
|
||||||
+ if (!verify_vendor) for (;;)
|
|
||||||
+#endif
|
|
||||||
{
|
|
||||||
Header h;
|
|
||||||
char *debuginfo, **slot, *s, *s2;
|
|
||||||
@@ -967,6 +975,37 @@ missing_rpm_enlist (const char *filename)
|
|
||||||
xfree (debuginfo);
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
+#ifdef GDB_INDEX_VERIFY_VENDOR
|
|
||||||
+ else /* verify_vendor */
|
|
||||||
+ {
|
|
||||||
+ int vendor_pass = 0, vendor_fail = 0;
|
|
||||||
+
|
|
||||||
+ for (;;)
|
|
||||||
+ {
|
|
||||||
+ Header h;
|
|
||||||
+ errmsg_t err;
|
|
||||||
+ char *vendor;
|
|
||||||
+
|
|
||||||
+ h = rpmdbNextIterator_p (mi);
|
|
||||||
+ if (h == NULL)
|
|
||||||
+ break;
|
|
||||||
+
|
|
||||||
+ vendor = headerFormat_p (h, "%{vendor}", &err);
|
|
||||||
+ if (!vendor)
|
|
||||||
+ {
|
|
||||||
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
|
||||||
+ err);
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ if (strcmp (vendor, "Red Hat, Inc.") == 0)
|
|
||||||
+ vendor_pass = 1;
|
|
||||||
+ else
|
|
||||||
+ vendor_fail = 1;
|
|
||||||
+ xfree (vendor);
|
|
||||||
+ }
|
|
||||||
+ count = vendor_pass != 0 && vendor_fail == 0;
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
rpmdbFreeIterator_p (mi);
|
|
||||||
}
|
|
||||||
@@ -976,6 +1015,20 @@ missing_rpm_enlist (const char *filename)
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#ifdef GDB_INDEX_VERIFY_VENDOR
|
|
||||||
+missing_rpm_enlist (const char *filename)
|
|
||||||
+{
|
|
||||||
+ return missing_rpm_enlist_1 (filename, 0);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+extern int rpm_verify_vendor (const char *filename);
|
|
||||||
+int
|
|
||||||
+rpm_verify_vendor (const char *filename)
|
|
||||||
+{
|
|
||||||
+ return missing_rpm_enlist_1 (filename, 1);
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
static bool
|
|
||||||
missing_rpm_list_compar (const char *ap, const char *bp)
|
|
||||||
{
|
|
||||||
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
|
||||||
@@ -2801,6 +2801,16 @@ read_gdb_index_from_buffer (const char *filename,
|
@@ -2797,6 +2797,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)
|
||||||
{
|
{
|
||||||
@ -115,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)
|
||||||
{
|
{
|
||||||
@@ -2812,6 +2822,10 @@ to use the section anyway."),
|
@@ -2808,6 +2818,10 @@ to use the section anyway."),
|
||||||
warning_printed = 1;
|
warning_printed = 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -232,457 +232,6 @@ diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4
|
|||||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
# Copyright (C) 2001-2017 Free Software Foundation, Inc.
|
||||||
diff --git a/gdb/build-id.c b/gdb/build-id.c
|
|
||||||
--- a/gdb/build-id.c
|
|
||||||
+++ b/gdb/build-id.c
|
|
||||||
@@ -33,6 +33,7 @@
|
|
||||||
#include "gdb_bfd.h"
|
|
||||||
#include "gdbcmd.h"
|
|
||||||
#include "gdbcore.h"
|
|
||||||
+#include "inferior.h"
|
|
||||||
#include "objfiles.h"
|
|
||||||
#include "observable.h"
|
|
||||||
#include "symfile.h"
|
|
||||||
@@ -697,8 +698,374 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#ifdef HAVE_LIBRPM
|
|
||||||
+
|
|
||||||
+#include <rpm/rpmlib.h>
|
|
||||||
+#include <rpm/rpmts.h>
|
|
||||||
+#include <rpm/rpmdb.h>
|
|
||||||
+#include <rpm/header.h>
|
|
||||||
+#ifdef DLOPEN_LIBRPM
|
|
||||||
+#include <dlfcn.h>
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
|
|
||||||
+ and avoid their duplicities during a single inferior run. */
|
|
||||||
+
|
|
||||||
+static struct htab *missing_rpm_hash;
|
|
||||||
+
|
|
||||||
+/* This MISSING_RPM_LIST tracker is used to collect and print as a single line
|
|
||||||
+ all the rpms right before the nearest GDB prompt. It gets cleared after
|
|
||||||
+ each such print (it is questionable if we should clear it after the print).
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+struct missing_rpm
|
|
||||||
+ {
|
|
||||||
+ struct missing_rpm *next;
|
|
||||||
+ char rpm[1];
|
|
||||||
+ };
|
|
||||||
+static struct missing_rpm *missing_rpm_list;
|
|
||||||
+static int missing_rpm_list_entries;
|
|
||||||
+
|
|
||||||
+/* Returns the count of newly added rpms. */
|
|
||||||
+
|
|
||||||
+static int
|
|
||||||
+missing_rpm_enlist (const char *filename)
|
|
||||||
+{
|
|
||||||
+ static int rpm_init_done = 0;
|
|
||||||
+ rpmts ts;
|
|
||||||
+ rpmdbMatchIterator mi;
|
|
||||||
+ int count = 0;
|
|
||||||
+
|
|
||||||
+#ifdef DLOPEN_LIBRPM
|
|
||||||
+ /* Duplicate here the declarations to verify they match. The same sanity
|
|
||||||
+ check is present also in `configure.ac'. */
|
|
||||||
+ extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
|
|
||||||
+ static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg);
|
|
||||||
+ extern int rpmReadConfigFiles(const char * file, const char * target);
|
|
||||||
+ static int (*rpmReadConfigFiles_p) (const char * file, const char * target);
|
|
||||||
+ extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
|
|
||||||
+ static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi);
|
|
||||||
+ extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
|
|
||||||
+ static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi);
|
|
||||||
+ extern rpmts rpmtsCreate(void);
|
|
||||||
+ static rpmts (*rpmtsCreate_p) (void);
|
|
||||||
+ extern rpmts rpmtsFree(rpmts ts);
|
|
||||||
+ static rpmts (*rpmtsFree_p) (rpmts ts);
|
|
||||||
+ extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
|
|
||||||
+ const void * keyp, size_t keylen);
|
|
||||||
+ static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts,
|
|
||||||
+ rpmTag rpmtag,
|
|
||||||
+ const void *keyp,
|
|
||||||
+ size_t keylen);
|
|
||||||
+#else /* !DLOPEN_LIBRPM */
|
|
||||||
+# define headerFormat_p headerFormat
|
|
||||||
+# define rpmReadConfigFiles_p rpmReadConfigFiles
|
|
||||||
+# define rpmdbFreeIterator_p rpmdbFreeIterator
|
|
||||||
+# define rpmdbNextIterator_p rpmdbNextIterator
|
|
||||||
+# define rpmtsCreate_p rpmtsCreate
|
|
||||||
+# define rpmtsFree_p rpmtsFree
|
|
||||||
+# define rpmtsInitIterator_p rpmtsInitIterator
|
|
||||||
+#endif /* !DLOPEN_LIBRPM */
|
|
||||||
+
|
|
||||||
+ gdb_assert (filename != NULL);
|
|
||||||
+
|
|
||||||
+ if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0)
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+ if (is_target_filename (filename))
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+ if (filename[0] != '/')
|
|
||||||
+ {
|
|
||||||
+ warning (_("Ignoring non-absolute filename: <%s>"), filename);
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!rpm_init_done)
|
|
||||||
+ {
|
|
||||||
+ static int init_tried;
|
|
||||||
+
|
|
||||||
+ /* Already failed the initialization before? */
|
|
||||||
+ if (init_tried)
|
|
||||||
+ return 0;
|
|
||||||
+ init_tried = 1;
|
|
||||||
+
|
|
||||||
+#ifdef DLOPEN_LIBRPM
|
|
||||||
+ {
|
|
||||||
+ void *h;
|
|
||||||
+
|
|
||||||
+ h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY);
|
|
||||||
+ if (!h)
|
|
||||||
+ {
|
|
||||||
+ warning (_("Unable to open \"%s\" (%s), "
|
|
||||||
+ "missing debuginfos notifications will not be displayed"),
|
|
||||||
+ DLOPEN_LIBRPM, dlerror ());
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!((headerFormat_p = (char *(*) (Header h, const char * fmt, errmsg_t *errmsg)) dlsym (h, "headerFormat"))
|
|
||||||
+ && (rpmReadConfigFiles_p = (int (*) (const char * file, const char * target)) dlsym (h, "rpmReadConfigFiles"))
|
|
||||||
+ && (rpmdbFreeIterator_p = (rpmdbMatchIterator (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbFreeIterator"))
|
|
||||||
+ && (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"))))
|
|
||||||
+ {
|
|
||||||
+ warning (_("Opened library \"%s\" is incompatible (%s), "
|
|
||||||
+ "missing debuginfos notifications will not be displayed"),
|
|
||||||
+ DLOPEN_LIBRPM, dlerror ());
|
|
||||||
+ if (dlclose (h))
|
|
||||||
+ warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM,
|
|
||||||
+ dlerror ());
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+#endif /* DLOPEN_LIBRPM */
|
|
||||||
+
|
|
||||||
+ if (rpmReadConfigFiles_p (NULL, NULL) != 0)
|
|
||||||
+ {
|
|
||||||
+ warning (_("Error reading the rpm configuration files"));
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rpm_init_done = 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ ts = rpmtsCreate_p ();
|
|
||||||
+
|
|
||||||
+ mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
|
|
||||||
+ if (mi != NULL)
|
|
||||||
+ {
|
|
||||||
+ for (;;)
|
|
||||||
+ {
|
|
||||||
+ Header h;
|
|
||||||
+ char *debuginfo, **slot, *s, *s2;
|
|
||||||
+ errmsg_t err;
|
|
||||||
+ size_t srcrpmlen = sizeof (".src.rpm") - 1;
|
|
||||||
+ size_t debuginfolen = sizeof ("-debuginfo") - 1;
|
|
||||||
+ rpmdbMatchIterator mi_debuginfo;
|
|
||||||
+
|
|
||||||
+ h = rpmdbNextIterator_p (mi);
|
|
||||||
+ if (h == NULL)
|
|
||||||
+ break;
|
|
||||||
+
|
|
||||||
+ /* Verify the debuginfo file is not already installed. */
|
|
||||||
+
|
|
||||||
+ debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}",
|
|
||||||
+ &err);
|
|
||||||
+ if (!debuginfo)
|
|
||||||
+ {
|
|
||||||
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
|
||||||
+ err);
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ /* s = `.src.rpm-debuginfo.%{arch}' */
|
|
||||||
+ s = strrchr (debuginfo, '-') - srcrpmlen;
|
|
||||||
+ s2 = NULL;
|
|
||||||
+ if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0)
|
|
||||||
+ {
|
|
||||||
+ /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */
|
|
||||||
+ s2 = (char *) memrchr (debuginfo, '-', s - debuginfo);
|
|
||||||
+ }
|
|
||||||
+ if (s2)
|
|
||||||
+ {
|
|
||||||
+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
|
|
||||||
+ s2 = (char *) memrchr (debuginfo, '-', s2 - debuginfo);
|
|
||||||
+ }
|
|
||||||
+ if (!s2)
|
|
||||||
+ {
|
|
||||||
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
|
||||||
+ debuginfo);
|
|
||||||
+ xfree (debuginfo);
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ /* s = `.src.rpm-debuginfo.%{arch}' */
|
|
||||||
+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
|
|
||||||
+ memmove (s2 + debuginfolen, s2, s - s2);
|
|
||||||
+ memcpy (s2, "-debuginfo", debuginfolen);
|
|
||||||
+ /* s = `XXXX.%{arch}' */
|
|
||||||
+ /* strlen ("XXXX") == srcrpmlen + debuginfolen */
|
|
||||||
+ /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */
|
|
||||||
+ /* strlen ("XX") == srcrpmlen */
|
|
||||||
+ memmove (s + debuginfolen, s + srcrpmlen + debuginfolen,
|
|
||||||
+ strlen (s + srcrpmlen + debuginfolen) + 1);
|
|
||||||
+ /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
|
|
||||||
+
|
|
||||||
+ /* 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);
|
|
||||||
+ xfree (debuginfo);
|
|
||||||
+ if (mi_debuginfo)
|
|
||||||
+ {
|
|
||||||
+ rpmdbFreeIterator_p (mi_debuginfo);
|
|
||||||
+ count = 0;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* The allocated memory gets utilized below for MISSING_RPM_HASH. */
|
|
||||||
+ debuginfo = headerFormat_p (h,
|
|
||||||
+ "%{name}-%{version}-%{release}.%{arch}",
|
|
||||||
+ &err);
|
|
||||||
+ if (!debuginfo)
|
|
||||||
+ {
|
|
||||||
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
|
||||||
+ err);
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Base package name for `debuginfo-install'. We do not use the
|
|
||||||
+ `yum' command directly as the line
|
|
||||||
+ yum --enablerepo='*debug*' install NAME-debuginfo.ARCH
|
|
||||||
+ would be more complicated than just:
|
|
||||||
+ debuginfo-install NAME-VERSION-RELEASE.ARCH
|
|
||||||
+ Do not supply the rpm base name (derived from .src.rpm name) as
|
|
||||||
+ debuginfo-install is unable to install the debuginfo package if
|
|
||||||
+ the base name PKG binary rpm is not installed while for example
|
|
||||||
+ PKG-libs would be installed (RH Bug 467901).
|
|
||||||
+ FUTURE: After multiple debuginfo versions simultaneously installed
|
|
||||||
+ get supported the support for the VERSION-RELEASE tags handling
|
|
||||||
+ may need an update. */
|
|
||||||
+
|
|
||||||
+ if (missing_rpm_hash == NULL)
|
|
||||||
+ {
|
|
||||||
+ /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE
|
|
||||||
+ should not deallocate the entries. */
|
|
||||||
+
|
|
||||||
+ missing_rpm_hash = htab_create_alloc (64, htab_hash_string,
|
|
||||||
+ (int (*) (const void *, const void *)) streq,
|
|
||||||
+ NULL, xcalloc, xfree);
|
|
||||||
+ }
|
|
||||||
+ slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT);
|
|
||||||
+ /* XCALLOC never returns NULL. */
|
|
||||||
+ gdb_assert (slot != NULL);
|
|
||||||
+ if (*slot == NULL)
|
|
||||||
+ {
|
|
||||||
+ struct missing_rpm *missing_rpm;
|
|
||||||
+
|
|
||||||
+ *slot = debuginfo;
|
|
||||||
+
|
|
||||||
+ missing_rpm = (struct missing_rpm *) xmalloc (sizeof (*missing_rpm) + strlen (debuginfo));
|
|
||||||
+ strcpy (missing_rpm->rpm, debuginfo);
|
|
||||||
+ missing_rpm->next = missing_rpm_list;
|
|
||||||
+ missing_rpm_list = missing_rpm;
|
|
||||||
+ missing_rpm_list_entries++;
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ xfree (debuginfo);
|
|
||||||
+ count++;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rpmdbFreeIterator_p (mi);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rpmtsFree_p (ts);
|
|
||||||
+
|
|
||||||
+ return count;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static bool
|
|
||||||
+missing_rpm_list_compar (const char *ap, const char *bp)
|
|
||||||
+{
|
|
||||||
+ return strcoll (ap, bp) < 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* It returns a NULL-terminated array of strings needing to be FREEd. It may
|
|
||||||
+ also return only NULL. */
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+missing_rpm_list_print (void)
|
|
||||||
+{
|
|
||||||
+ struct missing_rpm *list_iter;
|
|
||||||
+
|
|
||||||
+ if (missing_rpm_list_entries == 0)
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ std::vector<const char *> array (missing_rpm_list_entries);
|
|
||||||
+ size_t idx = 0;
|
|
||||||
+
|
|
||||||
+ for (list_iter = missing_rpm_list; list_iter != NULL;
|
|
||||||
+ list_iter = list_iter->next)
|
|
||||||
+ {
|
|
||||||
+ array[idx++] = list_iter->rpm;
|
|
||||||
+ }
|
|
||||||
+ gdb_assert (idx == missing_rpm_list_entries);
|
|
||||||
+
|
|
||||||
+ std::sort (array.begin (), array.end (), missing_rpm_list_compar);
|
|
||||||
+
|
|
||||||
+ /* We zero out the number of missing RPMs here because of a nasty
|
|
||||||
+ bug (see RHBZ 1801974).
|
|
||||||
+
|
|
||||||
+ When we call 'puts_unfiltered' below, if pagination is on and if
|
|
||||||
+ the number of missing RPMs is big enough to trigger pagination,
|
|
||||||
+ we will end up in an infinite recursion. The call chain looks
|
|
||||||
+ like this:
|
|
||||||
+
|
|
||||||
+ missing_rpm_list_print -> puts_unfiltered -> fputs_maybe_filtered
|
|
||||||
+ -> prompt_for_continue -> display_gdb_prompt ->
|
|
||||||
+ debug_flush_missing -> missing_rpm_list_print ...
|
|
||||||
+
|
|
||||||
+ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero
|
|
||||||
+ *before* calling any print function. */
|
|
||||||
+ missing_rpm_list_entries = 0;
|
|
||||||
+
|
|
||||||
+ printf_unfiltered (_("Missing separate debuginfos, use: %s"),
|
|
||||||
+#ifdef DNF_DEBUGINFO_INSTALL
|
|
||||||
+ "dnf "
|
|
||||||
+#endif
|
|
||||||
+ "debuginfo-install");
|
|
||||||
+ for (const char *el : array)
|
|
||||||
+ {
|
|
||||||
+ puts_unfiltered (" ");
|
|
||||||
+ puts_unfiltered (el);
|
|
||||||
+ }
|
|
||||||
+ puts_unfiltered ("\n");
|
|
||||||
+
|
|
||||||
+ while (missing_rpm_list != NULL)
|
|
||||||
+ {
|
|
||||||
+ list_iter = missing_rpm_list;
|
|
||||||
+ missing_rpm_list = list_iter->next;
|
|
||||||
+ xfree (list_iter);
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+missing_rpm_change (void)
|
|
||||||
+{
|
|
||||||
+ debug_flush_missing ();
|
|
||||||
+
|
|
||||||
+ gdb_assert (missing_rpm_list == NULL);
|
|
||||||
+ if (missing_rpm_hash != NULL)
|
|
||||||
+ {
|
|
||||||
+ htab_delete (missing_rpm_hash);
|
|
||||||
+ missing_rpm_hash = NULL;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+enum missing_exec
|
|
||||||
+ {
|
|
||||||
+ /* Init state. EXEC_BFD also still could be NULL. */
|
|
||||||
+ MISSING_EXEC_NOT_TRIED,
|
|
||||||
+ /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */
|
|
||||||
+ MISSING_EXEC_NOT_FOUND,
|
|
||||||
+ /* We found EXEC_BFD by RPM and we either have its symbols (either embedded
|
|
||||||
+ or separate) or the main executable's RPM is now contained in
|
|
||||||
+ MISSING_RPM_HASH. */
|
|
||||||
+ MISSING_EXEC_ENLISTED
|
|
||||||
+ };
|
|
||||||
+static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED;
|
|
||||||
+
|
|
||||||
+#endif /* HAVE_LIBRPM */
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+debug_flush_missing (void)
|
|
||||||
+{
|
|
||||||
+#ifdef HAVE_LIBRPM
|
|
||||||
+ missing_rpm_list_print ();
|
|
||||||
+#endif
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
|
|
||||||
- Try to install the hash file ...
|
|
||||||
+ yum --enablerepo='*debug*' install ...
|
|
||||||
avoidance. */
|
|
||||||
|
|
||||||
struct missing_filepair
|
|
||||||
@@ -752,11 +1119,17 @@ missing_filepair_change (void)
|
|
||||||
/* All their memory came just from missing_filepair_OBSTACK. */
|
|
||||||
missing_filepair_hash = NULL;
|
|
||||||
}
|
|
||||||
+#ifdef HAVE_LIBRPM
|
|
||||||
+ missing_exec = MISSING_EXEC_NOT_TRIED;
|
|
||||||
+#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
debug_print_executable_changed (void)
|
|
||||||
{
|
|
||||||
+#ifdef HAVE_LIBRPM
|
|
||||||
+ missing_rpm_change ();
|
|
||||||
+#endif
|
|
||||||
missing_filepair_change ();
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -823,14 +1196,38 @@ debug_print_missing (const char *binary, const char *debug)
|
|
||||||
|
|
||||||
*slot = missing_filepair;
|
|
||||||
|
|
||||||
- /* We do not collect and flush these messages as each such message
|
|
||||||
- already requires its own separate lines. */
|
|
||||||
+#ifdef HAVE_LIBRPM
|
|
||||||
+ if (missing_exec == MISSING_EXEC_NOT_TRIED)
|
|
||||||
+ {
|
|
||||||
+ const char *execfilename = get_exec_file (0);
|
|
||||||
|
|
||||||
- fprintf_unfiltered (gdb_stdlog,
|
|
||||||
- _("Missing separate debuginfo for %s\n"), binary);
|
|
||||||
- if (debug != NULL)
|
|
||||||
- fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"),
|
|
||||||
- debug);
|
|
||||||
+ if (execfilename != NULL)
|
|
||||||
+ {
|
|
||||||
+ if (missing_rpm_enlist (execfilename) == 0)
|
|
||||||
+ missing_exec = MISSING_EXEC_NOT_FOUND;
|
|
||||||
+ else
|
|
||||||
+ missing_exec = MISSING_EXEC_ENLISTED;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ if (missing_exec != MISSING_EXEC_ENLISTED)
|
|
||||||
+ if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0)
|
|
||||||
+ && (debug == NULL || missing_rpm_enlist (debug) == 0))
|
|
||||||
+#endif /* HAVE_LIBRPM */
|
|
||||||
+ {
|
|
||||||
+ /* 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"),
|
|
||||||
+#ifdef DNF_DEBUGINFO_INSTALL
|
|
||||||
+ "dnf"
|
|
||||||
+#else
|
|
||||||
+ "yum"
|
|
||||||
+#endif
|
|
||||||
+ " --enablerepo='*debug*' install", debug);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* See build-id.h. */
|
|
||||||
diff --git a/gdb/config.in b/gdb/config.in
|
diff --git a/gdb/config.in b/gdb/config.in
|
||||||
--- a/gdb/config.in
|
--- a/gdb/config.in
|
||||||
+++ b/gdb/config.in
|
+++ b/gdb/config.in
|
||||||
@ -696,7 +245,7 @@ diff --git a/gdb/config.in b/gdb/config.in
|
|||||||
/* Define to 1 if translation of program messages to the user's native
|
/* Define to 1 if translation of program messages to the user's native
|
||||||
language is requested. */
|
language is requested. */
|
||||||
#undef ENABLE_NLS
|
#undef ENABLE_NLS
|
||||||
@@ -250,6 +253,9 @@
|
@@ -259,6 +262,9 @@
|
||||||
/* Define if you have the mpfr library. */
|
/* Define if you have the mpfr library. */
|
||||||
#undef HAVE_LIBMPFR
|
#undef HAVE_LIBMPFR
|
||||||
|
|
||||||
@ -709,9 +258,9 @@ 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
|
||||||
@@ -771,6 +771,11 @@ PKG_CONFIG
|
@@ -775,6 +775,11 @@ TARGET_OBS
|
||||||
HAVE_NATIVE_GCORE_TARGET
|
ENABLE_BFD_64_BIT_FALSE
|
||||||
TARGET_OBS
|
ENABLE_BFD_64_BIT_TRUE
|
||||||
subdirs
|
subdirs
|
||||||
+RPM_LIBS
|
+RPM_LIBS
|
||||||
+RPM_CFLAGS
|
+RPM_CFLAGS
|
||||||
@ -721,7 +270,7 @@ diff --git a/gdb/configure b/gdb/configure
|
|||||||
GDB_DATADIR
|
GDB_DATADIR
|
||||||
DEBUGDIR
|
DEBUGDIR
|
||||||
MAKEINFO_EXTRA_FLAGS
|
MAKEINFO_EXTRA_FLAGS
|
||||||
@@ -876,6 +881,7 @@ with_gdb_datadir
|
@@ -880,6 +885,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
|
||||||
@ -729,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
|
||||||
@@ -953,6 +959,8 @@ PKG_CONFIG_PATH
|
@@ -959,6 +965,8 @@ PKG_CONFIG_PATH
|
||||||
PKG_CONFIG_LIBDIR
|
PKG_CONFIG_LIBDIR
|
||||||
DEBUGINFOD_CFLAGS
|
DEBUGINFOD_CFLAGS
|
||||||
DEBUGINFOD_LIBS
|
DEBUGINFOD_LIBS
|
||||||
@ -738,7 +287,7 @@ diff --git a/gdb/configure b/gdb/configure
|
|||||||
YACC
|
YACC
|
||||||
YFLAGS
|
YFLAGS
|
||||||
XMKMF'
|
XMKMF'
|
||||||
@@ -1625,6 +1633,8 @@ Optional Packages:
|
@@ -1635,6 +1643,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)
|
||||||
@ -747,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
|
||||||
@@ -1705,6 +1715,8 @@ Some influential environment variables:
|
@@ -1715,6 +1725,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
|
||||||
@ -756,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'.
|
||||||
@@ -6624,6 +6636,494 @@ _ACEOF
|
@@ -6634,6 +6646,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; }
|
||||||
|
|
||||||
@ -1457,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
|
||||||
@@ -41,6 +41,7 @@
|
@@ -42,6 +42,7 @@
|
||||||
#include "gdbsupport/gdb_select.h"
|
|
||||||
#include "gdbsupport/gdb-sigmask.h"
|
#include "gdbsupport/gdb-sigmask.h"
|
||||||
#include "async-event.h"
|
#include "async-event.h"
|
||||||
|
#include "bt-utils.h"
|
||||||
+#include "symfile.h"
|
+#include "symfile.h"
|
||||||
|
|
||||||
/* readline include files. */
|
/* readline include files. */
|
||||||
#include "readline/readline.h"
|
#include "readline/readline.h"
|
||||||
@@ -363,6 +364,8 @@ display_gdb_prompt (const char *new_prompt)
|
@@ -374,6 +375,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 ();
|
||||||
|
|
||||||
@ -1474,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. */
|
||||||
@@ -773,7 +776,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
|
@@ -800,7 +803,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)
|
||||||
|
@ -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
|
||||||
@@ -1350,14 +1350,28 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
|
@@ -1250,14 +1250,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;
|
||||||
@@ -1372,23 +1386,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
|
@@ -1272,23 +1286,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
|
||||||
xfree (name);
|
xfree (name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -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
|
diff --git a/gdb/build-id.c b/gdb/build-id.c
|
||||||
--- a/gdb/build-id.c
|
--- a/gdb/build-id.c
|
||||||
+++ b/gdb/build-id.c
|
+++ b/gdb/build-id.c
|
||||||
@@ -24,13 +24,70 @@
|
@@ -24,13 +24,71 @@
|
||||||
#include "gdbsupport/gdb_vecs.h"
|
#include "gdbsupport/gdb_vecs.h"
|
||||||
#include "symfile.h"
|
#include "symfile.h"
|
||||||
#include "objfiles.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 "gdb_bfd.h"
|
||||||
+#include "gdbcmd.h"
|
+#include "gdbcmd.h"
|
||||||
#include "gdbcore.h"
|
#include "gdbcore.h"
|
||||||
|
+#include "inferior.h"
|
||||||
+#include "objfiles.h"
|
+#include "objfiles.h"
|
||||||
+#include "observable.h"
|
+#include "observable.h"
|
||||||
+#include "symfile.h"
|
+#include "symfile.h"
|
||||||
@ -105,7 +106,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
|||||||
{
|
{
|
||||||
if (!bfd_check_format (abfd, bfd_object)
|
if (!bfd_check_format (abfd, bfd_object)
|
||||||
&& !bfd_check_format (abfd, bfd_core))
|
&& !bfd_check_format (abfd, bfd_core))
|
||||||
@@ -43,6 +100,348 @@ build_id_bfd_get (bfd *abfd)
|
@@ -43,6 +101,348 @@ build_id_bfd_get (bfd *abfd)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -454,7 +455,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
|||||||
/* See build-id.h. */
|
/* See build-id.h. */
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -51,7 +450,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
|
@@ -51,7 +451,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
|
||||||
const struct bfd_build_id *found;
|
const struct bfd_build_id *found;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
@ -463,14 +464,15 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
|||||||
|
|
||||||
if (found == NULL)
|
if (found == NULL)
|
||||||
warning (_("File \"%s\" has no build-id, file skipped"),
|
warning (_("File \"%s\" has no build-id, file skipped"),
|
||||||
@@ -66,56 +465,159 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
|
@@ -66,63 +466,166 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
+static char *
|
+static char *
|
||||||
+link_resolve (const char *symlink, int level)
|
+link_resolve (const char *symlink, int level)
|
||||||
+{
|
+{
|
||||||
+ char buf[PATH_MAX + 1], *target, *retval;
|
+ char buf[PATH_MAX + 1], *retval;
|
||||||
|
+ gdb::unique_xmalloc_ptr<char> target;
|
||||||
+ ssize_t got;
|
+ ssize_t got;
|
||||||
+
|
+
|
||||||
+ if (level > 10)
|
+ if (level > 10)
|
||||||
@ -482,7 +484,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
|||||||
+ buf[got] = '\0';
|
+ buf[got] = '\0';
|
||||||
+
|
+
|
||||||
+ if (IS_ABSOLUTE_PATH (buf))
|
+ if (IS_ABSOLUTE_PATH (buf))
|
||||||
+ target = xstrdup (buf);
|
+ target = make_unique_xstrdup (buf);
|
||||||
+ else
|
+ else
|
||||||
+ {
|
+ {
|
||||||
+ const std::string dir (ldirname (symlink));
|
+ const std::string dir (ldirname (symlink));
|
||||||
@ -496,8 +498,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
|||||||
+ "%s", dir.c_str(), buf);
|
+ "%s", dir.c_str(), buf);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ retval = link_resolve (target, level + 1);
|
+ retval = link_resolve (target.get (), level + 1);
|
||||||
+ xfree (target);
|
|
||||||
+ return retval;
|
+ return retval;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
@ -516,42 +517,49 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
|||||||
+
|
+
|
||||||
if (separate_debug_file_debug)
|
if (separate_debug_file_debug)
|
||||||
{
|
{
|
||||||
- printf_unfiltered (_(" Trying %s..."), link.c_str ());
|
- fprintf_unfiltered (gdb_stdlog, _(" Trying %s..."), link.c_str ());
|
||||||
+ printf_unfiltered (_(" Trying %s..."), orig_link.c_str ());
|
- gdb_flush (gdb_stdlog);
|
||||||
gdb_flush (gdb_stdout);
|
+ fprintf_unfiltered (gdb_stdlog, _(" Trying %s..."), orig_link.c_str ());
|
||||||
|
+ gdb_flush (gdb_stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
- /* lrealpath() is expensive even for the usually non-existent files. */
|
- /* lrealpath() is expensive even for the usually non-existent files. */
|
||||||
- gdb::unique_xmalloc_ptr<char> filename;
|
- gdb::unique_xmalloc_ptr<char> filename_holder;
|
||||||
- if (access (link.c_str (), F_OK) == 0)
|
- const char *filename = nullptr;
|
||||||
- filename.reset (lrealpath (link.c_str ()));
|
- if (startswith (link, TARGET_SYSROOT_PREFIX))
|
||||||
-
|
- filename = link.c_str ();
|
||||||
- if (filename == NULL)
|
- else if (access (link.c_str (), F_OK) == 0)
|
||||||
+ for (unsigned seqno = 0;; seqno++)
|
+ for (unsigned seqno = 0;; seqno++)
|
||||||
{
|
{
|
||||||
- if (separate_debug_file_debug)
|
- filename_holder.reset (lrealpath (link.c_str ()));
|
||||||
- printf_unfiltered (_(" no, unable to compute real path\n"));
|
- filename = filename_holder.get ();
|
||||||
|
- }
|
||||||
+ std::string link = orig_link;
|
+ std::string link = orig_link;
|
||||||
|
|
||||||
- return {};
|
- if (filename == NULL)
|
||||||
- }
|
- {
|
||||||
|
- if (separate_debug_file_debug)
|
||||||
|
- fprintf_unfiltered (gdb_stdlog,
|
||||||
|
- _(" 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
|
||||||
+ with the same build-id (such as hard links). Some of the real
|
+ with the same build-id (such as hard links). Some of the real
|
||||||
+ files may not be installed. */
|
+ files may not be installed. */
|
||||||
+
|
|
||||||
|
- return {};
|
||||||
|
- }
|
||||||
+ string_appendf (link, ".%u", seqno);
|
+ string_appendf (link, ".%u", seqno);
|
||||||
+ }
|
+ }
|
||||||
|
|
||||||
- /* We expect to be silent on the non-existing files. */
|
- /* We expect to be silent on the non-existing files. */
|
||||||
- gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget);
|
- gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename, gnutarget);
|
||||||
+ ret_link = link;
|
+ ret_link = link;
|
||||||
|
|
||||||
- if (debug_bfd == NULL)
|
- if (debug_bfd == NULL)
|
||||||
- {
|
- {
|
||||||
- if (separate_debug_file_debug)
|
- if (separate_debug_file_debug)
|
||||||
- printf_unfiltered (_(" no, unable to open.\n"));
|
- fprintf_unfiltered (gdb_stdlog, _(" no, unable to open.\n"));
|
||||||
+ struct stat statbuf_trash;
|
+ struct stat statbuf_trash;
|
||||||
+
|
+
|
||||||
+ /* `access' automatically dereferences LINK. */
|
+ /* `access' automatically dereferences LINK. */
|
||||||
@ -562,35 +570,42 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /* lrealpath() is expensive even for the usually non-existent files. */
|
+ /* lrealpath() is expensive even for the usually non-existent files. */
|
||||||
+ gdb::unique_xmalloc_ptr<char> filename;
|
+ gdb::unique_xmalloc_ptr<char> filename_holder;
|
||||||
+
|
+ const char *filename = nullptr;
|
||||||
+ if (access (link.c_str (), F_OK) == 0)
|
+ if (startswith (link, TARGET_SYSROOT_PREFIX))
|
||||||
+ filename.reset (lrealpath (link.c_str ()));
|
+ filename = link.c_str ();
|
||||||
|
+ else if (access (link.c_str (), F_OK) == 0)
|
||||||
|
+ {
|
||||||
|
+ filename_holder.reset (lrealpath (link.c_str ()));
|
||||||
|
+ filename = filename_holder.get ();
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ if (filename == NULL)
|
+ if (filename == NULL)
|
||||||
+ {
|
+ {
|
||||||
+ if (separate_debug_file_debug)
|
+ if (separate_debug_file_debug)
|
||||||
+ printf_unfiltered (_(" no, unable to compute real path\n"));
|
+ fprintf_unfiltered (gdb_stdlog,
|
||||||
|
+ _(" no, unable to compute real path\n"));
|
||||||
+
|
+
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /* We expect to be silent on the non-existing files. */
|
+ /* We expect to be silent on the non-existing files. */
|
||||||
+ gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget, -1);
|
+ gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename, gnutarget);
|
||||||
|
+
|
||||||
- return {};
|
|
||||||
+ if (debug_bfd == NULL)
|
+ if (debug_bfd == NULL)
|
||||||
+ {
|
+ {
|
||||||
+ if (separate_debug_file_debug)
|
+ if (separate_debug_file_debug)
|
||||||
+ printf_unfiltered (_(" no, unable to open.\n"));
|
+ fprintf_unfiltered (gdb_stdlog, _(" no, unable to open.\n"));
|
||||||
+
|
|
||||||
|
- return {};
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (!build_id_verify (debug_bfd.get(), build_id_len, build_id))
|
+ if (!build_id_verify (debug_bfd.get(), build_id_len, build_id))
|
||||||
+ {
|
+ {
|
||||||
+ if (separate_debug_file_debug)
|
+ if (separate_debug_file_debug)
|
||||||
+ printf_unfiltered (_(" no, build-id does not match.\n"));
|
+ fprintf_unfiltered (gdb_stdlog,
|
||||||
|
+ _(" no, build-id does not match.\n"));
|
||||||
+
|
+
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
@ -605,17 +620,16 @@ 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)
|
||||||
- printf_unfiltered (_(" no, build-id does not match.\n"));
|
- fprintf_unfiltered (gdb_stdlog, _(" no, build-id does not match.\n"));
|
||||||
-
|
+ fprintf_unfiltered (gdb_stdlog, _(" yes!\n"));
|
||||||
- return {};
|
|
||||||
+ printf_unfiltered (_(" yes!\n"));
|
|
||||||
+ }
|
+ }
|
||||||
+ else
|
+ else
|
||||||
+ {
|
+ {
|
||||||
+ /* If none of the real files is found report as missing file
|
+ /* If none of the real files is found report as missing file
|
||||||
+ always the non-.%u-suffixed file. */
|
+ always the non-.%u-suffixed file. */
|
||||||
+ std::string link0 = orig_link;
|
+ std::string link0 = orig_link;
|
||||||
+
|
|
||||||
|
- return {};
|
||||||
+ /* If the symlink has target request to install the target.
|
+ /* If the symlink has target request to install the target.
|
||||||
+ BASE-debuginfo.rpm contains the symlink but BASE.rpm may be missing.
|
+ BASE-debuginfo.rpm contains the symlink but BASE.rpm may be missing.
|
||||||
+ https://bugzilla.redhat.com/show_bug.cgi?id=981154 */
|
+ https://bugzilla.redhat.com/show_bug.cgi?id=981154 */
|
||||||
@ -632,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)
|
||||||
- printf_unfiltered (_(" yes!\n"));
|
- fprintf_unfiltered (gdb_stdlog, _(" yes!\n"));
|
||||||
+ if (link_return != NULL)
|
+ if (link_return != NULL)
|
||||||
+ {
|
+ {
|
||||||
+ if (ret_bfd != NULL)
|
+ if (ret_bfd != NULL)
|
||||||
@ -650,7 +664,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
|
/* Common code for finding BFDs of a given build-id. This function
|
||||||
@@ -124,7 +626,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
|
@@ -131,7 +634,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
|
||||||
|
|
||||||
static gdb_bfd_ref_ptr
|
static gdb_bfd_ref_ptr
|
||||||
build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
||||||
@ -659,7 +673,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
|||||||
{
|
{
|
||||||
/* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
|
/* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
|
||||||
cause "/.build-id/..." lookups. */
|
cause "/.build-id/..." lookups. */
|
||||||
@@ -147,16 +649,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
@@ -154,16 +657,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
{
|
{
|
||||||
size--;
|
size--;
|
||||||
@ -680,8 +694,8 @@ 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;
|
||||||
|
|
||||||
@@ -170,7 +673,8 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
@@ -174,7 +678,8 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
||||||
if (strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) != 0)
|
if (!gdb_sysroot.empty ())
|
||||||
{
|
{
|
||||||
link = gdb_sysroot + link;
|
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);
|
||||||
@ -690,7 +704,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;
|
||||||
}
|
}
|
||||||
@@ -179,38 +683,208 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
@@ -183,30 +688,649 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id,
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -708,8 +722,440 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
|||||||
+ return result;
|
+ return result;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
|
+#ifdef HAVE_LIBRPM
|
||||||
|
+
|
||||||
|
+#include <rpm/rpmlib.h>
|
||||||
|
+#include <rpm/rpmts.h>
|
||||||
|
+#include <rpm/rpmdb.h>
|
||||||
|
+#include <rpm/header.h>
|
||||||
|
+#ifdef DLOPEN_LIBRPM
|
||||||
|
+#include <dlfcn.h>
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+/* Workarodun https://bugzilla.redhat.com/show_bug.cgi?id=643031
|
||||||
|
+ librpm must not exit() an application on SIGINT
|
||||||
|
+
|
||||||
|
+ Enable or disable a signal handler. SIGNUM: signal to enable (or disable
|
||||||
|
+ if negative). HANDLER: sa_sigaction handler (or NULL to use
|
||||||
|
+ rpmsqHandler()). Returns: no. of refs, -1 on error. */
|
||||||
|
+extern int rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler);
|
||||||
|
+int
|
||||||
|
+rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler)
|
||||||
|
+{
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
|
||||||
|
+ and avoid their duplicities during a single inferior run. */
|
||||||
|
+
|
||||||
|
+static struct htab *missing_rpm_hash;
|
||||||
|
+
|
||||||
|
+/* This MISSING_RPM_LIST tracker is used to collect and print as a single line
|
||||||
|
+ all the rpms right before the nearest GDB prompt. It gets cleared after
|
||||||
|
+ each such print (it is questionable if we should clear it after the print).
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+struct missing_rpm
|
||||||
|
+ {
|
||||||
|
+ struct missing_rpm *next;
|
||||||
|
+ char rpm[1];
|
||||||
|
+ };
|
||||||
|
+static struct missing_rpm *missing_rpm_list;
|
||||||
|
+static int missing_rpm_list_entries;
|
||||||
|
+
|
||||||
|
+/* Returns the count of newly added rpms. */
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+#ifndef GDB_INDEX_VERIFY_VENDOR
|
||||||
|
+missing_rpm_enlist (const char *filename)
|
||||||
|
+#else
|
||||||
|
+missing_rpm_enlist_1 (const char *filename, int verify_vendor)
|
||||||
|
+#endif
|
||||||
|
+{
|
||||||
|
+ static int rpm_init_done = 0;
|
||||||
|
+ rpmts ts;
|
||||||
|
+ rpmdbMatchIterator mi;
|
||||||
|
+ int count = 0;
|
||||||
|
+
|
||||||
|
+#ifdef DLOPEN_LIBRPM
|
||||||
|
+ /* Duplicate here the declarations to verify they match. The same sanity
|
||||||
|
+ check is present also in `configure.ac'. */
|
||||||
|
+ extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
|
||||||
|
+ static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg);
|
||||||
|
+ extern int rpmReadConfigFiles(const char * file, const char * target);
|
||||||
|
+ static int (*rpmReadConfigFiles_p) (const char * file, const char * target);
|
||||||
|
+ extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi);
|
||||||
|
+ static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi);
|
||||||
|
+ extern Header rpmdbNextIterator(rpmdbMatchIterator mi);
|
||||||
|
+ static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi);
|
||||||
|
+ extern rpmts rpmtsCreate(void);
|
||||||
|
+ static rpmts (*rpmtsCreate_p) (void);
|
||||||
|
+ extern rpmts rpmtsFree(rpmts ts);
|
||||||
|
+ static rpmts (*rpmtsFree_p) (rpmts ts);
|
||||||
|
+ extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag,
|
||||||
|
+ const void * keyp, size_t keylen);
|
||||||
|
+ static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts,
|
||||||
|
+ rpmTag rpmtag,
|
||||||
|
+ const void *keyp,
|
||||||
|
+ size_t keylen);
|
||||||
|
+#else /* !DLOPEN_LIBRPM */
|
||||||
|
+# define headerFormat_p headerFormat
|
||||||
|
+# define rpmReadConfigFiles_p rpmReadConfigFiles
|
||||||
|
+# define rpmdbFreeIterator_p rpmdbFreeIterator
|
||||||
|
+# define rpmdbNextIterator_p rpmdbNextIterator
|
||||||
|
+# define rpmtsCreate_p rpmtsCreate
|
||||||
|
+# define rpmtsFree_p rpmtsFree
|
||||||
|
+# define rpmtsInitIterator_p rpmtsInitIterator
|
||||||
|
+#endif /* !DLOPEN_LIBRPM */
|
||||||
|
+
|
||||||
|
+ gdb_assert (filename != NULL);
|
||||||
|
+
|
||||||
|
+ if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ if (is_target_filename (filename))
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ if (filename[0] != '/')
|
||||||
|
+ {
|
||||||
|
+ warning (_("Ignoring non-absolute filename: <%s>"), filename);
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!rpm_init_done)
|
||||||
|
+ {
|
||||||
|
+ static int init_tried;
|
||||||
|
+
|
||||||
|
+ /* Already failed the initialization before? */
|
||||||
|
+ if (init_tried)
|
||||||
|
+ return 0;
|
||||||
|
+ init_tried = 1;
|
||||||
|
+
|
||||||
|
+#ifdef DLOPEN_LIBRPM
|
||||||
|
+ {
|
||||||
|
+ void *h;
|
||||||
|
+
|
||||||
|
+ h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY);
|
||||||
|
+ if (!h)
|
||||||
|
+ {
|
||||||
|
+ warning (_("Unable to open \"%s\" (%s), "
|
||||||
|
+ "missing debuginfos notifications will not be displayed"),
|
||||||
|
+ DLOPEN_LIBRPM, dlerror ());
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!((headerFormat_p = (char *(*) (Header h, const char * fmt, errmsg_t *errmsg)) dlsym (h, "headerFormat"))
|
||||||
|
+ && (rpmReadConfigFiles_p = (int (*) (const char * file, const char * target)) dlsym (h, "rpmReadConfigFiles"))
|
||||||
|
+ && (rpmdbFreeIterator_p = (rpmdbMatchIterator (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbFreeIterator"))
|
||||||
|
+ && (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"))))
|
||||||
|
+ {
|
||||||
|
+ warning (_("Opened library \"%s\" is incompatible (%s), "
|
||||||
|
+ "missing debuginfos notifications will not be displayed"),
|
||||||
|
+ DLOPEN_LIBRPM, dlerror ());
|
||||||
|
+ if (dlclose (h))
|
||||||
|
+ warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM,
|
||||||
|
+ dlerror ());
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+#endif /* DLOPEN_LIBRPM */
|
||||||
|
+
|
||||||
|
+ if (rpmReadConfigFiles_p (NULL, NULL) != 0)
|
||||||
|
+ {
|
||||||
|
+ warning (_("Error reading the rpm configuration files"));
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ rpm_init_done = 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ts = rpmtsCreate_p ();
|
||||||
|
+
|
||||||
|
+ mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0);
|
||||||
|
+ if (mi != NULL)
|
||||||
|
+ {
|
||||||
|
+#ifndef GDB_INDEX_VERIFY_VENDOR
|
||||||
|
+ for (;;)
|
||||||
|
+#else
|
||||||
|
+ if (!verify_vendor) for (;;)
|
||||||
|
+#endif
|
||||||
|
+ {
|
||||||
|
+ Header h;
|
||||||
|
+ char *debuginfo, **slot, *s, *s2;
|
||||||
|
+ errmsg_t err;
|
||||||
|
+ size_t srcrpmlen = sizeof (".src.rpm") - 1;
|
||||||
|
+ size_t debuginfolen = sizeof ("-debuginfo") - 1;
|
||||||
|
+ rpmdbMatchIterator mi_debuginfo;
|
||||||
|
+
|
||||||
|
+ h = rpmdbNextIterator_p (mi);
|
||||||
|
+ if (h == NULL)
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ /* Verify the debuginfo file is not already installed. */
|
||||||
|
+
|
||||||
|
+ debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}",
|
||||||
|
+ &err);
|
||||||
|
+ if (!debuginfo)
|
||||||
|
+ {
|
||||||
|
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
||||||
|
+ err);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ /* s = `.src.rpm-debuginfo.%{arch}' */
|
||||||
|
+ s = strrchr (debuginfo, '-') - srcrpmlen;
|
||||||
|
+ s2 = NULL;
|
||||||
|
+ if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0)
|
||||||
|
+ {
|
||||||
|
+ /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */
|
||||||
|
+ s2 = (char *) memrchr (debuginfo, '-', s - debuginfo);
|
||||||
|
+ }
|
||||||
|
+ if (s2)
|
||||||
|
+ {
|
||||||
|
+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
|
||||||
|
+ s2 = (char *) memrchr (debuginfo, '-', s2 - debuginfo);
|
||||||
|
+ }
|
||||||
|
+ if (!s2)
|
||||||
|
+ {
|
||||||
|
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
||||||
|
+ debuginfo);
|
||||||
|
+ xfree (debuginfo);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ /* s = `.src.rpm-debuginfo.%{arch}' */
|
||||||
|
+ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
|
||||||
|
+ memmove (s2 + debuginfolen, s2, s - s2);
|
||||||
|
+ memcpy (s2, "-debuginfo", debuginfolen);
|
||||||
|
+ /* s = `XXXX.%{arch}' */
|
||||||
|
+ /* strlen ("XXXX") == srcrpmlen + debuginfolen */
|
||||||
|
+ /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */
|
||||||
|
+ /* strlen ("XX") == srcrpmlen */
|
||||||
|
+ memmove (s + debuginfolen, s + srcrpmlen + debuginfolen,
|
||||||
|
+ strlen (s + srcrpmlen + debuginfolen) + 1);
|
||||||
|
+ /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
|
||||||
|
+
|
||||||
|
+ /* 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);
|
||||||
|
+ xfree (debuginfo);
|
||||||
|
+ if (mi_debuginfo)
|
||||||
|
+ {
|
||||||
|
+ rpmdbFreeIterator_p (mi_debuginfo);
|
||||||
|
+ count = 0;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* The allocated memory gets utilized below for MISSING_RPM_HASH. */
|
||||||
|
+ debuginfo = headerFormat_p (h,
|
||||||
|
+ "%{name}-%{version}-%{release}.%{arch}",
|
||||||
|
+ &err);
|
||||||
|
+ if (!debuginfo)
|
||||||
|
+ {
|
||||||
|
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
||||||
|
+ err);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Base package name for `debuginfo-install'. We do not use the
|
||||||
|
+ `yum' command directly as the line
|
||||||
|
+ yum --enablerepo='*debug*' install NAME-debuginfo.ARCH
|
||||||
|
+ would be more complicated than just:
|
||||||
|
+ debuginfo-install NAME-VERSION-RELEASE.ARCH
|
||||||
|
+ Do not supply the rpm base name (derived from .src.rpm name) as
|
||||||
|
+ debuginfo-install is unable to install the debuginfo package if
|
||||||
|
+ the base name PKG binary rpm is not installed while for example
|
||||||
|
+ PKG-libs would be installed (RH Bug 467901).
|
||||||
|
+ FUTURE: After multiple debuginfo versions simultaneously installed
|
||||||
|
+ get supported the support for the VERSION-RELEASE tags handling
|
||||||
|
+ may need an update. */
|
||||||
|
+
|
||||||
|
+ if (missing_rpm_hash == NULL)
|
||||||
|
+ {
|
||||||
|
+ /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE
|
||||||
|
+ should not deallocate the entries. */
|
||||||
|
+
|
||||||
|
+ missing_rpm_hash = htab_create_alloc (64, htab_hash_string,
|
||||||
|
+ (int (*) (const void *, const void *)) streq,
|
||||||
|
+ NULL, xcalloc, xfree);
|
||||||
|
+ }
|
||||||
|
+ slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT);
|
||||||
|
+ /* XCALLOC never returns NULL. */
|
||||||
|
+ gdb_assert (slot != NULL);
|
||||||
|
+ if (*slot == NULL)
|
||||||
|
+ {
|
||||||
|
+ struct missing_rpm *missing_rpm;
|
||||||
|
+
|
||||||
|
+ *slot = debuginfo;
|
||||||
|
+
|
||||||
|
+ missing_rpm = (struct missing_rpm *) xmalloc (sizeof (*missing_rpm) + strlen (debuginfo));
|
||||||
|
+ strcpy (missing_rpm->rpm, debuginfo);
|
||||||
|
+ missing_rpm->next = missing_rpm_list;
|
||||||
|
+ missing_rpm_list = missing_rpm;
|
||||||
|
+ missing_rpm_list_entries++;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ xfree (debuginfo);
|
||||||
|
+ count++;
|
||||||
|
+ }
|
||||||
|
+#ifdef GDB_INDEX_VERIFY_VENDOR
|
||||||
|
+ else /* verify_vendor */
|
||||||
|
+ {
|
||||||
|
+ int vendor_pass = 0, vendor_fail = 0;
|
||||||
|
+
|
||||||
|
+ for (;;)
|
||||||
|
+ {
|
||||||
|
+ Header h;
|
||||||
|
+ errmsg_t err;
|
||||||
|
+ char *vendor;
|
||||||
|
+
|
||||||
|
+ h = rpmdbNextIterator_p (mi);
|
||||||
|
+ if (h == NULL)
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ vendor = headerFormat_p (h, "%{vendor}", &err);
|
||||||
|
+ if (!vendor)
|
||||||
|
+ {
|
||||||
|
+ warning (_("Error querying the rpm file `%s': %s"), filename,
|
||||||
|
+ err);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ if (strcmp (vendor, "Red Hat, Inc.") == 0)
|
||||||
|
+ vendor_pass = 1;
|
||||||
|
+ else
|
||||||
|
+ vendor_fail = 1;
|
||||||
|
+ xfree (vendor);
|
||||||
|
+ }
|
||||||
|
+ count = vendor_pass != 0 && vendor_fail == 0;
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+ rpmdbFreeIterator_p (mi);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ rpmtsFree_p (ts);
|
||||||
|
+
|
||||||
|
+ return count;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#ifdef GDB_INDEX_VERIFY_VENDOR
|
||||||
|
+missing_rpm_enlist (const char *filename)
|
||||||
|
+{
|
||||||
|
+ return missing_rpm_enlist_1 (filename, 0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+extern int rpm_verify_vendor (const char *filename);
|
||||||
|
+int
|
||||||
|
+rpm_verify_vendor (const char *filename)
|
||||||
|
+{
|
||||||
|
+ return missing_rpm_enlist_1 (filename, 1);
|
||||||
|
+}
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+static bool
|
||||||
|
+missing_rpm_list_compar (const char *ap, const char *bp)
|
||||||
|
+{
|
||||||
|
+ return strcoll (ap, bp) < 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/* It returns a NULL-terminated array of strings needing to be FREEd. It may
|
||||||
|
+ also return only NULL. */
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+missing_rpm_list_print (void)
|
||||||
|
+{
|
||||||
|
+ struct missing_rpm *list_iter;
|
||||||
|
+
|
||||||
|
+ if (missing_rpm_list_entries == 0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ std::vector<const char *> array (missing_rpm_list_entries);
|
||||||
|
+ size_t idx = 0;
|
||||||
|
+
|
||||||
|
+ for (list_iter = missing_rpm_list; list_iter != NULL;
|
||||||
|
+ list_iter = list_iter->next)
|
||||||
|
+ {
|
||||||
|
+ array[idx++] = list_iter->rpm;
|
||||||
|
+ }
|
||||||
|
+ gdb_assert (idx == missing_rpm_list_entries);
|
||||||
|
+
|
||||||
|
+ std::sort (array.begin (), array.end (), missing_rpm_list_compar);
|
||||||
|
+
|
||||||
|
+ /* We zero out the number of missing RPMs here because of a nasty
|
||||||
|
+ bug (see RHBZ 1801974).
|
||||||
|
+
|
||||||
|
+ When we call 'puts_unfiltered' below, if pagination is on and if
|
||||||
|
+ the number of missing RPMs is big enough to trigger pagination,
|
||||||
|
+ we will end up in an infinite recursion. The call chain looks
|
||||||
|
+ like this:
|
||||||
|
+
|
||||||
|
+ missing_rpm_list_print -> puts_unfiltered -> fputs_maybe_filtered
|
||||||
|
+ -> prompt_for_continue -> display_gdb_prompt ->
|
||||||
|
+ debug_flush_missing -> missing_rpm_list_print ...
|
||||||
|
+
|
||||||
|
+ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero
|
||||||
|
+ *before* calling any print function. */
|
||||||
|
+ missing_rpm_list_entries = 0;
|
||||||
|
+
|
||||||
|
+ printf_unfiltered (_("Missing separate debuginfos, use: %s"),
|
||||||
|
+#ifdef DNF_DEBUGINFO_INSTALL
|
||||||
|
+ "dnf "
|
||||||
|
+#endif
|
||||||
|
+ "debuginfo-install");
|
||||||
|
+ for (const char *el : array)
|
||||||
|
+ {
|
||||||
|
+ puts_unfiltered (" ");
|
||||||
|
+ puts_unfiltered (el);
|
||||||
|
+ }
|
||||||
|
+ puts_unfiltered ("\n");
|
||||||
|
+
|
||||||
|
+ while (missing_rpm_list != NULL)
|
||||||
|
+ {
|
||||||
|
+ list_iter = missing_rpm_list;
|
||||||
|
+ missing_rpm_list = list_iter->next;
|
||||||
|
+ xfree (list_iter);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+missing_rpm_change (void)
|
||||||
|
+{
|
||||||
|
+ debug_flush_missing ();
|
||||||
|
+
|
||||||
|
+ gdb_assert (missing_rpm_list == NULL);
|
||||||
|
+ if (missing_rpm_hash != NULL)
|
||||||
|
+ {
|
||||||
|
+ htab_delete (missing_rpm_hash);
|
||||||
|
+ missing_rpm_hash = NULL;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+enum missing_exec
|
||||||
|
+ {
|
||||||
|
+ /* Init state. EXEC_BFD also still could be NULL. */
|
||||||
|
+ MISSING_EXEC_NOT_TRIED,
|
||||||
|
+ /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */
|
||||||
|
+ MISSING_EXEC_NOT_FOUND,
|
||||||
|
+ /* We found EXEC_BFD by RPM and we either have its symbols (either embedded
|
||||||
|
+ or separate) or the main executable's RPM is now contained in
|
||||||
|
+ MISSING_RPM_HASH. */
|
||||||
|
+ MISSING_EXEC_ENLISTED
|
||||||
|
+ };
|
||||||
|
+static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED;
|
||||||
|
+
|
||||||
|
+#endif /* HAVE_LIBRPM */
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+debug_flush_missing (void)
|
||||||
|
+{
|
||||||
|
+#ifdef HAVE_LIBRPM
|
||||||
|
+ missing_rpm_list_print ();
|
||||||
|
+#endif
|
||||||
|
+}
|
||||||
|
+
|
||||||
+/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
|
+/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
|
||||||
+ Try to install the hash file ...
|
+ yum --enablerepo='*debug*' install ...
|
||||||
+ avoidance. */
|
+ avoidance. */
|
||||||
+
|
+
|
||||||
+struct missing_filepair
|
+struct missing_filepair
|
||||||
@ -763,11 +1209,17 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
|||||||
+ /* All their memory came just from missing_filepair_OBSTACK. */
|
+ /* All their memory came just from missing_filepair_OBSTACK. */
|
||||||
+ missing_filepair_hash = NULL;
|
+ missing_filepair_hash = NULL;
|
||||||
+ }
|
+ }
|
||||||
|
+#ifdef HAVE_LIBRPM
|
||||||
|
+ missing_exec = MISSING_EXEC_NOT_TRIED;
|
||||||
|
+#endif
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void
|
+static void
|
||||||
+debug_print_executable_changed (void)
|
+debug_print_executable_changed (void)
|
||||||
+{
|
+{
|
||||||
|
+#ifdef HAVE_LIBRPM
|
||||||
|
+ missing_rpm_change ();
|
||||||
|
+#endif
|
||||||
+ missing_filepair_change ();
|
+ missing_filepair_change ();
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
@ -834,14 +1286,38 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
|||||||
+
|
+
|
||||||
+ *slot = missing_filepair;
|
+ *slot = missing_filepair;
|
||||||
+
|
+
|
||||||
|
+#ifdef HAVE_LIBRPM
|
||||||
|
+ if (missing_exec == MISSING_EXEC_NOT_TRIED)
|
||||||
|
+ {
|
||||||
|
+ const char *execfilename = get_exec_file (0);
|
||||||
|
+
|
||||||
|
+ if (execfilename != NULL)
|
||||||
|
+ {
|
||||||
|
+ if (missing_rpm_enlist (execfilename) == 0)
|
||||||
|
+ missing_exec = MISSING_EXEC_NOT_FOUND;
|
||||||
|
+ else
|
||||||
|
+ missing_exec = MISSING_EXEC_ENLISTED;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ if (missing_exec != MISSING_EXEC_ENLISTED)
|
||||||
|
+ if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0)
|
||||||
|
+ && (debug == NULL || missing_rpm_enlist (debug) == 0))
|
||||||
|
+#endif /* HAVE_LIBRPM */
|
||||||
|
+ {
|
||||||
+ /* 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,
|
+ fprintf_unfiltered (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 to install the hash file %s\n"),
|
+ fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
|
||||||
+ debug);
|
+#ifdef DNF_DEBUGINFO_INSTALL
|
||||||
|
+ "dnf"
|
||||||
|
+#else
|
||||||
|
+ "yum"
|
||||||
|
+#endif
|
||||||
|
+ " --enablerepo='*debug*' install", debug);
|
||||||
|
+ }
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
/* See build-id.h. */
|
/* See build-id.h. */
|
||||||
@ -884,7 +1360,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
|
|||||||
if (build_id != NULL)
|
if (build_id != NULL)
|
||||||
{
|
{
|
||||||
if (separate_debug_file_debug)
|
if (separate_debug_file_debug)
|
||||||
printf_unfiltered (_("\nLooking for separate debug info (build-id) for "
|
@@ -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));
|
"%s\n"), objfile_name (objfile));
|
||||||
|
|
||||||
+ char *build_id_filename_cstr = NULL;
|
+ char *build_id_filename_cstr = NULL;
|
||||||
@ -906,7 +1383,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 ()),
|
||||||
@@ -223,3 +897,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
|
@@ -228,3 +1365,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
|
||||||
|
|
||||||
return std::string ();
|
return std::string ();
|
||||||
}
|
}
|
||||||
@ -1056,7 +1533,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
|
||||||
@@ -21415,6 +21415,27 @@ information files.
|
@@ -21524,6 +21524,27 @@ information files.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@ -1087,7 +1564,7 @@ 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
|
||||||
@@ -95,7 +95,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
|
@@ -97,7 +97,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Get build id of objfile. */
|
/* Get build id of objfile. */
|
||||||
@ -1095,8 +1572,8 @@ diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
|
|||||||
+ 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);
|
||||||
if (build_id == nullptr)
|
if (build_id == nullptr)
|
||||||
{
|
{
|
||||||
if (debug_index_cache)
|
index_cache_debug ("objfile %s has no build id",
|
||||||
@@ -113,7 +113,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
|
@@ -114,7 +114,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
|
||||||
|
|
||||||
if (dwz != nullptr)
|
if (dwz != nullptr)
|
||||||
{
|
{
|
||||||
@ -1109,7 +1586,7 @@ diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
|
|||||||
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
|
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
|
||||||
@@ -5447,7 +5447,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
|
@@ -5476,7 +5476,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)
|
||||||
{
|
{
|
||||||
@ -1118,7 +1595,7 @@ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
|
|||||||
if (build_id == nullptr)
|
if (build_id == nullptr)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
@@ -5460,7 +5460,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
|
@@ -5489,7 +5489,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)
|
||||||
{
|
{
|
||||||
@ -1130,7 +1607,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
|
||||||
@@ -1272,7 +1272,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
@@ -1270,7 +1270,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||||
&& objfile->separate_debug_objfile == NULL
|
&& objfile->separate_debug_objfile == NULL
|
||||||
&& objfile->separate_debug_objfile_backlink == NULL)
|
&& objfile->separate_debug_objfile_backlink == NULL)
|
||||||
{
|
{
|
||||||
@ -1141,7 +1618,7 @@ 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);
|
||||||
@@ -1287,7 +1289,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
@@ -1285,7 +1287,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
has_dwarf2 = false;
|
has_dwarf2 = false;
|
||||||
@ -1150,7 +1627,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c
|
|||||||
|
|
||||||
if (build_id != nullptr)
|
if (build_id != nullptr)
|
||||||
{
|
{
|
||||||
@@ -1312,6 +1314,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
@@ -1310,6 +1312,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
||||||
has_dwarf2 = true;
|
has_dwarf2 = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1164,7 +1641,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
|
||||||
@@ -237,7 +237,7 @@ validate_exec_file (int from_tty)
|
@@ -238,7 +238,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
|
||||||
@ -1173,7 +1650,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
|
||||||
@@ -250,7 +250,7 @@ validate_exec_file (int from_tty)
|
@@ -251,7 +251,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
|
||||||
@ -1185,7 +1662,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
|
||||||
@@ -812,6 +812,10 @@ struct objfile
|
@@ -769,6 +769,10 @@ struct objfile
|
||||||
bool skip_jit_symbol_lookup = false;
|
bool skip_jit_symbol_lookup = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1228,7 +1705,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
|
|||||||
|
|
||||||
static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
|
static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
|
||||||
static int svr4_have_link_map_offsets (void);
|
static int svr4_have_link_map_offsets (void);
|
||||||
@@ -1348,9 +1349,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
|
@@ -1248,9 +1249,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1286,7 +1763,7 @@ 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
|
||||||
@@ -1178,7 +1178,7 @@ open_source_file (struct symtab *s)
|
@@ -1199,7 +1199,7 @@ open_source_file (struct symtab *s)
|
||||||
srcpath += s->filename;
|
srcpath += s->filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1381,7 +1858,7 @@ 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
|
||||||
@@ -130,7 +130,8 @@ if ![info exists INTERNAL_GDBFLAGS] {
|
@@ -141,7 +141,8 @@ if ![info exists INTERNAL_GDBFLAGS] {
|
||||||
"-nx" \
|
"-nx" \
|
||||||
"-data-directory $BUILD_DATA_DIRECTORY" \
|
"-data-directory $BUILD_DATA_DIRECTORY" \
|
||||||
{-iex "set height 0"} \
|
{-iex "set height 0"} \
|
||||||
@ -1391,7 +1868,7 @@ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
|
|||||||
}
|
}
|
||||||
|
|
||||||
# The variable gdb_prompt is a regexp which matches the gdb prompt.
|
# The variable gdb_prompt is a regexp which matches the gdb prompt.
|
||||||
@@ -2130,6 +2131,17 @@ proc default_gdb_start { } {
|
@@ -2200,6 +2201,17 @@ proc default_gdb_start { } {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
@@ -14291,7 +14291,17 @@ remote_target::pid_to_exec_file (int pid)
|
@@ -14343,7 +14343,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)
|
||||||
|
@ -27,7 +27,7 @@ diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/so
|
|||||||
|
|
||||||
if [get_compiler_info] {
|
if [get_compiler_info] {
|
||||||
return -1
|
return -1
|
||||||
@@ -71,8 +72,26 @@ gdb_test "br foo2" \
|
@@ -70,8 +71,26 @@ gdb_test "br foo2" \
|
||||||
"Breakpoint.*: foo2. .2 locations..*" \
|
"Breakpoint.*: foo2. .2 locations..*" \
|
||||||
"foo2 in mdlib"
|
"foo2 in mdlib"
|
||||||
|
|
||||||
|
@ -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
|
||||||
@@ -9552,6 +9552,7 @@ if test x"$prefer_curses" = xyes; then
|
@@ -9567,6 +9567,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 :
|
||||||
@@ -9576,7 +9577,7 @@ return waddstr ();
|
@@ -9591,7 +9592,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
|
||||||
@@ -9650,6 +9651,7 @@ case $host_os in
|
@@ -9665,6 +9666,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 :
|
||||||
@@ -9674,7 +9676,7 @@ return tgetent ();
|
@@ -9689,7 +9691,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
|
||||||
@@ -736,7 +736,8 @@ if test x"$prefer_curses" = xyes; then
|
@@ -713,7 +713,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
|
||||||
@@ -778,7 +779,8 @@ case $host_os in
|
@@ -755,7 +756,8 @@ case $host_os in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# These are the libraries checked by Readline.
|
# These are the libraries checked by Readline.
|
||||||
|
@ -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
|
||||||
@@ -140,7 +140,7 @@ AC_DEFUN([GDB_AC_COMMON], [
|
@@ -156,7 +156,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
|
||||||
|
@ -1,258 +0,0 @@
|
|||||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
||||||
From: Bruno Larsen <blarsen@redhat.com>
|
|
||||||
Date: Tue, 9 Nov 2021 14:07:26 -0300
|
|
||||||
Subject: gdb-rhbz-853071-update-manpages.patch
|
|
||||||
|
|
||||||
;; Backport manpage update
|
|
||||||
|
|
||||||
[gdb/doc]: Updated manpages to be consistent with help
|
|
||||||
|
|
||||||
Updated manpages to be consistent with help information provided by the
|
|
||||||
binary. The main changes are:
|
|
||||||
|
|
||||||
* Making all long-form options have '--', instead of a single '-';
|
|
||||||
* added most of the missing options to the manpage;
|
|
||||||
* removed the information about using '+' instead of '-', since it
|
|
||||||
doesn't seem to be supported anymore.
|
|
||||||
|
|
||||||
This also fixes 2 upstream bugs:
|
|
||||||
* https://sourceware.org/bugzilla/show_bug.cgi?id=23965; by adding
|
|
||||||
--args to the manpage
|
|
||||||
* https://sourceware.org/bugzilla/show_bug.cgi?id=10619; by adding the
|
|
||||||
double dashes
|
|
||||||
|
|
||||||
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
|
||||||
--- a/gdb/doc/gdb.texinfo
|
|
||||||
+++ b/gdb/doc/gdb.texinfo
|
|
||||||
@@ -47030,14 +47030,7 @@ switch (die->tag)
|
|
||||||
@c man title gdb The GNU Debugger
|
|
||||||
|
|
||||||
@c man begin SYNOPSIS gdb
|
|
||||||
-gdb [@option{-help}] [@option{-nh}] [@option{-nx}] [@option{-q}]
|
|
||||||
-[@option{-batch}] [@option{-cd=}@var{dir}] [@option{-f}]
|
|
||||||
-[@option{-b}@w{ }@var{bps}]
|
|
||||||
- [@option{-tty=}@var{dev}] [@option{-s} @var{symfile}]
|
|
||||||
-[@option{-e}@w{ }@var{prog}] [@option{-se}@w{ }@var{prog}]
|
|
||||||
-[@option{-c}@w{ }@var{core}] [@option{-p}@w{ }@var{procID}]
|
|
||||||
- [@option{-x}@w{ }@var{cmds}] [@option{-d}@w{ }@var{dir}]
|
|
||||||
-[@var{prog}|@var{prog} @var{procID}|@var{prog} @var{core}]
|
|
||||||
+gdb [OPTIONS] [@var{prog}|@var{prog} @var{procID}|@var{prog} @var{core}]
|
|
||||||
@c man end
|
|
||||||
|
|
||||||
@c man begin DESCRIPTION gdb
|
|
||||||
@@ -47101,8 +47094,8 @@ Here are some of the most frequently needed @value{GDBN} commands:
|
|
||||||
|
|
||||||
@c pod2man highlights the right hand side of the @item lines.
|
|
||||||
@table @env
|
|
||||||
-@item break [@var{file}:]@var{function}
|
|
||||||
-Set a breakpoint at @var{function} (in @var{file}).
|
|
||||||
+@item break [@var{file}:][@var{function}|@var{line}]
|
|
||||||
+Set a breakpoint at @var{function} or @var{line} (in @var{file}).
|
|
||||||
|
|
||||||
@item run [@var{arglist}]
|
|
||||||
Start your program (with @var{arglist}, if specified).
|
|
||||||
@@ -47150,72 +47143,91 @@ as the @code{gdb} entry in the @code{info} program.
|
|
||||||
Any arguments other than options specify an executable
|
|
||||||
file and core file (or process ID); that is, the first argument
|
|
||||||
encountered with no
|
|
||||||
-associated option flag is equivalent to a @option{-se} option, and the second,
|
|
||||||
+associated option flag is equivalent to a @option{--se} option, and the second,
|
|
||||||
if any, is equivalent to a @option{-c} option if it's the name of a file.
|
|
||||||
Many options have
|
|
||||||
-both long and short forms; both are shown here. The long forms are also
|
|
||||||
+both long and abbreviated forms; both are shown here. The long forms are also
|
|
||||||
recognized if you truncate them, so long as enough of the option is
|
|
||||||
-present to be unambiguous. (If you prefer, you can flag option
|
|
||||||
-arguments with @option{+} rather than @option{-}, though we illustrate the
|
|
||||||
-more usual convention.)
|
|
||||||
+present to be unambiguous.
|
|
||||||
+
|
|
||||||
+The abbreviated forms are shown here with @samp{-} and long forms are shown
|
|
||||||
+with @samp{--} to reflect how they are shown in @option{--help}. However,
|
|
||||||
+@value{GDBN} recognizes all of the following conventions for most options:
|
|
||||||
+
|
|
||||||
+@table @code
|
|
||||||
+@item --option=@var{value}
|
|
||||||
+@item --option @var{value}
|
|
||||||
+@item -option=@var{value}
|
|
||||||
+@item -option @var{value}
|
|
||||||
+@item --o=@var{value}
|
|
||||||
+@item --o @var{value}
|
|
||||||
+@item -o=@var{value}
|
|
||||||
+@item -o @var{value}
|
|
||||||
+@end table
|
|
||||||
|
|
||||||
All the options and command line arguments you give are processed
|
|
||||||
in sequential order. The order makes a difference when the @option{-x}
|
|
||||||
option is used.
|
|
||||||
|
|
||||||
@table @env
|
|
||||||
-@item -help
|
|
||||||
+@item --help
|
|
||||||
@itemx -h
|
|
||||||
List all options, with brief explanations.
|
|
||||||
|
|
||||||
-@item -symbols=@var{file}
|
|
||||||
+@item --symbols=@var{file}
|
|
||||||
@itemx -s @var{file}
|
|
||||||
-Read symbol table from file @var{file}.
|
|
||||||
+Read symbol table from @var{file}.
|
|
||||||
|
|
||||||
-@item -write
|
|
||||||
+@item --write
|
|
||||||
Enable writing into executable and core files.
|
|
||||||
|
|
||||||
-@item -exec=@var{file}
|
|
||||||
+@item --exec=@var{file}
|
|
||||||
@itemx -e @var{file}
|
|
||||||
-Use file @var{file} as the executable file to execute when
|
|
||||||
+Use @var{file} as the executable file to execute when
|
|
||||||
appropriate, and for examining pure data in conjunction with a core
|
|
||||||
dump.
|
|
||||||
|
|
||||||
-@item -se=@var{file}
|
|
||||||
-Read symbol table from file @var{file} and use it as the executable
|
|
||||||
+@item --se=@var{file}
|
|
||||||
+Read symbol table from @var{file} and use it as the executable
|
|
||||||
file.
|
|
||||||
|
|
||||||
-@item -core=@var{file}
|
|
||||||
+@item --core=@var{file}
|
|
||||||
@itemx -c @var{file}
|
|
||||||
-Use file @var{file} as a core dump to examine.
|
|
||||||
+Use @var{file} as a core dump to examine.
|
|
||||||
|
|
||||||
-@item -command=@var{file}
|
|
||||||
+@item --command=@var{file}
|
|
||||||
@itemx -x @var{file}
|
|
||||||
-Execute @value{GDBN} commands from file @var{file}.
|
|
||||||
+Execute @value{GDBN} commands from @var{file}.
|
|
||||||
|
|
||||||
+@item --eval-command=@var{command}
|
|
||||||
@item -ex @var{command}
|
|
||||||
Execute given @value{GDBN} @var{command}.
|
|
||||||
|
|
||||||
-@item -directory=@var{directory}
|
|
||||||
+@item --init-eval-command=@var{command}
|
|
||||||
+@item -iex
|
|
||||||
+Execute @value{GDBN} @var{command} before loading the inferior.
|
|
||||||
+
|
|
||||||
+@item --directory=@var{directory}
|
|
||||||
@itemx -d @var{directory}
|
|
||||||
Add @var{directory} to the path to search for source files.
|
|
||||||
|
|
||||||
-@item -nh
|
|
||||||
+@item --nh
|
|
||||||
Do not execute commands from @file{~/.config/gdb/gdbinit},
|
|
||||||
@file{~/.gdbinit}, @file{~/.config/gdb/gdbearlyinit}, or
|
|
||||||
@file{~/.gdbearlyinit}
|
|
||||||
|
|
||||||
-@item -nx
|
|
||||||
+@item --nx
|
|
||||||
@itemx -n
|
|
||||||
Do not execute commands from any @file{.gdbinit} or
|
|
||||||
@file{.gdbearlyinit} initialization files.
|
|
||||||
|
|
||||||
-@item -quiet
|
|
||||||
+@item --quiet
|
|
||||||
+@item --silent
|
|
||||||
@itemx -q
|
|
||||||
``Quiet''. Do not print the introductory and copyright messages. These
|
|
||||||
messages are also suppressed in batch mode.
|
|
||||||
|
|
||||||
-@item -batch
|
|
||||||
+@item --batch
|
|
||||||
Run in batch mode. Exit with status @code{0} after processing all the command
|
|
||||||
files specified with @option{-x} (and @file{.gdbinit}, if not inhibited).
|
|
||||||
Exit with nonzero status if an error occurs in executing the @value{GDBN}
|
|
||||||
@@ -47233,11 +47245,71 @@ Program exited normally.
|
|
||||||
(which is ordinarily issued whenever a program running under @value{GDBN} control
|
|
||||||
terminates) is not issued when running in batch mode.
|
|
||||||
|
|
||||||
-@item -cd=@var{directory}
|
|
||||||
+@item --batch-silent
|
|
||||||
+Run in batch mode, just like @option{--batch}, but totally silent. All @value{GDBN}
|
|
||||||
+output is supressed (stderr is unaffected). This is much quieter than
|
|
||||||
+@option{--silent} and would be useless for an interactive session.
|
|
||||||
+
|
|
||||||
+This is particularly useful when using targets that give @samp{Loading section}
|
|
||||||
+messages, for example.
|
|
||||||
+
|
|
||||||
+Note that targets that give their output via @value{GDBN}, as opposed to writing
|
|
||||||
+directly to @code{stdout}, will also be made silent.
|
|
||||||
+
|
|
||||||
+@item --args @var{prog} [@var{arglist}]
|
|
||||||
+Change interpretation of command line so that arguments following this
|
|
||||||
+option are passed as arguments to the inferior. As an example, take
|
|
||||||
+the following command:
|
|
||||||
+
|
|
||||||
+@smallexample
|
|
||||||
+gdb ./a.out -q
|
|
||||||
+@end smallexample
|
|
||||||
+
|
|
||||||
+@noindent
|
|
||||||
+It would start @value{GDBN} with @option{-q}, not printing the introductory message. On
|
|
||||||
+the other hand, using:
|
|
||||||
+
|
|
||||||
+@smallexample
|
|
||||||
+gdb --args ./a.out -q
|
|
||||||
+@end smallexample
|
|
||||||
+
|
|
||||||
+@noindent
|
|
||||||
+starts @value{GDBN} with the introductory message, and passes the option to the inferior.
|
|
||||||
+
|
|
||||||
+@item --pid=@var{pid}
|
|
||||||
+Attach @value{GDBN} to an already running program, with the PID @var{pid}.
|
|
||||||
+
|
|
||||||
+@item --tui
|
|
||||||
+Open the terminal user interface.
|
|
||||||
+
|
|
||||||
+@item --readnow
|
|
||||||
+Read all symbols from the given symfile on the first access.
|
|
||||||
+
|
|
||||||
+@item --readnever
|
|
||||||
+Do not read symbol files.
|
|
||||||
+
|
|
||||||
+@item --dbx
|
|
||||||
+Run in DBX compatibility mode.
|
|
||||||
+
|
|
||||||
+@item --return-child-result
|
|
||||||
+@value{GDBN}'s exit code will be the same as the child's exit code.
|
|
||||||
+
|
|
||||||
+@item --configuration
|
|
||||||
+Print details about GDB configuration and then exit.
|
|
||||||
+
|
|
||||||
+@item --version
|
|
||||||
+Print version information and then exit.
|
|
||||||
+
|
|
||||||
+@item --cd=@var{directory}
|
|
||||||
Run @value{GDBN} using @var{directory} as its working directory,
|
|
||||||
instead of the current directory.
|
|
||||||
|
|
||||||
-@item -fullname
|
|
||||||
+@item --data-directory=@var{directory}
|
|
||||||
+@item -D
|
|
||||||
+Run @value{GDBN} using @var{directory} as its data directory. The data
|
|
||||||
+directory is where @value{GDBN} searches for its auxiliary files.
|
|
||||||
+
|
|
||||||
+@item --fullname
|
|
||||||
@itemx -f
|
|
||||||
Emacs sets this option when it runs @value{GDBN} as a subprocess. It tells
|
|
||||||
@value{GDBN} to output the full file name and line number in a standard,
|
|
||||||
@@ -47248,11 +47320,14 @@ and character position separated by colons, and a newline. The
|
|
||||||
Emacs-to-@value{GDBN} interface program uses the two @samp{\032}
|
|
||||||
characters as a signal to display the source code for the frame.
|
|
||||||
|
|
||||||
-@item -b @var{bps}
|
|
||||||
+@item -b @var{baudrate}
|
|
||||||
Set the line speed (baud rate or bits per second) of any serial
|
|
||||||
interface used by @value{GDBN} for remote debugging.
|
|
||||||
|
|
||||||
-@item -tty=@var{device}
|
|
||||||
+@item -l @var{timeout}
|
|
||||||
+Set timeout, in seconds, for remote debugging.
|
|
||||||
+
|
|
||||||
+@item --tty=@var{device}
|
|
||||||
Run using @var{device} for your program's standard input and output.
|
|
||||||
@end table
|
|
||||||
@c man end
|
|
@ -1,30 +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: Wed, 29 Sep 2021 10:58:50 +0200
|
|
||||||
Subject: gdb-rhbz1976887-field-location-kind.patch
|
|
||||||
|
|
||||||
;;Backport upstream patch which fixes internal-error: Unexpected
|
|
||||||
;;type field location kind (RHBZ 1976887).
|
|
||||||
|
|
||||||
gdbtypes.c: Add the case for FIELD_LOC_KIND_DWARF_BLOCK
|
|
||||||
|
|
||||||
The case for FIELD_LOC_KIND_DWARF_BLOCK was missing for
|
|
||||||
switch TYPE_FIELD_LOC_KIND. Thas caused an internal-error
|
|
||||||
under some circumstances.
|
|
||||||
|
|
||||||
Fixes bug 28030.
|
|
||||||
|
|
||||||
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
|
|
||||||
--- a/gdb/gdbtypes.c
|
|
||||||
+++ b/gdb/gdbtypes.c
|
|
||||||
@@ -5571,6 +5571,10 @@ copy_type_recursive (struct objfile *objfile,
|
|
||||||
xstrdup (TYPE_FIELD_STATIC_PHYSNAME (type,
|
|
||||||
i)));
|
|
||||||
break;
|
|
||||||
+ case FIELD_LOC_KIND_DWARF_BLOCK:
|
|
||||||
+ SET_FIELD_DWARF_BLOCK (new_type->field (i),
|
|
||||||
+ TYPE_FIELD_DWARF_BLOCK (type, i));
|
|
||||||
+ break;
|
|
||||||
default:
|
|
||||||
internal_error (__FILE__, __LINE__,
|
|
||||||
_("Unexpected type field location kind: %d"),
|
|
@ -1,185 +0,0 @@
|
|||||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
||||||
From: Kevin Buettner <kevinb@redhat.com>
|
|
||||||
Date: Mon, 11 Oct 2021 11:22:04 -0700
|
|
||||||
Subject: gdb-rhbz2012976-paper-over-fortran-lex-problems.patch
|
|
||||||
|
|
||||||
;; Backport gdb.fortran testsuite changes in order to avoid Fortran
|
|
||||||
;; lexical analyzer bug.
|
|
||||||
|
|
||||||
[gdb/testsuite] Fix FAIL in gdb.mi/mi-var-child-f.exp
|
|
||||||
|
|
||||||
When running test-case gdb.mi/mi-var-child-f.exp on openSUSE Tumbleweed
|
|
||||||
(with glibc 2.34) I run into:
|
|
||||||
...
|
|
||||||
(gdb) ^M
|
|
||||||
PASS: gdb.mi/mi-var-child-f.exp: mi runto prog_array
|
|
||||||
Expecting: ^(-var-create array \* array[^M
|
|
||||||
]+)?(\^done,name="array",numchild="[0-9]+",value=".*",type=.*,has_more="0"[^M
|
|
||||||
]+[(]gdb[)] ^M
|
|
||||||
[ ]*)
|
|
||||||
-var-create array * array^M
|
|
||||||
&"Attempt to use a type name as an expression.\n"^M
|
|
||||||
^error,msg="-var-create: unable to create variable object"^M
|
|
||||||
(gdb) ^M
|
|
||||||
FAIL: gdb.mi/mi-var-child-f.exp: create local variable array (unexpected output)
|
|
||||||
...
|
|
||||||
|
|
||||||
The problem is that the name array is used both:
|
|
||||||
- as the name for a local variable
|
|
||||||
- as the name of a type in glibc, in file malloc/dynarray-skeleton.c, as included
|
|
||||||
by nss/nss_files/files-hosts.c.
|
|
||||||
|
|
||||||
Fix this by ignoring the shared lib symbols.
|
|
||||||
|
|
||||||
Likewise in a couple of other fortran tests.
|
|
||||||
|
|
||||||
Tested on x86_64-linux.
|
|
||||||
|
|
||||||
diff --git a/gdb/testsuite/gdb.fortran/allocated.exp b/gdb/testsuite/gdb.fortran/allocated.exp
|
|
||||||
--- a/gdb/testsuite/gdb.fortran/allocated.exp
|
|
||||||
+++ b/gdb/testsuite/gdb.fortran/allocated.exp
|
|
||||||
@@ -25,11 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
+# Avoid shared lib symbols.
|
|
||||||
+gdb_test_no_output "set auto-solib-add off"
|
|
||||||
+
|
|
||||||
if ![fortran_runto_main] {
|
|
||||||
untested "could not run to main"
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
+# Avoid libc symbols, in particular the 'array' type.
|
|
||||||
+gdb_test_no_output "nosharedlibrary"
|
|
||||||
+
|
|
||||||
# Set all the breakpoints.
|
|
||||||
for { set i 1 } { $i < 6 } { incr i } {
|
|
||||||
gdb_breakpoint [gdb_get_line_number "Breakpoint $i"]
|
|
||||||
diff --git a/gdb/testsuite/gdb.fortran/array-slices-bad.exp b/gdb/testsuite/gdb.fortran/array-slices-bad.exp
|
|
||||||
--- a/gdb/testsuite/gdb.fortran/array-slices-bad.exp
|
|
||||||
+++ b/gdb/testsuite/gdb.fortran/array-slices-bad.exp
|
|
||||||
@@ -25,11 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
+# Avoid shared lib symbols.
|
|
||||||
+gdb_test_no_output "set auto-solib-add off"
|
|
||||||
+
|
|
||||||
if ![fortran_runto_main] {
|
|
||||||
untested "could not run to main"
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
+# Avoid libc symbols, in particular the 'array' type.
|
|
||||||
+gdb_test_no_output "nosharedlibrary"
|
|
||||||
+
|
|
||||||
# gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"]
|
|
||||||
gdb_breakpoint [gdb_get_line_number "First Breakpoint"]
|
|
||||||
gdb_breakpoint [gdb_get_line_number "Second Breakpoint"]
|
|
||||||
diff --git a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
|
|
||||||
--- a/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
|
|
||||||
+++ b/gdb/testsuite/gdb.fortran/array-slices-sub-slices.exp
|
|
||||||
@@ -25,11 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
+# Avoid shared lib symbols.
|
|
||||||
+gdb_test_no_output "set auto-solib-add off"
|
|
||||||
+
|
|
||||||
if ![fortran_runto_main] {
|
|
||||||
untested "could not run to main"
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
+# Avoid libc symbols, in particular the 'array' type.
|
|
||||||
+gdb_test_no_output "nosharedlibrary"
|
|
||||||
+
|
|
||||||
# gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"]
|
|
||||||
gdb_breakpoint [gdb_get_line_number "Stop Here"]
|
|
||||||
gdb_breakpoint [gdb_get_line_number "Final Breakpoint"]
|
|
||||||
diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp
|
|
||||||
--- a/gdb/testsuite/gdb.fortran/array-slices.exp
|
|
||||||
+++ b/gdb/testsuite/gdb.fortran/array-slices.exp
|
|
||||||
@@ -55,11 +55,17 @@ proc run_test { repack } {
|
|
||||||
|
|
||||||
clean_restart ${binfile}
|
|
||||||
|
|
||||||
+ # Avoid shared lib symbols.
|
|
||||||
+ gdb_test_no_output "set auto-solib-add off"
|
|
||||||
+
|
|
||||||
if ![fortran_runto_main] {
|
|
||||||
untested "could not run to main"
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
+ # Avoid libc symbols, in particular the 'array' type.
|
|
||||||
+ gdb_test_no_output "nosharedlibrary"
|
|
||||||
+
|
|
||||||
gdb_test_no_output "set fortran repack-array-slices $repack"
|
|
||||||
|
|
||||||
# gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"]
|
|
||||||
diff --git a/gdb/testsuite/gdb.fortran/lbound-ubound.exp b/gdb/testsuite/gdb.fortran/lbound-ubound.exp
|
|
||||||
--- a/gdb/testsuite/gdb.fortran/lbound-ubound.exp
|
|
||||||
+++ b/gdb/testsuite/gdb.fortran/lbound-ubound.exp
|
|
||||||
@@ -25,12 +25,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
+# Avoid shared lib symbols.
|
|
||||||
+gdb_test_no_output "set auto-solib-add off"
|
|
||||||
|
|
||||||
if ![fortran_runto_main] {
|
|
||||||
untested "could not run to main"
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
+# Avoid libc symbols, in particular the 'array' type.
|
|
||||||
+gdb_test_no_output "nosharedlibrary"
|
|
||||||
+
|
|
||||||
gdb_breakpoint [gdb_get_line_number "Test Breakpoint"]
|
|
||||||
gdb_breakpoint [gdb_get_line_number "Final Breakpoint"]
|
|
||||||
|
|
||||||
diff --git a/gdb/testsuite/gdb.fortran/subarray.exp b/gdb/testsuite/gdb.fortran/subarray.exp
|
|
||||||
--- a/gdb/testsuite/gdb.fortran/subarray.exp
|
|
||||||
+++ b/gdb/testsuite/gdb.fortran/subarray.exp
|
|
||||||
@@ -27,16 +27,17 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
-gdb_exit
|
|
||||||
-gdb_start
|
|
||||||
-gdb_reinitialize_dir $srcdir/$subdir
|
|
||||||
-gdb_load ${binfile}
|
|
||||||
+# Avoid shared lib symbols.
|
|
||||||
+gdb_test_no_output "set auto-solib-add off"
|
|
||||||
|
|
||||||
if ![fortran_runto_main] then {
|
|
||||||
perror "couldn't run to main"
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
+# Avoid libc symbols, in particular the 'array' type.
|
|
||||||
+gdb_test_no_output "nosharedlibrary"
|
|
||||||
+
|
|
||||||
# Try to set breakpoint at the last write statement.
|
|
||||||
|
|
||||||
set bp_location [gdb_get_line_number "str(:)"]
|
|
||||||
diff --git a/gdb/testsuite/gdb.mi/mi-var-child-f.exp b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
|
|
||||||
--- a/gdb/testsuite/gdb.mi/mi-var-child-f.exp
|
|
||||||
+++ b/gdb/testsuite/gdb.mi/mi-var-child-f.exp
|
|
||||||
@@ -36,8 +36,14 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
|
|
||||||
mi_gdb_reinitialize_dir $srcdir/$subdir
|
|
||||||
mi_gdb_load ${binfile}
|
|
||||||
|
|
||||||
+# Avoid shared lib symbols.
|
|
||||||
+mi_gdb_test "-gdb-set auto-solib-add off" "\\^done"
|
|
||||||
+
|
|
||||||
mi_runto prog_array
|
|
||||||
|
|
||||||
+# Avoid libc symbols, in particular the 'array' type.
|
|
||||||
+mi_gdb_test "nosharedlibrary" ".*\\^done"
|
|
||||||
+
|
|
||||||
mi_create_varobj "array" "array" "create local variable array"
|
|
||||||
|
|
||||||
|
|
@ -1,315 +0,0 @@
|
|||||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
||||||
From: Kevin Buettner <kevinb@redhat.com>
|
|
||||||
Date: Wed, 10 Nov 2021 18:52:22 -0700
|
|
||||||
Subject: gdb-rhbz2022177-dprintf-1.patch
|
|
||||||
|
|
||||||
;; Backport fix for dprintf bug (RH BZ 2022177).
|
|
||||||
|
|
||||||
Fix PR 28308 - dprintf breakpoints not working when run from script
|
|
||||||
|
|
||||||
This commit fixes Bug 28308, titled "Strange interactions with
|
|
||||||
dprintf and break/commands":
|
|
||||||
|
|
||||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28308
|
|
||||||
|
|
||||||
Since creating that bug report, I've found a somewhat simpler way of
|
|
||||||
reproducing the problem. I've encapsulated it into the GDB test case
|
|
||||||
which I've created along with this bug fix. The name of the new test
|
|
||||||
is gdb.base/dprintf-execution-x-script.exp, I'll demonstrate the
|
|
||||||
problem using this test case, though for brevity, I've placed all
|
|
||||||
relevant files in the same directory and have renamed the files to all
|
|
||||||
start with 'dp-bug' instead of 'dprintf-execution-x-script'.
|
|
||||||
|
|
||||||
The script file, named dp-bug.gdb, consists of the following commands:
|
|
||||||
|
|
||||||
dprintf increment, "dprintf in increment(), vi=%d\n", vi
|
|
||||||
break inc_vi
|
|
||||||
commands
|
|
||||||
continue
|
|
||||||
end
|
|
||||||
run
|
|
||||||
|
|
||||||
Note that the final command in this script is 'run'. When 'run' is
|
|
||||||
instead issued interactively, the bug does not occur. So, let's look
|
|
||||||
at the interactive case first in order to see the correct/expected
|
|
||||||
output:
|
|
||||||
|
|
||||||
$ gdb -q -x dp-bug.gdb dp-bug
|
|
||||||
... eliding buggy output which I'll discuss later ...
|
|
||||||
(gdb) run
|
|
||||||
Starting program: /mesquite2/sourceware-git/f34-master/bld/gdb/tmp/dp-bug
|
|
||||||
vi=0
|
|
||||||
dprintf in increment(), vi=0
|
|
||||||
|
|
||||||
Breakpoint 2, inc_vi () at dprintf-execution-x-script.c:26
|
|
||||||
26 in dprintf-execution-x-script.c
|
|
||||||
vi=1
|
|
||||||
dprintf in increment(), vi=1
|
|
||||||
|
|
||||||
Breakpoint 2, inc_vi () at dprintf-execution-x-script.c:26
|
|
||||||
26 in dprintf-execution-x-script.c
|
|
||||||
vi=2
|
|
||||||
dprintf in increment(), vi=2
|
|
||||||
|
|
||||||
Breakpoint 2, inc_vi () at dprintf-execution-x-script.c:26
|
|
||||||
26 in dprintf-execution-x-script.c
|
|
||||||
vi=3
|
|
||||||
[Inferior 1 (process 1539210) exited normally]
|
|
||||||
|
|
||||||
In this run, in which 'run' was issued from the gdb prompt (instead
|
|
||||||
of at the end of the script), there are three dprintf messages along
|
|
||||||
with three 'Breakpoint 2' messages. This is the correct output.
|
|
||||||
|
|
||||||
Now let's look at the output that I snipped above; this is the output
|
|
||||||
when 'run' is issued from the script loaded via GDB's -x switch:
|
|
||||||
|
|
||||||
$ gdb -q -x dp-bug.gdb dp-bug
|
|
||||||
Reading symbols from dp-bug...
|
|
||||||
Dprintf 1 at 0x40116e: file dprintf-execution-x-script.c, line 38.
|
|
||||||
Breakpoint 2 at 0x40113a: file dprintf-execution-x-script.c, line 26.
|
|
||||||
vi=0
|
|
||||||
dprintf in increment(), vi=0
|
|
||||||
|
|
||||||
Breakpoint 2, inc_vi () at dprintf-execution-x-script.c:26
|
|
||||||
26 dprintf-execution-x-script.c: No such file or directory.
|
|
||||||
vi=1
|
|
||||||
|
|
||||||
Breakpoint 2, inc_vi () at dprintf-execution-x-script.c:26
|
|
||||||
26 in dprintf-execution-x-script.c
|
|
||||||
vi=2
|
|
||||||
|
|
||||||
Breakpoint 2, inc_vi () at dprintf-execution-x-script.c:26
|
|
||||||
26 in dprintf-execution-x-script.c
|
|
||||||
vi=3
|
|
||||||
[Inferior 1 (process 1539175) exited normally]
|
|
||||||
|
|
||||||
In the output shown above, only the first dprintf message is printed.
|
|
||||||
The 2nd and 3rd dprintf messages are missing! However, all three
|
|
||||||
'Breakpoint 2...' messages are still printed.
|
|
||||||
|
|
||||||
Why does this happen?
|
|
||||||
|
|
||||||
bpstat_do_actions_1() in gdb/breakpoint.c contains the following
|
|
||||||
comment and code near the start of the function:
|
|
||||||
|
|
||||||
/* Avoid endless recursion if a `source' command is contained
|
|
||||||
in bs->commands. */
|
|
||||||
if (executing_breakpoint_commands)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
scoped_restore save_executing
|
|
||||||
= make_scoped_restore (&executing_breakpoint_commands, 1);
|
|
||||||
|
|
||||||
Also, as described by this comment prior to the 'async' field
|
|
||||||
in 'struct ui' in top.h, the main UI starts off in sync mode
|
|
||||||
when processing command line arguments:
|
|
||||||
|
|
||||||
/* True if the UI is in async mode, false if in sync mode. If in
|
|
||||||
sync mode, a synchronous execution command (e.g, "next") does not
|
|
||||||
return until the command is finished. If in async mode, then
|
|
||||||
running a synchronous command returns right after resuming the
|
|
||||||
target. Waiting for the command's completion is later done on
|
|
||||||
the top event loop. For the main UI, this starts out disabled,
|
|
||||||
until all the explicit command line arguments (e.g., `gdb -ex
|
|
||||||
"start" -ex "next"') are processed. */
|
|
||||||
|
|
||||||
This combination of things, the state of the static global
|
|
||||||
'executing_breakpoint_commands' plus the state of the async
|
|
||||||
field in the main UI causes this behavior.
|
|
||||||
|
|
||||||
This is a backtrace after hitting the dprintf breakpoint for
|
|
||||||
the second time when doing 'run' from the script file, i.e.
|
|
||||||
non-interactively:
|
|
||||||
|
|
||||||
Thread 1 "gdb" hit Breakpoint 3, bpstat_do_actions_1 (bsp=0x7fffffffc2b8)
|
|
||||||
at /ironwood1/sourceware-git/f34-master/bld/../../worktree-master/gdb/breakpoint.c:4431
|
|
||||||
4431 if (executing_breakpoint_commands)
|
|
||||||
|
|
||||||
#0 bpstat_do_actions_1 (bsp=0x7fffffffc2b8)
|
|
||||||
at gdb/breakpoint.c:4431
|
|
||||||
#1 0x00000000004d8bc6 in dprintf_after_condition_true (bs=0x1538090)
|
|
||||||
at gdb/breakpoint.c:13048
|
|
||||||
#2 0x00000000004c5caa in bpstat_stop_status (aspace=0x116dbc0, bp_addr=0x40116e, thread=0x137f450, ws=0x7fffffffc718,
|
|
||||||
stop_chain=0x1538090) at gdb/breakpoint.c:5498
|
|
||||||
#3 0x0000000000768d98 in handle_signal_stop (ecs=0x7fffffffc6f0)
|
|
||||||
at gdb/infrun.c:6172
|
|
||||||
#4 0x00000000007678d3 in handle_inferior_event (ecs=0x7fffffffc6f0)
|
|
||||||
at gdb/infrun.c:5662
|
|
||||||
#5 0x0000000000763cd5 in fetch_inferior_event ()
|
|
||||||
at gdb/infrun.c:4060
|
|
||||||
#6 0x0000000000746d7d in inferior_event_handler (event_type=INF_REG_EVENT)
|
|
||||||
at gdb/inf-loop.c:41
|
|
||||||
#7 0x00000000007a702f in handle_target_event (error=0, client_data=0x0)
|
|
||||||
at gdb/linux-nat.c:4207
|
|
||||||
#8 0x0000000000b8cd6e in gdb_wait_for_event (block=block@entry=0)
|
|
||||||
at gdbsupport/event-loop.cc:701
|
|
||||||
#9 0x0000000000b8d032 in gdb_wait_for_event (block=0)
|
|
||||||
at gdbsupport/event-loop.cc:597
|
|
||||||
#10 gdb_do_one_event () at gdbsupport/event-loop.cc:212
|
|
||||||
#11 0x00000000009d19b6 in wait_sync_command_done ()
|
|
||||||
at gdb/top.c:528
|
|
||||||
#12 0x00000000009d1a3f in maybe_wait_sync_command_done (was_sync=0)
|
|
||||||
at gdb/top.c:545
|
|
||||||
#13 0x00000000009d2033 in execute_command (p=0x7fffffffcb18 "", from_tty=0)
|
|
||||||
at gdb/top.c:676
|
|
||||||
#14 0x0000000000560d5b in execute_control_command_1 (cmd=0x13b9bb0, from_tty=0)
|
|
||||||
at gdb/cli/cli-script.c:547
|
|
||||||
#15 0x000000000056134a in execute_control_command (cmd=0x13b9bb0, from_tty=0)
|
|
||||||
at gdb/cli/cli-script.c:717
|
|
||||||
#16 0x00000000004c3bbe in bpstat_do_actions_1 (bsp=0x137f530)
|
|
||||||
at gdb/breakpoint.c:4469
|
|
||||||
#17 0x00000000004c3d40 in bpstat_do_actions ()
|
|
||||||
at gdb/breakpoint.c:4533
|
|
||||||
#18 0x00000000006a473a in command_handler (command=0x1399ad0 "run")
|
|
||||||
at gdb/event-top.c:624
|
|
||||||
#19 0x00000000009d182e in read_command_file (stream=0x113e540)
|
|
||||||
at gdb/top.c:443
|
|
||||||
#20 0x0000000000563697 in script_from_file (stream=0x113e540, file=0x13bb0b0 "dp-bug.gdb")
|
|
||||||
at gdb/cli/cli-script.c:1642
|
|
||||||
#21 0x00000000006abd63 in source_gdb_script (extlang=0xc44e80 <extension_language_gdb>, stream=0x113e540,
|
|
||||||
file=0x13bb0b0 "dp-bug.gdb") at gdb/extension.c:188
|
|
||||||
#22 0x0000000000544400 in source_script_from_stream (stream=0x113e540, file=0x7fffffffd91a "dp-bug.gdb",
|
|
||||||
file_to_open=0x13bb0b0 "dp-bug.gdb")
|
|
||||||
at gdb/cli/cli-cmds.c:692
|
|
||||||
#23 0x0000000000544557 in source_script_with_search (file=0x7fffffffd91a "dp-bug.gdb", from_tty=1, search_path=0)
|
|
||||||
at gdb/cli/cli-cmds.c:750
|
|
||||||
#24 0x00000000005445cf in source_script (file=0x7fffffffd91a "dp-bug.gdb", from_tty=1)
|
|
||||||
at gdb/cli/cli-cmds.c:759
|
|
||||||
#25 0x00000000007cf6d9 in catch_command_errors (command=0x5445aa <source_script(char const*, int)>,
|
|
||||||
arg=0x7fffffffd91a "dp-bug.gdb", from_tty=1, do_bp_actions=false)
|
|
||||||
at gdb/main.c:523
|
|
||||||
#26 0x00000000007cf85d in execute_cmdargs (cmdarg_vec=0x7fffffffd1b0, file_type=CMDARG_FILE, cmd_type=CMDARG_COMMAND,
|
|
||||||
ret=0x7fffffffd18c) at gdb/main.c:615
|
|
||||||
#27 0x00000000007d0c8e in captured_main_1 (context=0x7fffffffd3f0)
|
|
||||||
at gdb/main.c:1322
|
|
||||||
#28 0x00000000007d0eba in captured_main (data=0x7fffffffd3f0)
|
|
||||||
at gdb/main.c:1343
|
|
||||||
#29 0x00000000007d0f25 in gdb_main (args=0x7fffffffd3f0)
|
|
||||||
at gdb/main.c:1368
|
|
||||||
#30 0x00000000004186dd in main (argc=5, argv=0x7fffffffd508)
|
|
||||||
at gdb/gdb.c:32
|
|
||||||
|
|
||||||
There are two frames for bpstat_do_actions_1(), one at frame #16 and
|
|
||||||
the other at frame #0. The one at frame #16 is processing the actions
|
|
||||||
for Breakpoint 2, which is a 'continue'. The one at frame #0 is attempting
|
|
||||||
to process the dprintf breakpoint action. However, at this point,
|
|
||||||
the value of 'executing_breakpoint_commands' is 1, forcing an early
|
|
||||||
return, i.e. prior to executing the command(s) associated with the dprintf
|
|
||||||
breakpoint.
|
|
||||||
|
|
||||||
For the sake of comparison, this is what the stack looks like when hitting
|
|
||||||
the dprintf breakpoint for the second time when issuing the 'run'
|
|
||||||
command from the GDB prompt.
|
|
||||||
|
|
||||||
Thread 1 "gdb" hit Breakpoint 3, bpstat_do_actions_1 (bsp=0x7fffffffccd8)
|
|
||||||
at /ironwood1/sourceware-git/f34-master/bld/../../worktree-master/gdb/breakpoint.c:4431
|
|
||||||
4431 if (executing_breakpoint_commands)
|
|
||||||
|
|
||||||
#0 bpstat_do_actions_1 (bsp=0x7fffffffccd8)
|
|
||||||
at gdb/breakpoint.c:4431
|
|
||||||
#1 0x00000000004d8bc6 in dprintf_after_condition_true (bs=0x16b0290)
|
|
||||||
at gdb/breakpoint.c:13048
|
|
||||||
#2 0x00000000004c5caa in bpstat_stop_status (aspace=0x116dbc0, bp_addr=0x40116e, thread=0x13f0e60, ws=0x7fffffffd138,
|
|
||||||
stop_chain=0x16b0290) at gdb/breakpoint.c:5498
|
|
||||||
#3 0x0000000000768d98 in handle_signal_stop (ecs=0x7fffffffd110)
|
|
||||||
at gdb/infrun.c:6172
|
|
||||||
#4 0x00000000007678d3 in handle_inferior_event (ecs=0x7fffffffd110)
|
|
||||||
at gdb/infrun.c:5662
|
|
||||||
#5 0x0000000000763cd5 in fetch_inferior_event ()
|
|
||||||
at gdb/infrun.c:4060
|
|
||||||
#6 0x0000000000746d7d in inferior_event_handler (event_type=INF_REG_EVENT)
|
|
||||||
at gdb/inf-loop.c:41
|
|
||||||
#7 0x00000000007a702f in handle_target_event (error=0, client_data=0x0)
|
|
||||||
at gdb/linux-nat.c:4207
|
|
||||||
#8 0x0000000000b8cd6e in gdb_wait_for_event (block=block@entry=0)
|
|
||||||
at gdbsupport/event-loop.cc:701
|
|
||||||
#9 0x0000000000b8d032 in gdb_wait_for_event (block=0)
|
|
||||||
at gdbsupport/event-loop.cc:597
|
|
||||||
#10 gdb_do_one_event () at gdbsupport/event-loop.cc:212
|
|
||||||
#11 0x00000000007cf512 in start_event_loop ()
|
|
||||||
at gdb/main.c:421
|
|
||||||
#12 0x00000000007cf631 in captured_command_loop ()
|
|
||||||
at gdb/main.c:481
|
|
||||||
#13 0x00000000007d0ebf in captured_main (data=0x7fffffffd3f0)
|
|
||||||
at gdb/main.c:1353
|
|
||||||
#14 0x00000000007d0f25 in gdb_main (args=0x7fffffffd3f0)
|
|
||||||
at gdb/main.c:1368
|
|
||||||
#15 0x00000000004186dd in main (argc=5, argv=0x7fffffffd508)
|
|
||||||
at gdb/gdb.c:32
|
|
||||||
|
|
||||||
This relatively short backtrace is due to the current UI's async field
|
|
||||||
being set to 1.
|
|
||||||
|
|
||||||
Yet another thing to be aware of regarding this problem is the
|
|
||||||
difference in the way that commands associated to dprintf breakpoints
|
|
||||||
versus regular breakpoints are handled. While they both use a command
|
|
||||||
list associated with the breakpoint, regular breakpoints will place
|
|
||||||
the commands to be run on the bpstat chain constructed in
|
|
||||||
bp_stop_status(). These commands are run later on. For dprintf
|
|
||||||
breakpoints, commands are run via the 'after_condition_true' function
|
|
||||||
pointer directly from bpstat_stop_status(). (The 'commands' field in
|
|
||||||
the bpstat is cleared in dprintf_after_condition_true(). This
|
|
||||||
prevents the dprintf commands from being run again later on when other
|
|
||||||
commands on the bpstat chain are processed.)
|
|
||||||
|
|
||||||
Another thing that I noticed is that dprintf breakpoints are the only
|
|
||||||
type of breakpoint which use 'after_condition_true'. This suggests
|
|
||||||
that one possible way of fixing this problem, that of making dprintf
|
|
||||||
breakpoints work more like regular breakpoints, probably won't work.
|
|
||||||
(I must admit, however, that my understanding of this code isn't
|
|
||||||
complete enough to say why. I'll trust that whoever implemented it
|
|
||||||
had a good reason for doing it this way.)
|
|
||||||
|
|
||||||
The comment referenced earlier regarding 'executing_breakpoint_commands'
|
|
||||||
states that the reason for checking this variable is to avoid
|
|
||||||
potential endless recursion when a 'source' command appears in
|
|
||||||
bs->commands. We know that a dprintf command is constrained to either
|
|
||||||
1) execution of a GDB printf command, 2) an inferior function call of
|
|
||||||
a printf-like function, or 3) execution of an agent-printf command.
|
|
||||||
Therefore, infinite recursion due to a 'source' command cannot happen
|
|
||||||
when executing commands upon hitting a dprintf breakpoint.
|
|
||||||
|
|
||||||
I chose to fix this problem by having dprintf_after_condition_true()
|
|
||||||
directly call execute_control_commands(). This means that it no
|
|
||||||
longer attempts to go through bpstat_do_actions_1() avoiding the
|
|
||||||
infinite recursion check for potential 'source' commands on the
|
|
||||||
command chain. I think it simplifies this code a little bit too, a
|
|
||||||
definite bonus.
|
|
||||||
|
|
||||||
Summary:
|
|
||||||
|
|
||||||
* breakpoint.c (dprintf_after_condition_true): Don't call
|
|
||||||
bpstat_do_actions_1(). Call execute_control_commands()
|
|
||||||
instead.
|
|
||||||
|
|
||||||
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
|
||||||
--- a/gdb/breakpoint.c
|
|
||||||
+++ b/gdb/breakpoint.c
|
|
||||||
@@ -13043,9 +13043,6 @@ dprintf_print_recreate (struct breakpoint *tp, struct ui_file *fp)
|
|
||||||
static void
|
|
||||||
dprintf_after_condition_true (struct bpstats *bs)
|
|
||||||
{
|
|
||||||
- struct bpstats tmp_bs;
|
|
||||||
- struct bpstats *tmp_bs_p = &tmp_bs;
|
|
||||||
-
|
|
||||||
/* dprintf's never cause a stop. This wasn't set in the
|
|
||||||
check_status hook instead because that would make the dprintf's
|
|
||||||
condition not be evaluated. */
|
|
||||||
@@ -13056,14 +13053,9 @@ dprintf_after_condition_true (struct bpstats *bs)
|
|
||||||
bpstat_do_actions, if a breakpoint that causes a stop happens to
|
|
||||||
be set at same address as this dprintf, or even if running the
|
|
||||||
commands here throws. */
|
|
||||||
- tmp_bs.commands = bs->commands;
|
|
||||||
- bs->commands = NULL;
|
|
||||||
-
|
|
||||||
- bpstat_do_actions_1 (&tmp_bs_p);
|
|
||||||
-
|
|
||||||
- /* 'tmp_bs.commands' will usually be NULL by now, but
|
|
||||||
- bpstat_do_actions_1 may return early without processing the whole
|
|
||||||
- list. */
|
|
||||||
+ counted_command_line cmds = std::move (bs->commands);
|
|
||||||
+ gdb_assert (cmds != nullptr);
|
|
||||||
+ execute_control_commands (cmds.get (), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The breakpoint_ops structure to be used on static tracepoints with
|
|
@ -1,194 +0,0 @@
|
|||||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
||||||
From: Kevin Buettner <kevinb@redhat.com>
|
|
||||||
Date: Wed, 10 Nov 2021 18:55:43 -0700
|
|
||||||
Subject: gdb-rhbz2022177-dprintf-2.patch
|
|
||||||
|
|
||||||
;; Backport test case for dprintf bug (RH BZ 2022177).
|
|
||||||
|
|
||||||
Test case for Bug 28308
|
|
||||||
|
|
||||||
The purpose of this test is described in the comments in
|
|
||||||
dprintf-execution-x-script.exp.
|
|
||||||
|
|
||||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28308
|
|
||||||
|
|
||||||
The name of this new test was based on that of an existing test,
|
|
||||||
bp-cmds-execution-x-script.exp. I started off by copying that test,
|
|
||||||
adding to it, and then rewriting almost all of it. It's different
|
|
||||||
enough that I decided that listing the copyright year as 2021
|
|
||||||
was sufficient.
|
|
||||||
|
|
||||||
diff --git a/gdb/testsuite/gdb.base/dprintf-execution-x-script.c b/gdb/testsuite/gdb.base/dprintf-execution-x-script.c
|
|
||||||
new file mode 100644
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/gdb/testsuite/gdb.base/dprintf-execution-x-script.c
|
|
||||||
@@ -0,0 +1,53 @@
|
|
||||||
+/* This testcase is part of GDB, the GNU debugger.
|
|
||||||
+
|
|
||||||
+ Copyright 2021 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/>. */
|
|
||||||
+
|
|
||||||
+#include <stdlib.h>
|
|
||||||
+#include <stdio.h>
|
|
||||||
+
|
|
||||||
+volatile int vi = 0;
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+inc_vi ()
|
|
||||||
+{
|
|
||||||
+ vi++;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+print_vi ()
|
|
||||||
+{
|
|
||||||
+ printf ("vi=%d\n", vi);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+increment ()
|
|
||||||
+{
|
|
||||||
+ inc_vi ();
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int
|
|
||||||
+main (int argc, char **argv)
|
|
||||||
+{
|
|
||||||
+ print_vi ();
|
|
||||||
+ increment ();
|
|
||||||
+ print_vi ();
|
|
||||||
+ increment ();
|
|
||||||
+ print_vi ();
|
|
||||||
+ increment ();
|
|
||||||
+ print_vi ();
|
|
||||||
+
|
|
||||||
+ exit (0);
|
|
||||||
+}
|
|
||||||
diff --git a/gdb/testsuite/gdb.base/dprintf-execution-x-script.exp b/gdb/testsuite/gdb.base/dprintf-execution-x-script.exp
|
|
||||||
new file mode 100644
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/gdb/testsuite/gdb.base/dprintf-execution-x-script.exp
|
|
||||||
@@ -0,0 +1,85 @@
|
|
||||||
+# Copyright 2021 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/>. */
|
|
||||||
+
|
|
||||||
+# Test that commands in a GDB script file run via GDB's -x flag work
|
|
||||||
+# as expected. Specifically, the script creates a dprintf breakpoint
|
|
||||||
+# as well as a normal breakpoint that has "continue" in its command
|
|
||||||
+# list, and then does "run". Correct output from GDB is checked as
|
|
||||||
+# part of this test.
|
|
||||||
+
|
|
||||||
+# Bail out if the target can't use the 'run' command.
|
|
||||||
+if ![target_can_use_run_cmd] {
|
|
||||||
+ return 0
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+standard_testfile
|
|
||||||
+
|
|
||||||
+if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
|
|
||||||
+ return -1
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# This is the name of the GDB script to load.
|
|
||||||
+set x_file ${srcdir}/${subdir}/$testfile.gdb
|
|
||||||
+
|
|
||||||
+# Create context in which the global, GDBFLAGS, will be restored at
|
|
||||||
+# the end of the block. All commands run within the block are
|
|
||||||
+# actually run in the outer context. (This is why 'res' is available
|
|
||||||
+# outside of the save_vars block.)
|
|
||||||
+save_vars { GDBFLAGS } {
|
|
||||||
+ # Set flags with which to start GDB.
|
|
||||||
+ append GDBFLAGS " -ex \"set height unlimited\""
|
|
||||||
+ append GDBFLAGS " -x \"$x_file\""
|
|
||||||
+ append GDBFLAGS " --args \"$binfile\""
|
|
||||||
+
|
|
||||||
+ # Start GDB with above flags.
|
|
||||||
+ set res [gdb_spawn]
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+set test "load and run script with -x"
|
|
||||||
+if { $res != 0} {
|
|
||||||
+ fail $test
|
|
||||||
+ return -1
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# The script loaded via -x contains a run command; while running, GDB
|
|
||||||
+# is expected to print three messages from dprintf breakpoints along
|
|
||||||
+# with three interspersed messages from an ordinary breakpoint (which
|
|
||||||
+# was set up with a continue command). Set up pattern D to match
|
|
||||||
+# output from hitting the dprintf breakpoint and B for the ordinary
|
|
||||||
+# breakpoint. Then set PAT to contain the entire pattern of expected
|
|
||||||
+# output from the interspersed dprintf and ordinary breakpoints along
|
|
||||||
+# with some (additional) expected output from the dprintf breakpoints,
|
|
||||||
+# i.e. 0, 1, and 2.
|
|
||||||
+set d "dprintf in increment.., vi="
|
|
||||||
+set b "Breakpoint ., inc_vi"
|
|
||||||
+set pat "${d}0.*?$b.*?${d}1.*?$b.*?${d}2.*?$b.*?"
|
|
||||||
+
|
|
||||||
+proc do_test {cmd test} {
|
|
||||||
+ gdb_test $cmd "$::pat$::inferior_exited_re normally.*" $test
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# Check output from running script with -x
|
|
||||||
+do_test "" $test
|
|
||||||
+
|
|
||||||
+# Restart GDB and 'source' the script; this will (still) run the program
|
|
||||||
+# due to the 'run' command in the script.
|
|
||||||
+clean_restart $binfile
|
|
||||||
+do_test "source $x_file" "load and run script using source command"
|
|
||||||
+
|
|
||||||
+# This should leave us at the gdb prompt; Run program again using
|
|
||||||
+# already established breakpoints, i.e. those loaded from the
|
|
||||||
+# script. Prior to fixing PR 28308, this was the only test that
|
|
||||||
+# would pass.
|
|
||||||
+do_test "run" "run again"
|
|
||||||
diff --git a/gdb/testsuite/gdb.base/dprintf-execution-x-script.gdb b/gdb/testsuite/gdb.base/dprintf-execution-x-script.gdb
|
|
||||||
new file mode 100644
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/gdb/testsuite/gdb.base/dprintf-execution-x-script.gdb
|
|
||||||
@@ -0,0 +1,21 @@
|
|
||||||
+# Copyright 2021 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/>. */
|
|
||||||
+
|
|
||||||
+dprintf increment, "dprintf in increment(), vi=%d\n", vi
|
|
||||||
+break inc_vi
|
|
||||||
+commands
|
|
||||||
+ continue
|
|
||||||
+end
|
|
||||||
+run
|
|
@ -1,476 +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: Tue, 11 Jan 2022 12:46:05 +0100
|
|
||||||
Subject: gdb-rhbz202487-rework-set-debuginfod.patch
|
|
||||||
|
|
||||||
;;Backport upstream commit from Simon Marchi
|
|
||||||
;;333f35b6315 gdb: pass/return setting setter/getter
|
|
||||||
;;scalar values by value
|
|
||||||
|
|
||||||
gdb: rework "set debuginfod" commands
|
|
||||||
|
|
||||||
As discussed here [1], do some re-work in the "set debuginfod commands".
|
|
||||||
|
|
||||||
First, use "set debuginfod enabled on/off/ask" instead of "set
|
|
||||||
debuginfod on/off/ask". This is more MI-friendly, and it gives an
|
|
||||||
output that makes more sense in "info set", for example.
|
|
||||||
|
|
||||||
Then, make the show commands not call "error" when debuginfod support is
|
|
||||||
not compiled in. This makes the commands "show" and "show debuginfod"
|
|
||||||
stop early, breaking gdb.base/default.exp:
|
|
||||||
|
|
||||||
Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/default.exp ...
|
|
||||||
FAIL: gdb.base/default.exp: info set
|
|
||||||
FAIL: gdb.base/default.exp: show
|
|
||||||
|
|
||||||
- Make the "debuginfod enabled" setting default to "off" when debuginfod
|
|
||||||
support is not compiled in, and "ask" otherwise.
|
|
||||||
- Make the setter of "debuginfod enabled" error out when debuginfod
|
|
||||||
support is not compiled in, so that "debuginfod enabled" will always
|
|
||||||
remain "off" in that case.
|
|
||||||
- Make the setter of "debuginfod verbose" work in any case. I don't
|
|
||||||
see the harm in letting the user change that setting, since the user will
|
|
||||||
hit an error if they try to enable the use of debuginfod.
|
|
||||||
- I would do the same for the "debuginfod urls" setter, but because
|
|
||||||
this one needs to see the DEBUGINFOD_URLS_ENV_VAR macro, provided by
|
|
||||||
libdebuginfod, I made that one error out as well if debuginfod
|
|
||||||
support is not compiled it (otherwise, I would have left it like
|
|
||||||
"debuginfod verbose". Alternatively, we could hard-code
|
|
||||||
"DEBUGINFOD_URLS" in the code (in fact, it was prior to this patch,
|
|
||||||
but I think it was an oversight, as other spots use
|
|
||||||
DEBUGINFOD_URLS_ENV_VAR), or use a dummy string to store the setting,
|
|
||||||
but I don't really see the value in that.
|
|
||||||
|
|
||||||
Rename debuginfod_enable to debuginfod_enabled, just so it matches the
|
|
||||||
setting name.
|
|
||||||
|
|
||||||
[1] https://sourceware.org/pipermail/gdb-patches/2021-October/182937.html
|
|
||||||
|
|
||||||
Change-Id: I45fdb2993f668226a5639228951362b7800f09d5
|
|
||||||
Co-Authored-By: Aaron Merey <amerey@redhat.com>
|
|
||||||
|
|
||||||
diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
|
|
||||||
--- a/gdb/debuginfod-support.c
|
|
||||||
+++ b/gdb/debuginfod-support.c
|
|
||||||
@@ -32,8 +32,22 @@ static const char debuginfod_on[] = "on";
|
|
||||||
static const char debuginfod_off[] = "off";
|
|
||||||
static const char debuginfod_ask[] = "ask";
|
|
||||||
|
|
||||||
-static const char *debuginfod_enable = debuginfod_ask;
|
|
||||||
-static unsigned debuginfod_verbose = 1;
|
|
||||||
+static const char *debuginfod_enabled_enum[] =
|
|
||||||
+{
|
|
||||||
+ debuginfod_on,
|
|
||||||
+ debuginfod_off,
|
|
||||||
+ debuginfod_ask,
|
|
||||||
+ nullptr
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static const char *debuginfod_enabled =
|
|
||||||
+#if defined(HAVE_LIBDEBUGINFOD)
|
|
||||||
+ debuginfod_ask;
|
|
||||||
+#else
|
|
||||||
+ debuginfod_off;
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+static unsigned int debuginfod_verbose = 1;
|
|
||||||
|
|
||||||
/* This is never actually used. URLs are always pulled from the
|
|
||||||
environment. */
|
|
||||||
@@ -60,64 +74,6 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
|
|
||||||
|
|
||||||
#define NO_IMPL _("Support for debuginfod is not compiled into GDB.")
|
|
||||||
|
|
||||||
-/* Stub set/show commands that indicate debuginfod is not supported. */
|
|
||||||
-
|
|
||||||
-static void
|
|
||||||
-set_debuginfod_on_command (const char *args, int from_tty)
|
|
||||||
-{
|
|
||||||
- error (NO_IMPL);
|
|
||||||
- debuginfod_enable = debuginfod_off;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-static void
|
|
||||||
-set_debuginfod_off_command (const char *args, int from_tty)
|
|
||||||
-{
|
|
||||||
- error (NO_IMPL);
|
|
||||||
- debuginfod_enable = debuginfod_off;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-static void
|
|
||||||
-set_debuginfod_ask_command (const char *args, int from_tty)
|
|
||||||
-{
|
|
||||||
- error (NO_IMPL);
|
|
||||||
- debuginfod_enable = debuginfod_off;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-static void
|
|
||||||
-show_debuginfod_status_command (const char *args, int from_tty)
|
|
||||||
-{
|
|
||||||
- error (NO_IMPL);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-static void
|
|
||||||
-set_debuginfod_urls_command (const char *ignore, int from_tty,
|
|
||||||
- struct cmd_list_element *c)
|
|
||||||
-{
|
|
||||||
- error (NO_IMPL);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-static void
|
|
||||||
-show_debuginfod_urls_command (struct ui_file *file, int from_tty,
|
|
||||||
- struct cmd_list_element *cmd, const char *value)
|
|
||||||
-{
|
|
||||||
- error (NO_IMPL);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-static void
|
|
||||||
-set_debuginfod_verbose_command (const char *args, int from_tty,
|
|
||||||
- struct cmd_list_element *c)
|
|
||||||
-{
|
|
||||||
- error (NO_IMPL);
|
|
||||||
- debuginfod_verbose = 0;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-static void
|
|
||||||
-show_debuginfod_verbose_command (struct ui_file *file, int from_tty,
|
|
||||||
- struct cmd_list_element *cmd,
|
|
||||||
- const char *value)
|
|
||||||
-{
|
|
||||||
- error (NO_IMPL);
|
|
||||||
-}
|
|
||||||
#else
|
|
||||||
#include <elfutils/debuginfod.h>
|
|
||||||
|
|
||||||
@@ -145,82 +101,6 @@ struct debuginfod_client_deleter
|
|
||||||
using debuginfod_client_up
|
|
||||||
= std::unique_ptr<debuginfod_client, debuginfod_client_deleter>;
|
|
||||||
|
|
||||||
-/* Enable debuginfod. */
|
|
||||||
-
|
|
||||||
-static void
|
|
||||||
-set_debuginfod_on_command (const char *args, int from_tty)
|
|
||||||
-{
|
|
||||||
- debuginfod_enable = debuginfod_on;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-/* Disable debuginfod. */
|
|
||||||
-
|
|
||||||
-static void
|
|
||||||
-set_debuginfod_off_command (const char *args, int from_tty)
|
|
||||||
-{
|
|
||||||
- debuginfod_enable = debuginfod_off;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-/* Before next query, ask user whether to enable debuginfod. */
|
|
||||||
-
|
|
||||||
-static void
|
|
||||||
-set_debuginfod_ask_command (const char *args, int from_tty)
|
|
||||||
-{
|
|
||||||
- debuginfod_enable = debuginfod_ask;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-/* Show whether debuginfod is enabled. */
|
|
||||||
-
|
|
||||||
-static void
|
|
||||||
-show_debuginfod_status_command (const char *args, int from_tty)
|
|
||||||
-{
|
|
||||||
- printf_unfiltered (_("Debuginfod functionality is currently set to " \
|
|
||||||
- "\"%s\".\n"), debuginfod_enable);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-/* Set the URLs that debuginfod will query. */
|
|
||||||
-
|
|
||||||
-static void
|
|
||||||
-set_debuginfod_urls_command (const char *ignore, int from_tty,
|
|
||||||
- struct cmd_list_element *c)
|
|
||||||
-{
|
|
||||||
- gdb_assert (debuginfod_urls != nullptr);
|
|
||||||
- if (setenv ("DEBUGINFOD_URLS", debuginfod_urls, 1) != 0)
|
|
||||||
- warning (_("Unable to set debuginfod URLs: %s"), safe_strerror (errno));
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-/* Show the URLs that debuginfod will query. */
|
|
||||||
-
|
|
||||||
-static void
|
|
||||||
-show_debuginfod_urls_command (struct ui_file *file, int from_tty,
|
|
||||||
- struct cmd_list_element *cmd, const char *value)
|
|
||||||
-{
|
|
||||||
- if (value == nullptr || value[0] == '\0')
|
|
||||||
- fprintf_unfiltered (file, _("Debuginfod URLs have not been set.\n"));
|
|
||||||
- else
|
|
||||||
- fprintf_filtered (file, _("Debuginfod URLs are currently set to:\n%s\n"),
|
|
||||||
- value);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-/* No-op setter used for compatibility when gdb is built without debuginfod. */
|
|
||||||
-
|
|
||||||
-static void
|
|
||||||
-set_debuginfod_verbose_command (const char *args, int from_tty,
|
|
||||||
- struct cmd_list_element *c)
|
|
||||||
-{
|
|
||||||
- return;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-/* Show verbosity. */
|
|
||||||
-
|
|
||||||
-static void
|
|
||||||
-show_debuginfod_verbose_command (struct ui_file *file, int from_tty,
|
|
||||||
- struct cmd_list_element *cmd, const char *value)
|
|
||||||
-{
|
|
||||||
- fprintf_filtered (file, _("Debuginfod verbose output is set to %s.\n"),
|
|
||||||
- value);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
static int
|
|
||||||
progressfn (debuginfod_client *c, long cur, long total)
|
|
||||||
{
|
|
||||||
@@ -277,15 +157,15 @@ get_debuginfod_client ()
|
|
||||||
whether to enable debuginfod. */
|
|
||||||
|
|
||||||
static bool
|
|
||||||
-debuginfod_enabled ()
|
|
||||||
+debuginfod_is_enabled ()
|
|
||||||
{
|
|
||||||
const char *urls = getenv (DEBUGINFOD_URLS_ENV_VAR);
|
|
||||||
|
|
||||||
if (urls == nullptr || urls[0] == '\0'
|
|
||||||
- || debuginfod_enable == debuginfod_off)
|
|
||||||
+ || debuginfod_enabled == debuginfod_off)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
- if (debuginfod_enable == debuginfod_ask)
|
|
||||||
+ if (debuginfod_enabled == debuginfod_ask)
|
|
||||||
{
|
|
||||||
int resp = nquery (_("\nThis GDB supports auto-downloading debuginfo " \
|
|
||||||
"from the following URLs:\n%s\nEnable debuginfod " \
|
|
||||||
@@ -294,16 +174,16 @@ debuginfod_enabled ()
|
|
||||||
if (!resp)
|
|
||||||
{
|
|
||||||
printf_filtered (_("Debuginfod has been disabled.\nTo make this " \
|
|
||||||
- "setting permanent, add \'set debuginfod off\' " \
|
|
||||||
- "to .gdbinit.\n"));
|
|
||||||
- debuginfod_enable = debuginfod_off;
|
|
||||||
+ "setting permanent, add \'set debuginfod " \
|
|
||||||
+ "enabled off\' to .gdbinit.\n"));
|
|
||||||
+ debuginfod_enabled = debuginfod_off;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf_filtered (_("Debuginfod has been enabled.\nTo make this " \
|
|
||||||
- "setting permanent, add \'set debuginfod on\' " \
|
|
||||||
- "to .gdbinit.\n"));
|
|
||||||
- debuginfod_enable = debuginfod_on;
|
|
||||||
+ "setting permanent, add \'set debuginfod enabled " \
|
|
||||||
+ "on\' to .gdbinit.\n"));
|
|
||||||
+ debuginfod_enabled = debuginfod_on;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
@@ -317,7 +197,7 @@ debuginfod_source_query (const unsigned char *build_id,
|
|
||||||
const char *srcpath,
|
|
||||||
gdb::unique_xmalloc_ptr<char> *destname)
|
|
||||||
{
|
|
||||||
- if (!debuginfod_enabled ())
|
|
||||||
+ if (!debuginfod_is_enabled ())
|
|
||||||
return scoped_fd (-ENOSYS);
|
|
||||||
|
|
||||||
debuginfod_client *c = get_debuginfod_client ();
|
|
||||||
@@ -354,7 +234,7 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
|
|
||||||
const char *filename,
|
|
||||||
gdb::unique_xmalloc_ptr<char> *destname)
|
|
||||||
{
|
|
||||||
- if (!debuginfod_enabled ())
|
|
||||||
+ if (!debuginfod_is_enabled ())
|
|
||||||
return scoped_fd (-ENOSYS);
|
|
||||||
|
|
||||||
debuginfod_client *c = get_debuginfod_client ();
|
|
||||||
@@ -382,6 +262,67 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+/* Set callback for "set debuginfod enabled". */
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+set_debuginfod_enabled (const char *args, int from_tty,
|
|
||||||
+ struct cmd_list_element *c)
|
|
||||||
+{
|
|
||||||
+#if defined(HAVE_LIBDEBUGINFOD)
|
|
||||||
+ /* Value is already set. */
|
|
||||||
+#else
|
|
||||||
+ error (NO_IMPL);
|
|
||||||
+#endif
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* Show callback for "set debuginfod enabled". */
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+show_debuginfod_enabled (ui_file *file, int from_tty, cmd_list_element *cmd,
|
|
||||||
+ const char *value)
|
|
||||||
+{
|
|
||||||
+ printf_unfiltered (_("Debuginfod functionality is currently set to "
|
|
||||||
+ "\"%s\".\n"), debuginfod_enabled);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* Set callback for "set debuginfod urls". */
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+set_debuginfod_urls (const char *args, int from_tty,
|
|
||||||
+ struct cmd_list_element *c)
|
|
||||||
+{
|
|
||||||
+#if defined(HAVE_LIBDEBUGINFOD)
|
|
||||||
+ gdb_assert (debuginfod_urls != nullptr);
|
|
||||||
+ if (setenv (DEBUGINFOD_URLS_ENV_VAR, debuginfod_urls, 1) != 0)
|
|
||||||
+ warning (_("Unable to set debuginfod URLs: %s"), safe_strerror (errno));
|
|
||||||
+#else
|
|
||||||
+ error (NO_IMPL);
|
|
||||||
+#endif
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* Show callback for "set debuginfod urls". */
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+show_debuginfod_urls (ui_file *file, int from_tty, cmd_list_element *cmd,
|
|
||||||
+ const char *value)
|
|
||||||
+{
|
|
||||||
+ if (value[0] == '\0')
|
|
||||||
+ fprintf_unfiltered (file, _("Debuginfod URLs have not been set.\n"));
|
|
||||||
+ else
|
|
||||||
+ fprintf_filtered (file, _("Debuginfod URLs are currently set to:\n%s\n"),
|
|
||||||
+ value);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* Show callback for "set debuginfod verbose". */
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+show_debuginfod_verbose_command (ui_file *file, int from_tty,
|
|
||||||
+ cmd_list_element *cmd, const char *value)
|
|
||||||
+{
|
|
||||||
+ fprintf_filtered (file, _("Debuginfod verbose output is set to %s.\n"),
|
|
||||||
+ value);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/* Register debuginfod commands. */
|
|
||||||
|
|
||||||
void _initialize_debuginfod ();
|
|
||||||
@@ -397,23 +338,17 @@ _initialize_debuginfod ()
|
|
||||||
_("Show debuginfod option."),
|
|
||||||
&show_debuginfod_prefix_list, 0, &showlist);
|
|
||||||
|
|
||||||
- /* set debuginfod on */
|
|
||||||
- add_cmd ("on", class_run, set_debuginfod_on_command,
|
|
||||||
- _("Enable debuginfod."), &set_debuginfod_prefix_list);
|
|
||||||
-
|
|
||||||
- /* set debuginfod off */
|
|
||||||
- add_cmd ("off", class_run, set_debuginfod_off_command,
|
|
||||||
- _("Disable debuginfod."), &set_debuginfod_prefix_list);
|
|
||||||
-
|
|
||||||
- /* set debuginfod ask */
|
|
||||||
- add_cmd ("ask", class_run, set_debuginfod_ask_command, _("\
|
|
||||||
-Ask the user whether to enable debuginfod before performing the next query."),
|
|
||||||
- &set_debuginfod_prefix_list);
|
|
||||||
-
|
|
||||||
- /* show debuginfod status */
|
|
||||||
- add_cmd ("status", class_run, show_debuginfod_status_command,
|
|
||||||
- _("Show whether debuginfod is set to \"on\", \"off\" or \"ask\"."),
|
|
||||||
- &show_debuginfod_prefix_list);
|
|
||||||
+ add_setshow_enum_cmd ("enabled", class_run, debuginfod_enabled_enum,
|
|
||||||
+ &debuginfod_enabled,
|
|
||||||
+ _("Set whether to use debuginfod."),
|
|
||||||
+ _("Show whether to use debuginfod."),
|
|
||||||
+ _("\
|
|
||||||
+When on, enable the use of debuginfod to download missing debug info and\n\
|
|
||||||
+source files."),
|
|
||||||
+ set_debuginfod_enabled,
|
|
||||||
+ show_debuginfod_enabled,
|
|
||||||
+ &set_debuginfod_prefix_list,
|
|
||||||
+ &show_debuginfod_prefix_list);
|
|
||||||
|
|
||||||
/* set/show debuginfod urls */
|
|
||||||
add_setshow_string_noescape_cmd ("urls", class_run, &debuginfod_urls, _("\
|
|
||||||
@@ -422,8 +357,8 @@ Show the list of debuginfod server URLs."), _("\
|
|
||||||
Manage the space-separated list of debuginfod server URLs that GDB will query \
|
|
||||||
when missing debuginfo, executables or source files.\nThe default value is \
|
|
||||||
copied from the DEBUGINFOD_URLS environment variable."),
|
|
||||||
- set_debuginfod_urls_command,
|
|
||||||
- show_debuginfod_urls_command,
|
|
||||||
+ set_debuginfod_urls,
|
|
||||||
+ show_debuginfod_urls,
|
|
||||||
&set_debuginfod_prefix_list,
|
|
||||||
&show_debuginfod_prefix_list);
|
|
||||||
if (getenv ("DEBUGINFOD_URLS") != nullptr)
|
|
||||||
@@ -436,7 +371,7 @@ Set verbosity of debuginfod output."), _("\
|
|
||||||
Show debuginfod debugging."), _("\
|
|
||||||
When set to a non-zero value, display verbose output for each debuginfod \
|
|
||||||
query.\nTo disable, set to zero. Verbose output is displayed by default."),
|
|
||||||
- set_debuginfod_verbose_command,
|
|
||||||
+ nullptr,
|
|
||||||
show_debuginfod_verbose_command,
|
|
||||||
&set_debuginfod_prefix_list,
|
|
||||||
&show_debuginfod_prefix_list);
|
|
||||||
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
|
||||||
--- a/gdb/doc/gdb.texinfo
|
|
||||||
+++ b/gdb/doc/gdb.texinfo
|
|
||||||
@@ -47046,27 +47046,28 @@ regarding @code{debuginfod}.
|
|
||||||
@value{GDBN} provides the following commands for configuring @code{debuginfod}.
|
|
||||||
|
|
||||||
@table @code
|
|
||||||
-@kindex set debuginfod
|
|
||||||
-@anchor{set debuginfod}
|
|
||||||
-@item set debuginfod
|
|
||||||
-@itemx set debuginfod on
|
|
||||||
+@kindex set debuginfod enabled
|
|
||||||
+@anchor{set debuginfod enabled}
|
|
||||||
+@item set debuginfod enabled
|
|
||||||
+@itemx set debuginfod enabled on
|
|
||||||
@cindex enable debuginfod
|
|
||||||
@value{GDBN} will attempt to query @code{debuginfod} servers when missing debug
|
|
||||||
info or source files.
|
|
||||||
|
|
||||||
-@item set debuginfod off
|
|
||||||
+@item set debuginfod enabled off
|
|
||||||
@value{GDBN} will not attempt to query @code{debuginfod} servers when missing
|
|
||||||
-debug info or source files. By default, @code{debuginfod} is set to @code{off}
|
|
||||||
-for non-interactive sessions.
|
|
||||||
+debug info or source files. By default, @code{debuginfod enabled} is set to
|
|
||||||
+@code{off} for non-interactive sessions.
|
|
||||||
|
|
||||||
-@item set debuginfod ask
|
|
||||||
+@item set debuginfod enabled ask
|
|
||||||
@value{GDBN} will prompt the user to enable or disable @code{debuginfod} before
|
|
||||||
-attempting to perform the next query. By default, @code{debuginfod} is set to
|
|
||||||
-@code{ask} for interactive sessions.
|
|
||||||
+attempting to perform the next query. By default, @code{debuginfod enabled}
|
|
||||||
+is set to @code{ask} for interactive sessions.
|
|
||||||
|
|
||||||
-@kindex show debuginfod status
|
|
||||||
-@item show debuginfod status
|
|
||||||
-Show whether @code{debuginfod} is set to @code{on}, @code{off} or @code{ask}.
|
|
||||||
+@kindex show debuginfod enabled
|
|
||||||
+@item show debuginfod enabled
|
|
||||||
+Display whether @code{debuginfod enabled} is set to @code{on}, @code{off} or
|
|
||||||
+@code{ask}.
|
|
||||||
|
|
||||||
@kindex set debuginfod urls
|
|
||||||
@cindex configure debuginfod URLs
|
|
||||||
diff --git a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp
|
|
||||||
--- a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp
|
|
||||||
+++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp
|
|
||||||
@@ -236,7 +236,7 @@ proc local_url { } {
|
|
||||||
clean_restart
|
|
||||||
gdb_test "file $binfile" ".*No debugging symbols.*" \
|
|
||||||
"file [file tail $binfile] cmd"
|
|
||||||
- gdb_test_no_output "set debuginfod off"
|
|
||||||
+ gdb_test_no_output "set debuginfod enabled off"
|
|
||||||
gdb_test_no_output "set debuginfod urls http://127.0.0.1:$port"
|
|
||||||
|
|
||||||
# gdb shouldn't find the debuginfo since debuginfod has been disabled
|
|
||||||
@@ -244,7 +244,7 @@ proc local_url { } {
|
|
||||||
"file [file tail $binfile] cmd off"
|
|
||||||
|
|
||||||
# Enable debuginfod and fetch the debuginfo
|
|
||||||
- gdb_test_no_output "set debuginfod on"
|
|
||||||
+ gdb_test_no_output "set debuginfod enabled on"
|
|
||||||
gdb_test "file $binfile" ".*Reading symbols from.*debuginfo.*" \
|
|
||||||
"file [file tail $binfile] cmd on"
|
|
||||||
}
|
|
@ -1,152 +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 Jan 2022 13:00:50 +0100
|
|
||||||
Subject: gdb-rhbz2024875-expand-documentation-for-debuginfod.patch
|
|
||||||
|
|
||||||
;;Backport upstream commit from Aaron Merey
|
|
||||||
;;3ea44f21299 gdb.texinfo: Expand documentation for debuginfod
|
|
||||||
|
|
||||||
gdb.texinfo: Expand documentation for debuginfod
|
|
||||||
|
|
||||||
Add section describing GDB's usage of debuginfod.
|
|
||||||
|
|
||||||
Refer to this new section in the description of the '--with-debuginfod'
|
|
||||||
configure option.
|
|
||||||
|
|
||||||
Mention debuginfod in the 'Separate Debug Files' section.
|
|
||||||
|
|
||||||
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
|
||||||
--- a/gdb/doc/gdb.texinfo
|
|
||||||
+++ b/gdb/doc/gdb.texinfo
|
|
||||||
@@ -184,6 +184,7 @@ software in general. We will miss him.
|
|
||||||
the operating system
|
|
||||||
* Trace File Format:: GDB trace file format
|
|
||||||
* Index Section Format:: .gdb_index section format
|
|
||||||
+* Debuginfod:: Download debugging resources with @code{debuginfod}
|
|
||||||
* Man Pages:: Manual pages
|
|
||||||
* Copying:: GNU General Public License says
|
|
||||||
how you can copy and share GDB
|
|
||||||
@@ -21373,7 +21374,9 @@ For the ``build ID'' method, @value{GDBN} looks in the
|
|
||||||
a file named @file{@var{nn}/@var{nnnnnnnn}.debug}, where @var{nn} are the
|
|
||||||
first 2 hex characters of the build ID bit string, and @var{nnnnnnnn}
|
|
||||||
are the rest of the bit string. (Real build ID strings are 32 or more
|
|
||||||
-hex characters, not 10.)
|
|
||||||
+hex characters, not 10.) @value{GDBN} can automatically query
|
|
||||||
+@code{debuginfod} servers using build IDs in order to download separate debug
|
|
||||||
+files that cannot be found locally. For more information see @ref{Debuginfod}.
|
|
||||||
@end itemize
|
|
||||||
|
|
||||||
So, for example, suppose you ask @value{GDBN} to debug
|
|
||||||
@@ -21394,6 +21397,10 @@ debug information files, in the indicated order:
|
|
||||||
@file{/usr/lib/debug/usr/bin/ls.debug}.
|
|
||||||
@end itemize
|
|
||||||
|
|
||||||
+If the debug file still has not been found and @code{debuginfod}
|
|
||||||
+(@pxref{Debuginfod}) is enabled, @value{GDBN} will attempt to download the
|
|
||||||
+file from @code{debuginfod} servers.
|
|
||||||
+
|
|
||||||
@anchor{debug-file-directory}
|
|
||||||
Global debugging info directories default to what is set by @value{GDBN}
|
|
||||||
configure option @option{--with-separate-debug-dir}. During @value{GDBN} run
|
|
||||||
@@ -38746,12 +38753,12 @@ Use the curses library instead of the termcap library, for text-mode
|
|
||||||
terminal operations.
|
|
||||||
|
|
||||||
@item --with-debuginfod
|
|
||||||
-Build @value{GDBN} with libdebuginfod, the debuginfod client library.
|
|
||||||
-Used to automatically fetch source files and separate debug files from
|
|
||||||
-debuginfod servers using the associated executable's build ID. Enabled
|
|
||||||
-by default if libdebuginfod is installed and found at configure time.
|
|
||||||
-debuginfod is packaged with elfutils, starting with version 0.178. You
|
|
||||||
-can get the latest version from `https://sourceware.org/elfutils/'.
|
|
||||||
+Build @value{GDBN} with @file{libdebuginfod}, the @code{debuginfod} client
|
|
||||||
+library. Used to automatically fetch ELF, DWARF and source files from
|
|
||||||
+@code{debuginfod} servers using build IDs associated with any missing
|
|
||||||
+files. Enabled by default if @file{libdebuginfod} is installed and found
|
|
||||||
+at configure time. For more information regarding @code{debuginfod} see
|
|
||||||
+@ref{Debuginfod}.
|
|
||||||
|
|
||||||
@item --with-libunwind-ia64
|
|
||||||
Use the libunwind library for unwinding function call stack on ia64
|
|
||||||
@@ -47012,6 +47019,82 @@ switch (die->tag)
|
|
||||||
@}
|
|
||||||
@end smallexample
|
|
||||||
|
|
||||||
+@node Debuginfod
|
|
||||||
+@appendix Download debugging resources with Debuginfod
|
|
||||||
+@cindex debuginfod
|
|
||||||
+
|
|
||||||
+@code{debuginfod} is an HTTP server for distributing ELF, DWARF and source
|
|
||||||
+files.
|
|
||||||
+
|
|
||||||
+With the @code{debuginfod} client library, @file{libdebuginfod}, @value{GDBN}
|
|
||||||
+can query servers using the build IDs associated with missing debug info,
|
|
||||||
+executables and source files in order to download them on demand.
|
|
||||||
+
|
|
||||||
+For instructions on building @value{GDBN} with @file{libdebuginfod},
|
|
||||||
+@pxref{Configure Options,,--with-debuginfod}. @code{debuginfod} is packaged
|
|
||||||
+with @code{elfutils}, starting with version 0.178. See
|
|
||||||
+@uref{https://sourceware.org/elfutils/Debuginfod.html} for more information
|
|
||||||
+regarding @code{debuginfod}.
|
|
||||||
+
|
|
||||||
+@menu
|
|
||||||
+* Debuginfod Settings:: Configuring debuginfod with @value{GDBN}
|
|
||||||
+@end menu
|
|
||||||
+
|
|
||||||
+@node Debuginfod Settings
|
|
||||||
+@section Debuginfod Settings
|
|
||||||
+
|
|
||||||
+@value{GDBN} provides the following commands for configuring @code{debuginfod}.
|
|
||||||
+
|
|
||||||
+@table @code
|
|
||||||
+@kindex set debuginfod
|
|
||||||
+@anchor{set debuginfod}
|
|
||||||
+@item set debuginfod
|
|
||||||
+@itemx set debuginfod on
|
|
||||||
+@cindex enable debuginfod
|
|
||||||
+@value{GDBN} will attempt to query @code{debuginfod} servers when missing debug
|
|
||||||
+info or source files.
|
|
||||||
+
|
|
||||||
+@item set debuginfod off
|
|
||||||
+@value{GDBN} will not attempt to query @code{debuginfod} servers when missing
|
|
||||||
+debug info or source files. By default, @code{debuginfod} is set to @code{off}
|
|
||||||
+for non-interactive sessions.
|
|
||||||
+
|
|
||||||
+@item set debuginfod ask
|
|
||||||
+@value{GDBN} will prompt the user to enable or disable @code{debuginfod} before
|
|
||||||
+attempting to perform the next query. By default, @code{debuginfod} is set to
|
|
||||||
+@code{ask} for interactive sessions.
|
|
||||||
+
|
|
||||||
+@kindex show debuginfod status
|
|
||||||
+@item show debuginfod status
|
|
||||||
+Show whether @code{debuginfod} is set to @code{on}, @code{off} or @code{ask}.
|
|
||||||
+
|
|
||||||
+@kindex set debuginfod urls
|
|
||||||
+@cindex configure debuginfod URLs
|
|
||||||
+@item set debuginfod urls
|
|
||||||
+@itemx set debuginfod urls @var{urls}
|
|
||||||
+Set the space-separated list of URLs that @code{debuginfod} will attempt to
|
|
||||||
+query. Only @code{http://}, @code{https://} and @code{file://} protocols
|
|
||||||
+should be used. The default value of @code{debuginfod urls} is copied from
|
|
||||||
+the @var{DEBUGINFOD_URLS} environment variable.
|
|
||||||
+
|
|
||||||
+@kindex show debuginfod urls
|
|
||||||
+@item show debuginfod urls
|
|
||||||
+Display the list of URLs that @code{debuginfod} will attempt to query.
|
|
||||||
+
|
|
||||||
+@kindex set debuginfod verbose
|
|
||||||
+@cindex debuginfod verbosity
|
|
||||||
+@item set debuginfod verbose
|
|
||||||
+@itemx set debuginfod verbose @var{n}
|
|
||||||
+Enable or disable @code{debuginfod}-related output. Use a non-zero value
|
|
||||||
+to enable and @code{0} to disable. @code{debuginfod} output is shown by
|
|
||||||
+default.
|
|
||||||
+
|
|
||||||
+@kindex show debuginfod verbose
|
|
||||||
+@item show debuginfod verbose
|
|
||||||
+Show the current verbosity setting.
|
|
||||||
+
|
|
||||||
+@end table
|
|
||||||
+
|
|
||||||
@node Man Pages
|
|
||||||
@appendix Manual pages
|
|
||||||
@cindex Man pages
|
|
@ -1,37 +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: Tue, 11 Jan 2022 12:22:29 +0100
|
|
||||||
Subject: gdb-rhbz2024875-fix-unittest-failure.patch
|
|
||||||
|
|
||||||
;;Backport upstream commit from Tom Tromey
|
|
||||||
;;2a8f1f47446 Fix unittest.exp failure due to 'set debuginfod' addition
|
|
||||||
|
|
||||||
Fix unittest.exp failure due to 'set debuginfod' addition
|
|
||||||
|
|
||||||
The 'set debuginfod' change caused a regression in unittest.exp:
|
|
||||||
|
|
||||||
Running selftest help_doc_invariants.
|
|
||||||
help doc broken invariant: command 'info set debuginfod' help doc first line is not terminated with a '.' character
|
|
||||||
help doc broken invariant: command 'set debuginfod' help doc first line is not terminated with a '.' character
|
|
||||||
help doc broken invariant: command 'show debuginfod' help doc first line is not terminated with a '.' character
|
|
||||||
Self test failed: self-test failed at ../../binutils-gdb/gdb/unittests/command-def-selftests.c:100
|
|
||||||
|
|
||||||
This patch fixes the problem. I'm checking it in.
|
|
||||||
|
|
||||||
diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
|
|
||||||
--- a/gdb/debuginfod-support.c
|
|
||||||
+++ b/gdb/debuginfod-support.c
|
|
||||||
@@ -390,11 +390,11 @@ _initialize_debuginfod ()
|
|
||||||
{
|
|
||||||
/* set/show debuginfod */
|
|
||||||
add_basic_prefix_cmd ("debuginfod", class_run,
|
|
||||||
- _("Set debuginfod options"),
|
|
||||||
+ _("Set debuginfod options."),
|
|
||||||
&set_debuginfod_prefix_list, 0, &setlist);
|
|
||||||
|
|
||||||
add_show_prefix_cmd ("debuginfod", class_run,
|
|
||||||
- _("Show debuginfod options"),
|
|
||||||
+ _("Show debuginfod option."),
|
|
||||||
&show_debuginfod_prefix_list, 0, &showlist);
|
|
||||||
|
|
||||||
/* set debuginfod on */
|
|
@ -1,60 +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: Tue, 11 Jan 2022 13:22:44 +0100
|
|
||||||
Subject: gdb-rhbz2024875-pr27026.patch
|
|
||||||
|
|
||||||
;;Backport upstream commit from Aaron Merey
|
|
||||||
;;b9db26b4c44 [PR gdb/27026] CTRL-C is ignored when debug info is downloaded
|
|
||||||
|
|
||||||
[PR gdb/27026] CTRL-C is ignored when debug info is downloaded
|
|
||||||
|
|
||||||
During debuginfod downloads, ctrl-c should result in the download
|
|
||||||
being cancelled and skipped. However in some cases, ctrl-c fails to
|
|
||||||
get delivered to gdb during downloading. This can result in downloads
|
|
||||||
being unskippable.
|
|
||||||
|
|
||||||
Fix this by ensuring that target_terminal::ours is in effect for the
|
|
||||||
duration of each download.
|
|
||||||
|
|
||||||
Co-authored-by: Tom de Vries <tdevries@suse.de>
|
|
||||||
https://sourceware.org/bugzilla/show_bug.cgi?id=27026#c3
|
|
||||||
|
|
||||||
diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
|
|
||||||
--- a/gdb/debuginfod-support.c
|
|
||||||
+++ b/gdb/debuginfod-support.c
|
|
||||||
@@ -23,6 +23,7 @@
|
|
||||||
#include "gdbsupport/gdb_optional.h"
|
|
||||||
#include "cli/cli-cmds.h"
|
|
||||||
#include "cli/cli-style.h"
|
|
||||||
+#include "target.h"
|
|
||||||
|
|
||||||
/* Set/show debuginfod commands. */
|
|
||||||
static cmd_list_element *set_debuginfod_prefix_list;
|
|
||||||
@@ -208,6 +209,13 @@ debuginfod_source_query (const unsigned char *build_id,
|
|
||||||
user_data data ("source file", srcpath);
|
|
||||||
|
|
||||||
debuginfod_set_user_data (c, &data);
|
|
||||||
+ gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
|
|
||||||
+ if (target_supports_terminal_ours ())
|
|
||||||
+ {
|
|
||||||
+ term_state.emplace ();
|
|
||||||
+ target_terminal::ours ();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
scoped_fd fd (debuginfod_find_source (c,
|
|
||||||
build_id,
|
|
||||||
build_id_len,
|
|
||||||
@@ -246,6 +254,13 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
|
|
||||||
user_data data ("separate debug info for", filename);
|
|
||||||
|
|
||||||
debuginfod_set_user_data (c, &data);
|
|
||||||
+ gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
|
|
||||||
+ if (target_supports_terminal_ours ())
|
|
||||||
+ {
|
|
||||||
+ term_state.emplace ();
|
|
||||||
+ target_terminal::ours ();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
scoped_fd fd (debuginfod_find_debuginfo (c, build_id, build_id_len,
|
|
||||||
&dname));
|
|
||||||
debuginfod_set_user_data (c, nullptr);
|
|
@ -1,414 +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 Jan 2022 13:35:45 +0100
|
|
||||||
Subject: gdb-rhbz2024875-set_show-for-managing-debuginfod.patch
|
|
||||||
|
|
||||||
;;Backport upstream commit from Aaron Merey
|
|
||||||
;;7811fa5995f gdb: add set/show commands for managing debuginfo
|
|
||||||
|
|
||||||
gdb: add set/show commands for managing debuginfod
|
|
||||||
|
|
||||||
Add 'set debuginfod' command. Accepts 'on', 'off' or 'ask' as an
|
|
||||||
argument. 'on' enables debuginfod for the current session. 'off'
|
|
||||||
disables debuginfod for the current session. 'ask' will prompt
|
|
||||||
the user to either enable or disable debuginfod when the next query
|
|
||||||
is about to be performed:
|
|
||||||
|
|
||||||
This GDB supports auto-downloading debuginfo from the following URLs:
|
|
||||||
<URL1> <URL2> ...
|
|
||||||
Enable debuginfod for this session? (y or [n]) y
|
|
||||||
Debuginfod has been enabled.
|
|
||||||
To make this setting permanent, add 'set debuginfod on' to .gdbinit.
|
|
||||||
|
|
||||||
For interactive sessions, 'ask' is the default. For non-interactive
|
|
||||||
sessions, 'off' is the default.
|
|
||||||
|
|
||||||
Add 'show debuginfod status' command. Displays whether debuginfod
|
|
||||||
is set to 'on', 'off' or 'ask'.
|
|
||||||
|
|
||||||
Add 'set/show debuginfod urls' commands. Accepts a string of
|
|
||||||
space-separated debuginfod server URLs to be queried. The default
|
|
||||||
value is copied from the DEBUGINFOD_URLS environment variable.
|
|
||||||
|
|
||||||
Finally add 'set/show debuginfod verbose' commands to control whether
|
|
||||||
debuginfod-related output is displayed. Verbose output is enabled
|
|
||||||
by default.
|
|
||||||
|
|
||||||
(gdb) run
|
|
||||||
Starting program: /bin/sleep 5
|
|
||||||
Download failed: No route to host. Continuing without debug info for /lib64/libc.so.6.
|
|
||||||
|
|
||||||
If GDB is not built with debuginfod then these commands will just display
|
|
||||||
|
|
||||||
Support for debuginfod is not compiled into GDB.
|
|
||||||
|
|
||||||
diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
|
|
||||||
--- a/gdb/debuginfod-support.c
|
|
||||||
+++ b/gdb/debuginfod-support.c
|
|
||||||
@@ -18,10 +18,26 @@
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include <errno.h>
|
|
||||||
-#include "cli/cli-style.h"
|
|
||||||
#include "gdbsupport/scoped_fd.h"
|
|
||||||
#include "debuginfod-support.h"
|
|
||||||
#include "gdbsupport/gdb_optional.h"
|
|
||||||
+#include "cli/cli-cmds.h"
|
|
||||||
+#include "cli/cli-style.h"
|
|
||||||
+
|
|
||||||
+/* Set/show debuginfod commands. */
|
|
||||||
+static cmd_list_element *set_debuginfod_prefix_list;
|
|
||||||
+static cmd_list_element *show_debuginfod_prefix_list;
|
|
||||||
+
|
|
||||||
+static const char debuginfod_on[] = "on";
|
|
||||||
+static const char debuginfod_off[] = "off";
|
|
||||||
+static const char debuginfod_ask[] = "ask";
|
|
||||||
+
|
|
||||||
+static const char *debuginfod_enable = debuginfod_ask;
|
|
||||||
+static unsigned debuginfod_verbose = 1;
|
|
||||||
+
|
|
||||||
+/* This is never actually used. URLs are always pulled from the
|
|
||||||
+ environment. */
|
|
||||||
+static char *debuginfod_urls;
|
|
||||||
|
|
||||||
#ifndef HAVE_LIBDEBUGINFOD
|
|
||||||
scoped_fd
|
|
||||||
@@ -41,6 +57,67 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
|
|
||||||
{
|
|
||||||
return scoped_fd (-ENOSYS);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+#define NO_IMPL _("Support for debuginfod is not compiled into GDB.")
|
|
||||||
+
|
|
||||||
+/* Stub set/show commands that indicate debuginfod is not supported. */
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+set_debuginfod_on_command (const char *args, int from_tty)
|
|
||||||
+{
|
|
||||||
+ error (NO_IMPL);
|
|
||||||
+ debuginfod_enable = debuginfod_off;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+set_debuginfod_off_command (const char *args, int from_tty)
|
|
||||||
+{
|
|
||||||
+ error (NO_IMPL);
|
|
||||||
+ debuginfod_enable = debuginfod_off;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+set_debuginfod_ask_command (const char *args, int from_tty)
|
|
||||||
+{
|
|
||||||
+ error (NO_IMPL);
|
|
||||||
+ debuginfod_enable = debuginfod_off;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+show_debuginfod_status_command (const char *args, int from_tty)
|
|
||||||
+{
|
|
||||||
+ error (NO_IMPL);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+set_debuginfod_urls_command (const char *ignore, int from_tty,
|
|
||||||
+ struct cmd_list_element *c)
|
|
||||||
+{
|
|
||||||
+ error (NO_IMPL);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+show_debuginfod_urls_command (struct ui_file *file, int from_tty,
|
|
||||||
+ struct cmd_list_element *cmd, const char *value)
|
|
||||||
+{
|
|
||||||
+ error (NO_IMPL);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+set_debuginfod_verbose_command (const char *args, int from_tty,
|
|
||||||
+ struct cmd_list_element *c)
|
|
||||||
+{
|
|
||||||
+ error (NO_IMPL);
|
|
||||||
+ debuginfod_verbose = 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+show_debuginfod_verbose_command (struct ui_file *file, int from_tty,
|
|
||||||
+ struct cmd_list_element *cmd,
|
|
||||||
+ const char *value)
|
|
||||||
+{
|
|
||||||
+ error (NO_IMPL);
|
|
||||||
+}
|
|
||||||
#else
|
|
||||||
#include <elfutils/debuginfod.h>
|
|
||||||
|
|
||||||
@@ -68,6 +145,82 @@ struct debuginfod_client_deleter
|
|
||||||
using debuginfod_client_up
|
|
||||||
= std::unique_ptr<debuginfod_client, debuginfod_client_deleter>;
|
|
||||||
|
|
||||||
+/* Enable debuginfod. */
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+set_debuginfod_on_command (const char *args, int from_tty)
|
|
||||||
+{
|
|
||||||
+ debuginfod_enable = debuginfod_on;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* Disable debuginfod. */
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+set_debuginfod_off_command (const char *args, int from_tty)
|
|
||||||
+{
|
|
||||||
+ debuginfod_enable = debuginfod_off;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* Before next query, ask user whether to enable debuginfod. */
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+set_debuginfod_ask_command (const char *args, int from_tty)
|
|
||||||
+{
|
|
||||||
+ debuginfod_enable = debuginfod_ask;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* Show whether debuginfod is enabled. */
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+show_debuginfod_status_command (const char *args, int from_tty)
|
|
||||||
+{
|
|
||||||
+ printf_unfiltered (_("Debuginfod functionality is currently set to " \
|
|
||||||
+ "\"%s\".\n"), debuginfod_enable);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* Set the URLs that debuginfod will query. */
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+set_debuginfod_urls_command (const char *ignore, int from_tty,
|
|
||||||
+ struct cmd_list_element *c)
|
|
||||||
+{
|
|
||||||
+ gdb_assert (debuginfod_urls != nullptr);
|
|
||||||
+ if (setenv ("DEBUGINFOD_URLS", debuginfod_urls, 1) != 0)
|
|
||||||
+ warning (_("Unable to set debuginfod URLs: %s"), safe_strerror (errno));
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* Show the URLs that debuginfod will query. */
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+show_debuginfod_urls_command (struct ui_file *file, int from_tty,
|
|
||||||
+ struct cmd_list_element *cmd, const char *value)
|
|
||||||
+{
|
|
||||||
+ if (value == nullptr || value[0] == '\0')
|
|
||||||
+ fprintf_unfiltered (file, _("Debuginfod URLs have not been set.\n"));
|
|
||||||
+ else
|
|
||||||
+ fprintf_filtered (file, _("Debuginfod URLs are currently set to:\n%s\n"),
|
|
||||||
+ value);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* No-op setter used for compatibility when gdb is built without debuginfod. */
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+set_debuginfod_verbose_command (const char *args, int from_tty,
|
|
||||||
+ struct cmd_list_element *c)
|
|
||||||
+{
|
|
||||||
+ return;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* Show verbosity. */
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+show_debuginfod_verbose_command (struct ui_file *file, int from_tty,
|
|
||||||
+ struct cmd_list_element *cmd, const char *value)
|
|
||||||
+{
|
|
||||||
+ fprintf_filtered (file, _("Debuginfod verbose output is set to %s.\n"),
|
|
||||||
+ value);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static int
|
|
||||||
progressfn (debuginfod_client *c, long cur, long total)
|
|
||||||
{
|
|
||||||
@@ -120,6 +273,42 @@ get_debuginfod_client ()
|
|
||||||
return global_client.get ();
|
|
||||||
}
|
|
||||||
|
|
||||||
+/* Check if debuginfod is enabled. If configured to do so, ask the user
|
|
||||||
+ whether to enable debuginfod. */
|
|
||||||
+
|
|
||||||
+static bool
|
|
||||||
+debuginfod_enabled ()
|
|
||||||
+{
|
|
||||||
+ const char *urls = getenv (DEBUGINFOD_URLS_ENV_VAR);
|
|
||||||
+
|
|
||||||
+ if (urls == nullptr || urls[0] == '\0'
|
|
||||||
+ || debuginfod_enable == debuginfod_off)
|
|
||||||
+ return false;
|
|
||||||
+
|
|
||||||
+ if (debuginfod_enable == debuginfod_ask)
|
|
||||||
+ {
|
|
||||||
+ int resp = nquery (_("\nThis GDB supports auto-downloading debuginfo " \
|
|
||||||
+ "from the following URLs:\n%s\nEnable debuginfod " \
|
|
||||||
+ "for this session? "),
|
|
||||||
+ urls);
|
|
||||||
+ if (!resp)
|
|
||||||
+ {
|
|
||||||
+ printf_filtered (_("Debuginfod has been disabled.\nTo make this " \
|
|
||||||
+ "setting permanent, add \'set debuginfod off\' " \
|
|
||||||
+ "to .gdbinit.\n"));
|
|
||||||
+ debuginfod_enable = debuginfod_off;
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ printf_filtered (_("Debuginfod has been enabled.\nTo make this " \
|
|
||||||
+ "setting permanent, add \'set debuginfod on\' " \
|
|
||||||
+ "to .gdbinit.\n"));
|
|
||||||
+ debuginfod_enable = debuginfod_on;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return true;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/* See debuginfod-support.h */
|
|
||||||
|
|
||||||
scoped_fd
|
|
||||||
@@ -128,8 +317,7 @@ debuginfod_source_query (const unsigned char *build_id,
|
|
||||||
const char *srcpath,
|
|
||||||
gdb::unique_xmalloc_ptr<char> *destname)
|
|
||||||
{
|
|
||||||
- const char *urls_env_var = getenv (DEBUGINFOD_URLS_ENV_VAR);
|
|
||||||
- if (urls_env_var == NULL || urls_env_var[0] == '\0')
|
|
||||||
+ if (!debuginfod_enabled ())
|
|
||||||
return scoped_fd (-ENOSYS);
|
|
||||||
|
|
||||||
debuginfod_client *c = get_debuginfod_client ();
|
|
||||||
@@ -147,8 +335,7 @@ debuginfod_source_query (const unsigned char *build_id,
|
|
||||||
nullptr));
|
|
||||||
debuginfod_set_user_data (c, nullptr);
|
|
||||||
|
|
||||||
- /* TODO: Add 'set debug debuginfod' command to control when error messages are shown. */
|
|
||||||
- if (fd.get () < 0 && fd.get () != -ENOENT)
|
|
||||||
+ if (debuginfod_verbose > 0 && fd.get () < 0 && fd.get () != -ENOENT)
|
|
||||||
printf_filtered (_("Download failed: %s. Continuing without source file %ps.\n"),
|
|
||||||
safe_strerror (-fd.get ()),
|
|
||||||
styled_string (file_name_style.style (), srcpath));
|
|
||||||
@@ -167,8 +354,7 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
|
|
||||||
const char *filename,
|
|
||||||
gdb::unique_xmalloc_ptr<char> *destname)
|
|
||||||
{
|
|
||||||
- const char *urls_env_var = getenv (DEBUGINFOD_URLS_ENV_VAR);
|
|
||||||
- if (urls_env_var == NULL || urls_env_var[0] == '\0')
|
|
||||||
+ if (!debuginfod_enabled ())
|
|
||||||
return scoped_fd (-ENOSYS);
|
|
||||||
|
|
||||||
debuginfod_client *c = get_debuginfod_client ();
|
|
||||||
@@ -184,7 +370,7 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
|
|
||||||
&dname));
|
|
||||||
debuginfod_set_user_data (c, nullptr);
|
|
||||||
|
|
||||||
- if (fd.get () < 0 && fd.get () != -ENOENT)
|
|
||||||
+ if (debuginfod_verbose > 0 && fd.get () < 0 && fd.get () != -ENOENT)
|
|
||||||
printf_filtered (_("Download failed: %s. Continuing without debug info for %ps.\n"),
|
|
||||||
safe_strerror (-fd.get ()),
|
|
||||||
styled_string (file_name_style.style (), filename));
|
|
||||||
@@ -195,3 +381,63 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
+
|
|
||||||
+/* Register debuginfod commands. */
|
|
||||||
+
|
|
||||||
+void _initialize_debuginfod ();
|
|
||||||
+void
|
|
||||||
+_initialize_debuginfod ()
|
|
||||||
+{
|
|
||||||
+ /* set/show debuginfod */
|
|
||||||
+ add_basic_prefix_cmd ("debuginfod", class_run,
|
|
||||||
+ _("Set debuginfod options"),
|
|
||||||
+ &set_debuginfod_prefix_list, 0, &setlist);
|
|
||||||
+
|
|
||||||
+ add_show_prefix_cmd ("debuginfod", class_run,
|
|
||||||
+ _("Show debuginfod options"),
|
|
||||||
+ &show_debuginfod_prefix_list, 0, &showlist);
|
|
||||||
+
|
|
||||||
+ /* set debuginfod on */
|
|
||||||
+ add_cmd ("on", class_run, set_debuginfod_on_command,
|
|
||||||
+ _("Enable debuginfod."), &set_debuginfod_prefix_list);
|
|
||||||
+
|
|
||||||
+ /* set debuginfod off */
|
|
||||||
+ add_cmd ("off", class_run, set_debuginfod_off_command,
|
|
||||||
+ _("Disable debuginfod."), &set_debuginfod_prefix_list);
|
|
||||||
+
|
|
||||||
+ /* set debuginfod ask */
|
|
||||||
+ add_cmd ("ask", class_run, set_debuginfod_ask_command, _("\
|
|
||||||
+Ask the user whether to enable debuginfod before performing the next query."),
|
|
||||||
+ &set_debuginfod_prefix_list);
|
|
||||||
+
|
|
||||||
+ /* show debuginfod status */
|
|
||||||
+ add_cmd ("status", class_run, show_debuginfod_status_command,
|
|
||||||
+ _("Show whether debuginfod is set to \"on\", \"off\" or \"ask\"."),
|
|
||||||
+ &show_debuginfod_prefix_list);
|
|
||||||
+
|
|
||||||
+ /* set/show debuginfod urls */
|
|
||||||
+ add_setshow_string_noescape_cmd ("urls", class_run, &debuginfod_urls, _("\
|
|
||||||
+Set the list of debuginfod server URLs."), _("\
|
|
||||||
+Show the list of debuginfod server URLs."), _("\
|
|
||||||
+Manage the space-separated list of debuginfod server URLs that GDB will query \
|
|
||||||
+when missing debuginfo, executables or source files.\nThe default value is \
|
|
||||||
+copied from the DEBUGINFOD_URLS environment variable."),
|
|
||||||
+ set_debuginfod_urls_command,
|
|
||||||
+ show_debuginfod_urls_command,
|
|
||||||
+ &set_debuginfod_prefix_list,
|
|
||||||
+ &show_debuginfod_prefix_list);
|
|
||||||
+ if (getenv ("DEBUGINFOD_URLS") != nullptr)
|
|
||||||
+ debuginfod_urls = xstrdup (getenv ("DEBUGINFOD_URLS"));
|
|
||||||
+
|
|
||||||
+ /* set/show debuginfod verbose */
|
|
||||||
+ add_setshow_zuinteger_cmd ("verbose", class_support,
|
|
||||||
+ &debuginfod_verbose, _("\
|
|
||||||
+Set verbosity of debuginfod output."), _("\
|
|
||||||
+Show debuginfod debugging."), _("\
|
|
||||||
+When set to a non-zero value, display verbose output for each debuginfod \
|
|
||||||
+query.\nTo disable, set to zero. Verbose output is displayed by default."),
|
|
||||||
+ set_debuginfod_verbose_command,
|
|
||||||
+ show_debuginfod_verbose_command,
|
|
||||||
+ &set_debuginfod_prefix_list,
|
|
||||||
+ &show_debuginfod_prefix_list);
|
|
||||||
+}
|
|
||||||
diff --git a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp
|
|
||||||
--- a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp
|
|
||||||
+++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp
|
|
||||||
@@ -217,7 +217,8 @@ proc local_url { } {
|
|
||||||
setenv DEBUGINFOD_URLS http://127.0.0.1:$port
|
|
||||||
|
|
||||||
# gdb should now find the symbol and source files
|
|
||||||
- clean_restart $binfile
|
|
||||||
+ clean_restart
|
|
||||||
+ gdb_test "file $binfile" "" "file [file tail $binfile]" "Enable debuginfod?.*" "y"
|
|
||||||
gdb_test_no_output "set substitute-path $outputdir /dev/null" \
|
|
||||||
"set substitute-path"
|
|
||||||
gdb_test "br main" "Breakpoint 1 at.*file.*"
|
|
||||||
@@ -226,8 +227,26 @@ proc local_url { } {
|
|
||||||
# gdb should now find the debugaltlink file
|
|
||||||
clean_restart
|
|
||||||
gdb_test "file ${binfile}_alt.o" \
|
|
||||||
- ".*Reading symbols from ${binfile}_alt.o\.\.\.*" \
|
|
||||||
- "file [file tail ${binfile}_alt.o]"
|
|
||||||
+ ".*Downloading.*separate debug info.*" \
|
|
||||||
+ "file [file tail ${binfile}_alt.o]" \
|
|
||||||
+ ".*Enable debuginfod?.*" "y"
|
|
||||||
+
|
|
||||||
+ # Configure debuginfod with commands
|
|
||||||
+ unsetenv DEBUGINFOD_URLS
|
|
||||||
+ clean_restart
|
|
||||||
+ gdb_test "file $binfile" ".*No debugging symbols.*" \
|
|
||||||
+ "file [file tail $binfile] cmd"
|
|
||||||
+ gdb_test_no_output "set debuginfod off"
|
|
||||||
+ gdb_test_no_output "set debuginfod urls http://127.0.0.1:$port"
|
|
||||||
+
|
|
||||||
+ # gdb shouldn't find the debuginfo since debuginfod has been disabled
|
|
||||||
+ gdb_test "file $binfile" ".*No debugging symbols.*" \
|
|
||||||
+ "file [file tail $binfile] cmd off"
|
|
||||||
+
|
|
||||||
+ # Enable debuginfod and fetch the debuginfo
|
|
||||||
+ gdb_test_no_output "set debuginfod on"
|
|
||||||
+ gdb_test "file $binfile" ".*Reading symbols from.*debuginfo.*" \
|
|
||||||
+ "file [file tail $binfile] cmd on"
|
|
||||||
}
|
|
||||||
|
|
||||||
set envlist \
|
|
@ -1,101 +0,0 @@
|
|||||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
||||||
From: Keith Seitz <keiths@redhat.com>
|
|
||||||
Date: Wed, 26 Jan 2022 08:56:18 -0800
|
|
||||||
Subject: gdb-rhbz2042257-ftbs-updates.patch
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
;; Fix build problems.
|
|
||||||
;; (RHBZ 2042257, Keith Seitz, Andrew Burgess)
|
|
||||||
|
|
||||||
1) Reference array of structs instead of first member during memcpy
|
|
||||||
|
|
||||||
aarch64-tdep.c defines the following macro:
|
|
||||||
|
|
||||||
do \
|
|
||||||
{ \
|
|
||||||
unsigned int mem_len = LENGTH; \
|
|
||||||
if (mem_len) \
|
|
||||||
{ \
|
|
||||||
MEMS = XNEWVEC (struct aarch64_mem_r, mem_len); \
|
|
||||||
memcpy(&MEMS->len, &RECORD_BUF[0], \
|
|
||||||
sizeof(struct aarch64_mem_r) * LENGTH); \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
while (0)
|
|
||||||
|
|
||||||
This is simlpy allocating a new array and copying it. However, for
|
|
||||||
the destination address, it is actually copying into the first member
|
|
||||||
of the first element of the array (`&MEMS->len"). This elicits a
|
|
||||||
warning with GCC 12:
|
|
||||||
|
|
||||||
../../binutils-gdb/gdb/aarch64-tdep.c: In function ‘int aarch64_process_record(gdbarch*, regcache*, CORE_ADDR)’:
|
|
||||||
../../binutils-gdb/gdb/aarch64-tdep.c:3711:23: error: writing 16 bytes into a region of size 8 [-Werror=stringop-overflow=]
|
|
||||||
3711 | memcpy(&MEMS->len, &RECORD_BUF[0], \
|
|
||||||
| ^
|
|
||||||
../../binutils-gdb/gdb/aarch64-tdep.c:4394:3: note: in expansion of macro ‘MEM_ALLOC’
|
|
||||||
4394 | MEM_ALLOC (aarch64_insn_r->aarch64_mems, aarch64_insn_r->mem_rec_count,
|
|
||||||
| ^~~~~~~~~
|
|
||||||
../../binutils-gdb/gdb/aarch64-tdep.c:3721:12: note: destination object ‘aarch64_mem_r::len’ of size 8
|
|
||||||
3721 | uint64_t len; /* Record length. */
|
|
||||||
| ^~~
|
|
||||||
|
|
||||||
The simple fix is to reference the array, `MEMS' as the destination of the copy.
|
|
||||||
|
|
||||||
Tested by rebuilding.
|
|
||||||
|
|
||||||
2) Fix build with current GCC: EL_EXPLICIT(location) always non-NULL
|
|
||||||
|
|
||||||
Compiling GDB with current GCC (1b4a63593b) runs into this:
|
|
||||||
|
|
||||||
src/gdb/location.c: In function 'int event_location_empty_p(const event_location*)':
|
|
||||||
src/gdb/location.c:963:38: error: the address of 'event_location::<unnamed union>::explicit_loc' will never be NULL [-Werror=address]
|
|
||||||
963 | return (EL_EXPLICIT (location) == NULL
|
|
||||||
| ^
|
|
||||||
src/gdb/location.c:57:30: note: 'event_location::<unnamed union>::explicit_loc' declared here
|
|
||||||
57 | struct explicit_location explicit_loc;
|
|
||||||
| ^~~~~~~~~~~~
|
|
||||||
|
|
||||||
GCC is right, EL_EXPLICIT is defined as returning the address of an
|
|
||||||
union field:
|
|
||||||
|
|
||||||
/* An explicit location. */
|
|
||||||
struct explicit_location explicit_loc;
|
|
||||||
#define EL_EXPLICIT(P) (&((P)->u.explicit_loc))
|
|
||||||
|
|
||||||
and thus must always be non-NULL.
|
|
||||||
|
|
||||||
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
|
|
||||||
--- a/gdb/aarch64-tdep.c
|
|
||||||
+++ b/gdb/aarch64-tdep.c
|
|
||||||
@@ -3666,7 +3666,7 @@ When on, AArch64 specific debugging is enabled."),
|
|
||||||
if (mem_len) \
|
|
||||||
{ \
|
|
||||||
MEMS = XNEWVEC (struct aarch64_mem_r, mem_len); \
|
|
||||||
- memcpy(&MEMS->len, &RECORD_BUF[0], \
|
|
||||||
+ memcpy(MEMS, &RECORD_BUF[0], \
|
|
||||||
sizeof(struct aarch64_mem_r) * LENGTH); \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
diff --git a/gdb/location.c b/gdb/location.c
|
|
||||||
--- a/gdb/location.c
|
|
||||||
+++ b/gdb/location.c
|
|
||||||
@@ -960,12 +960,11 @@ event_location_empty_p (const struct event_location *location)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
case EXPLICIT_LOCATION:
|
|
||||||
- return (EL_EXPLICIT (location) == NULL
|
|
||||||
- || (EL_EXPLICIT (location)->source_filename == NULL
|
|
||||||
- && EL_EXPLICIT (location)->function_name == NULL
|
|
||||||
- && EL_EXPLICIT (location)->label_name == NULL
|
|
||||||
- && (EL_EXPLICIT (location)->line_offset.sign
|
|
||||||
- == LINE_OFFSET_UNKNOWN)));
|
|
||||||
+ return (EL_EXPLICIT (location)->source_filename == NULL
|
|
||||||
+ && EL_EXPLICIT (location)->function_name == NULL
|
|
||||||
+ && EL_EXPLICIT (location)->label_name == NULL
|
|
||||||
+ && (EL_EXPLICIT (location)->line_offset.sign
|
|
||||||
+ == LINE_OFFSET_UNKNOWN));
|
|
||||||
|
|
||||||
case PROBE_LOCATION:
|
|
||||||
return EL_PROBE (location) == NULL;
|
|
@ -1,94 +0,0 @@
|
|||||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
||||||
From: Kevin Buettner <kevinb@redhat.com>
|
|
||||||
Date: Wed, 30 Mar 2022 13:28:26 -0700
|
|
||||||
Subject: gdb-rhbz2068280-debuginfod-unavailable-size.patch
|
|
||||||
|
|
||||||
;; Backport upstream patch from Aaron Merey which suppresses debuginfod
|
|
||||||
;; progress messages when size is zero. (RH BZ 2068280).
|
|
||||||
|
|
||||||
Remove download size from debuginfod progress messages if unavailable
|
|
||||||
|
|
||||||
Currently debuginfod progress update messages include the size of
|
|
||||||
each download:
|
|
||||||
|
|
||||||
Downloading 7.5 MB separate debug info for /lib/libxyz.so.0
|
|
||||||
|
|
||||||
This value originates from the Content-Length HTTP header of the
|
|
||||||
transfer. However this header is not guaranteed to be present for
|
|
||||||
each download. This can happen when debuginfod servers compress files
|
|
||||||
on-the-fly at the time of transfer. In this case gdb wrongly prints
|
|
||||||
"-0.00 MB" as the size.
|
|
||||||
|
|
||||||
This patch removes download sizes from progress messages when they are
|
|
||||||
not available. It also removes usage of the progress bar until
|
|
||||||
a more thorough reworking of progress updating is implemented. [1]
|
|
||||||
|
|
||||||
[1] https://sourceware.org/pipermail/gdb-patches/2022-February/185798.html
|
|
||||||
|
|
||||||
diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
|
|
||||||
--- a/gdb/debuginfod-support.c
|
|
||||||
+++ b/gdb/debuginfod-support.c
|
|
||||||
@@ -81,12 +81,12 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
|
|
||||||
struct user_data
|
|
||||||
{
|
|
||||||
user_data (const char *desc, const char *fname)
|
|
||||||
- : desc (desc), fname (fname)
|
|
||||||
+ : desc (desc), fname (fname), has_printed (false)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
const char * const desc;
|
|
||||||
const char * const fname;
|
|
||||||
- gdb::optional<ui_out::progress_meter> meter;
|
|
||||||
+ bool has_printed;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Deleter for a debuginfod_client. */
|
|
||||||
@@ -116,24 +116,32 @@ progressfn (debuginfod_client *c, long cur, long total)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (total == 0)
|
|
||||||
- return 0;
|
|
||||||
-
|
|
||||||
- if (!data->meter.has_value ())
|
|
||||||
+ if (!data->has_printed)
|
|
||||||
{
|
|
||||||
- float size_in_mb = 1.0f * total / (1024 * 1024);
|
|
||||||
- string_file styled_filename (current_uiout->can_emit_style_escape ());
|
|
||||||
- fprintf_styled (&styled_filename,
|
|
||||||
- file_name_style.style (),
|
|
||||||
- "%s",
|
|
||||||
- data->fname);
|
|
||||||
- std::string message
|
|
||||||
- = string_printf ("Downloading %.2f MB %s %s", size_in_mb, data->desc,
|
|
||||||
- styled_filename.c_str());
|
|
||||||
- data->meter.emplace (current_uiout, message, 1);
|
|
||||||
- }
|
|
||||||
+ /* Include the transfer size, if available. */
|
|
||||||
+ if (total > 0)
|
|
||||||
+ {
|
|
||||||
+ float size = 1.0f * total / 1024;
|
|
||||||
+ const char *unit = "KB";
|
|
||||||
+
|
|
||||||
+ /* If size is greater than 0.01 MB, set unit to MB. */
|
|
||||||
+ if (size > 10.24)
|
|
||||||
+ {
|
|
||||||
+ size /= 1024;
|
|
||||||
+ unit = "MB";
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ printf_filtered ("Downloading %.2f %s %s %ps...\n",
|
|
||||||
+ size, unit, data->desc,
|
|
||||||
+ styled_string (file_name_style.style (),
|
|
||||||
+ data->fname));
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ printf_filtered ("Downloading %s %ps...\n", data->desc,
|
|
||||||
+ styled_string (file_name_style.style (), data->fname));
|
|
||||||
|
|
||||||
- current_uiout->progress ((double)cur / (double)total);
|
|
||||||
+ data->has_printed = true;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,592 +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: Wed, 29 Sep 2021 11:14:51 +0200
|
|
||||||
Subject: gdb-test-for-rhbz1976887.patch
|
|
||||||
|
|
||||||
;; Backport test for RHBZ 1976887 (Kevin Buettner).
|
|
||||||
|
|
||||||
Test case reproducing PR28030 bug
|
|
||||||
|
|
||||||
The original reproducer for PR28030 required use of a specific
|
|
||||||
compiler version - gcc-c++-11.1.1-3.fc34 is mentioned in the PR,
|
|
||||||
though it seems probable that other gcc versions might also be able to
|
|
||||||
reproduce the bug as well. This commit introduces a test case which,
|
|
||||||
using the DWARF assembler, provides a reproducer which is independent
|
|
||||||
of the compiler version. (Well, it'll work with whatever compilers
|
|
||||||
the DWARF assembler works with.)
|
|
||||||
|
|
||||||
To the best of my knowledge, it's also the first test case which uses
|
|
||||||
the DWARF assembler to provide debug info for a shared object. That
|
|
||||||
being the case, I provided more than the usual commentary which should
|
|
||||||
allow this case to be used as a template when a combo shared
|
|
||||||
library / DWARF assembler test case is required in the future.
|
|
||||||
|
|
||||||
I provide some details regarding the bug in a comment near the
|
|
||||||
beginning of locexpr-dml.exp.
|
|
||||||
|
|
||||||
This problem was difficult to reproduce; I found myself constantly
|
|
||||||
referring to the backtrace while trying to figure out what (else) I
|
|
||||||
might be missing while trying to create a reproducer. Below is a
|
|
||||||
partial backtrace which I include for posterity.
|
|
||||||
|
|
||||||
#0 internal_error (
|
|
||||||
file=0xc50110 "/ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c", line=5575,
|
|
||||||
fmt=0xc520c0 "Unexpected type field location kind: %d")
|
|
||||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdbsupport/errors.cc:51
|
|
||||||
#1 0x00000000006ef0c5 in copy_type_recursive (objfile=0x1635930,
|
|
||||||
type=0x274c260, copied_types=0x30bb290)
|
|
||||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c:5575
|
|
||||||
#2 0x00000000006ef382 in copy_type_recursive (objfile=0x1635930,
|
|
||||||
type=0x274ca10, copied_types=0x30bb290)
|
|
||||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/gdbtypes.c:5602
|
|
||||||
#3 0x0000000000a7409a in preserve_one_value (value=0x24269f0,
|
|
||||||
objfile=0x1635930, copied_types=0x30bb290)
|
|
||||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/value.c:2529
|
|
||||||
#4 0x000000000072012a in gdbscm_preserve_values (
|
|
||||||
extlang=0xc55720 <extension_language_guile>, objfile=0x1635930,
|
|
||||||
copied_types=0x30bb290)
|
|
||||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/guile/scm-value.c:94
|
|
||||||
#5 0x00000000006a3f82 in preserve_ext_lang_values (objfile=0x1635930,
|
|
||||||
copied_types=0x30bb290)
|
|
||||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/extension.c:568
|
|
||||||
#6 0x0000000000a7428d in preserve_values (objfile=0x1635930)
|
|
||||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/value.c:2579
|
|
||||||
#7 0x000000000082d514 in objfile::~objfile (this=0x1635930,
|
|
||||||
__in_chrg=<optimized out>)
|
|
||||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:549
|
|
||||||
#8 0x0000000000831cc8 in std::_Sp_counted_ptr<objfile*, (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0x1654580)
|
|
||||||
at /usr/include/c++/11/bits/shared_ptr_base.h:348
|
|
||||||
#9 0x00000000004e6617 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x1654580) at /usr/include/c++/11/bits/shared_ptr_base.h:168
|
|
||||||
#10 0x00000000004e1d2f in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x190bb88, __in_chrg=<optimized out>)
|
|
||||||
at /usr/include/c++/11/bits/shared_ptr_base.h:705
|
|
||||||
#11 0x000000000082feee in std::__shared_ptr<objfile, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x190bb80, __in_chrg=<optimized out>)
|
|
||||||
at /usr/include/c++/11/bits/shared_ptr_base.h:1154
|
|
||||||
#12 0x000000000082ff0a in std::shared_ptr<objfile>::~shared_ptr (
|
|
||||||
this=0x190bb80, __in_chrg=<optimized out>)
|
|
||||||
at /usr/include/c++/11/bits/shared_ptr.h:122
|
|
||||||
#13 0x000000000085ed7e in __gnu_cxx::new_allocator<std::_List_node<std::shared_ptr<objfile> > >::destroy<std::shared_ptr<objfile> > (this=0x114bc00,
|
|
||||||
__p=0x190bb80) at /usr/include/c++/11/ext/new_allocator.h:168
|
|
||||||
#14 0x000000000085e88d in std::allocator_traits<std::allocator<std::_List_node<std::shared_ptr<objfile> > > >::destroy<std::shared_ptr<objfile> > (__a=...,
|
|
||||||
__p=0x190bb80) at /usr/include/c++/11/bits/alloc_traits.h:531
|
|
||||||
#15 0x000000000085e50c in std::__cxx11::list<std::shared_ptr<objfile>, std::allocator<std::shared_ptr<objfile> > >::_M_erase (this=0x114bc00, __position=
|
|
||||||
std::shared_ptr<objfile> (expired, weak count 1) = {get() = 0x1635930})
|
|
||||||
at /usr/include/c++/11/bits/stl_list.h:1925
|
|
||||||
#16 0x000000000085df0e in std::__cxx11::list<std::shared_ptr<objfile>, std::allocator<std::shared_ptr<objfile> > >::erase (this=0x114bc00, __position=
|
|
||||||
std::shared_ptr<objfile> (expired, weak count 1) = {get() = 0x1635930})
|
|
||||||
at /usr/include/c++/11/bits/list.tcc:158
|
|
||||||
#17 0x000000000085c748 in program_space::remove_objfile (this=0x114bbc0,
|
|
||||||
objfile=0x1635930)
|
|
||||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/progspace.c:210
|
|
||||||
#18 0x000000000082d3ae in objfile::unlink (this=0x1635930)
|
|
||||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:487
|
|
||||||
#19 0x000000000082e68c in objfile_purge_solibs ()
|
|
||||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/objfiles.c:875
|
|
||||||
#20 0x000000000092dd37 in no_shared_libraries (ignored=0x0, from_tty=1)
|
|
||||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/solib.c:1236
|
|
||||||
#21 0x00000000009a37fe in target_pre_inferior (from_tty=1)
|
|
||||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/target.c:2496
|
|
||||||
#22 0x00000000007454d6 in run_command_1 (args=0x0, from_tty=1,
|
|
||||||
run_how=RUN_NORMAL)
|
|
||||||
at /ironwood1/sourceware-git/f34-pr28030/bld/../../worktree-pr28030/gdb/infcmd.c:437
|
|
||||||
|
|
||||||
I'll note a few points regarding this backtrace:
|
|
||||||
|
|
||||||
Frame #1 is where the internal error occurs. It's caused by an
|
|
||||||
unhandled case for FIELD_LOC_KIND_DWARF_BLOCK. The fix for this bug
|
|
||||||
adds support for this case.
|
|
||||||
|
|
||||||
Frame #22 - it's a partial backtrace - shows that GDB is attempting to
|
|
||||||
(re)run the program. You can see the exact command sequence that was
|
|
||||||
used for reproducing this problem in the PR (at
|
|
||||||
https://sourceware.org/bugzilla/show_bug.cgi?id=28030), but in a
|
|
||||||
nutshell, after starting the program and advancing to the appropriate
|
|
||||||
source line, GDB was asked to step into libstdc++; a "finish" command
|
|
||||||
was issued, returning a value. The fact that a value was returned is
|
|
||||||
very important. GDB was then used to step back into libstdc++. A
|
|
||||||
breakpoint was set on a source line in the library after which a "run"
|
|
||||||
command was issued.
|
|
||||||
|
|
||||||
Frame #19 shows a call to objfile_purge_solibs. It's aptly named.
|
|
||||||
|
|
||||||
Frame #7 is a call to the destructor for one of the objfile solibs; it
|
|
||||||
turned out to be the one for libstdc++.
|
|
||||||
|
|
||||||
Frames #6 thru #3 show various value preservation frames. If you look
|
|
||||||
at preserve_values() in gdb/value.c, the value history is preserved
|
|
||||||
first, followed by internal variables, followed by values for the
|
|
||||||
extension languages (python and guile).
|
|
||||||
|
|
||||||
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c
|
|
||||||
new file mode 100644
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-lib.c
|
|
||||||
@@ -0,0 +1,48 @@
|
|
||||||
+/* Copyright (C) 2021 Free Software Foundation, Inc.
|
|
||||||
+
|
|
||||||
+ This file is part of GDB.
|
|
||||||
+
|
|
||||||
+ 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/>. */
|
|
||||||
+
|
|
||||||
+#include "locexpr-data-member-location.h"
|
|
||||||
+
|
|
||||||
+struct A g_A = {3, 4};
|
|
||||||
+struct B g_B = { {8, 9}, 10, 11 };
|
|
||||||
+
|
|
||||||
+B *
|
|
||||||
+foo ()
|
|
||||||
+{ /* foo prologue */
|
|
||||||
+ asm ("foo_label: .globl foo_label");
|
|
||||||
+ return &g_B; /* foo return */
|
|
||||||
+} /* foo end */
|
|
||||||
+
|
|
||||||
+B *
|
|
||||||
+bar (B *v)
|
|
||||||
+{ /* bar prologue */
|
|
||||||
+ asm ("bar_label: .globl bar_label");
|
|
||||||
+ return v; /* bar return */
|
|
||||||
+} /* bar end */
|
|
||||||
+
|
|
||||||
+/* Some of the DWARF assembler procs (e.g. function_range) compile
|
|
||||||
+ this file, expecting it to be a complete program with a main()
|
|
||||||
+ function. When IS_SHAREDLIB is NOT defined, we have main() as
|
|
||||||
+ defined below. */
|
|
||||||
+
|
|
||||||
+#ifndef IS_SHAREDLIB
|
|
||||||
+int
|
|
||||||
+main ()
|
|
||||||
+{
|
|
||||||
+ B *b = foo ();
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c
|
|
||||||
new file mode 100644
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location-main.c
|
|
||||||
@@ -0,0 +1,27 @@
|
|
||||||
+/* Copyright (C) 2021 Free Software Foundation, Inc.
|
|
||||||
+
|
|
||||||
+ This file is part of GDB.
|
|
||||||
+
|
|
||||||
+ 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/>. */
|
|
||||||
+
|
|
||||||
+#include "locexpr-data-member-location.h"
|
|
||||||
+
|
|
||||||
+int
|
|
||||||
+main (void)
|
|
||||||
+{
|
|
||||||
+ B *v1;
|
|
||||||
+ v1 = bar (foo ());
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
|
|
||||||
new file mode 100644
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.exp
|
|
||||||
@@ -0,0 +1,349 @@
|
|
||||||
+# Copyright 2021 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/>.
|
|
||||||
+
|
|
||||||
+# This test case uses the DWARF assembler to reproduce the problem
|
|
||||||
+# described by PR28030. The bug turned out to be that
|
|
||||||
+# FIELD_LOC_KIND_DWARF_BLOCK was not handled when recursively copying
|
|
||||||
+# a value's type when preserving the value history during the freeing
|
|
||||||
+# up of objfiles associated with a shared object. (Yes, figuring out
|
|
||||||
+# how to make this happen in a concise test case turned out to be
|
|
||||||
+# challenging.)
|
|
||||||
+#
|
|
||||||
+# The following elements proved to be necessary for reproducing the
|
|
||||||
+# problem:
|
|
||||||
+#
|
|
||||||
+# 1) A location expression needed to be used with
|
|
||||||
+# DW_AT_data_member_location rather than a simple offset.
|
|
||||||
+# Moreover, this location expression needed to use opcodes
|
|
||||||
+# which GDB's DWARF reader could not convert to a simple
|
|
||||||
+# offset. (Note, however, that GDB could probably be improved
|
|
||||||
+# to handle the opcodes chosen for this test; if decode_locdesc()
|
|
||||||
+# in dwarf2/read.c is ever updated to handle both DW_OP_pick and
|
|
||||||
+# DW_OP_drop, then this test could end up passing even if
|
|
||||||
+# the bug it's intended to test has not been fixed.)
|
|
||||||
+#
|
|
||||||
+# 2) The debug info containing the above DWARF info needed
|
|
||||||
+# to be associated with a shared object since the problem
|
|
||||||
+# occurred while GDB was preserving values during the
|
|
||||||
+# purging of shared objects.
|
|
||||||
+#
|
|
||||||
+# 3) After performing some simple gdb commands, the program is
|
|
||||||
+# run again. In the course of running the objfile destructor
|
|
||||||
+# associated with the shared object, values are preserved
|
|
||||||
+# along with their types. As noted earlier, it was during
|
|
||||||
+# the recursive type copy that the bug was observed.
|
|
||||||
+#
|
|
||||||
+# Therefore, due to #2 above, this test case creates debug info
|
|
||||||
+# which is then used by a shared object.
|
|
||||||
+
|
|
||||||
+# This test can't be run on targets lacking shared library support.
|
|
||||||
+if [skip_shlib_tests] {
|
|
||||||
+ return 0
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+load_lib dwarf.exp
|
|
||||||
+
|
|
||||||
+# This test can only be run on targets which support DWARF-2 and use gas.
|
|
||||||
+if ![dwarf2_support] {
|
|
||||||
+ return 0
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# gdb_test_file_name is the name of this file without the .exp
|
|
||||||
+# extension. Use it to form basenames for the main program
|
|
||||||
+# and shared object.
|
|
||||||
+set main_basename ${::gdb_test_file_name}-main
|
|
||||||
+set lib_basename ${::gdb_test_file_name}-lib
|
|
||||||
+
|
|
||||||
+# We're generating DWARF assembly for the shared object; therefore,
|
|
||||||
+# the source file for the library / shared object must be listed first
|
|
||||||
+# (in the standard_testfile invocation) since ${srcfile} is used by
|
|
||||||
+# get_func_info (for determining the start, end, and length of a
|
|
||||||
+# function).
|
|
||||||
+#
|
|
||||||
+# The output of Dwarf::assemble will be placed in $lib_basename.S
|
|
||||||
+# which will be ${srcfile3} after the execution of standard_testfile.
|
|
||||||
+
|
|
||||||
+standard_testfile $lib_basename.c $main_basename.c $lib_basename.S
|
|
||||||
+
|
|
||||||
+set libsrc "${::srcdir}/${::subdir}/${::srcfile}"
|
|
||||||
+set lib_so [standard_output_file ${lib_basename}.so]
|
|
||||||
+set asm_file [standard_output_file ${::srcfile3}]
|
|
||||||
+
|
|
||||||
+# We need to know the size of some types in order to write some of the
|
|
||||||
+# debugging info that we're about to generate. For that, we ask GDB
|
|
||||||
+# by debugging the shared object associated with this test case.
|
|
||||||
+
|
|
||||||
+# Compile the shared library: -DIS_SHAREDLIB prevents main() from
|
|
||||||
+# being defined. Note that debugging symbols will be present for
|
|
||||||
+# this compilation.
|
|
||||||
+if {[gdb_compile_shlib $libsrc $lib_so \
|
|
||||||
+ {additional_flags=-DIS_SHAREDLIB debug}] != ""} {
|
|
||||||
+ untested "failed to compile shared library"
|
|
||||||
+ return
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# Start a fresh GDB and load the shared library.
|
|
||||||
+clean_restart $lib_so
|
|
||||||
+
|
|
||||||
+# Using our running GDB session, determine sizes of several types.
|
|
||||||
+set long_size [get_sizeof "long" -1]
|
|
||||||
+set addr_size [get_sizeof "void *" -1]
|
|
||||||
+set struct_A_size [get_sizeof "g_A" -1]
|
|
||||||
+set struct_B_size [get_sizeof "g_B" -1]
|
|
||||||
+
|
|
||||||
+if { $long_size == -1 || $addr_size == -1 \
|
|
||||||
+ || $struct_A_size == -1 || $struct_B_size == -1} {
|
|
||||||
+ perror "Can't determine type sizes"
|
|
||||||
+ return
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# Retrieve struct offset of MBR in struct TP
|
|
||||||
+proc get_offsetof { tp mbr } {
|
|
||||||
+ return [get_integer_valueof "&((${tp} *) 0)->${mbr}" -1]
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# Use running GDB session to get struct offsets
|
|
||||||
+set A_a [get_offsetof A a]
|
|
||||||
+set A_x [get_offsetof A x]
|
|
||||||
+set B_a [get_offsetof B a]
|
|
||||||
+set B_b [get_offsetof B b]
|
|
||||||
+set B_x2 [get_offsetof B x2]
|
|
||||||
+
|
|
||||||
+# Create the DWARF.
|
|
||||||
+Dwarf::assemble ${asm_file} {
|
|
||||||
+ declare_labels L
|
|
||||||
+
|
|
||||||
+ # Find start, end, and length of functions foo and bar.
|
|
||||||
+ # These calls to get_func_info will create and set variables
|
|
||||||
+ # foo_start, bar_start, foo_end, bar_end, foo_len, and
|
|
||||||
+ # bar_len.
|
|
||||||
+ #
|
|
||||||
+ # In order to get the right answers, get_func_info (and,
|
|
||||||
+ # underneath, function_range) should use the same compiler flags
|
|
||||||
+ # as those used to make a shared object. For any targets that get
|
|
||||||
+ # this far, -fpic is probably correct.
|
|
||||||
+ #
|
|
||||||
+ # Also, it should be noted that IS_SHAREDLIB is NOT defined as one
|
|
||||||
+ # of the additional flags. Not defining IS_SHAREDLIB will cause a
|
|
||||||
+ # main() to be defined for the compilation of the shared library
|
|
||||||
+ # source file which happens as a result of using get_func_info;
|
|
||||||
+ # this is currently required in order to this facility.
|
|
||||||
+ set flags {additional_flags=-fpic debug}
|
|
||||||
+ get_func_info foo $flags
|
|
||||||
+ get_func_info bar $flags
|
|
||||||
+
|
|
||||||
+ cu {} {
|
|
||||||
+ DW_TAG_compile_unit {
|
|
||||||
+ {DW_AT_language @DW_LANG_C_plus_plus}
|
|
||||||
+ {name ${::srcfile}}
|
|
||||||
+ {stmt_list $L DW_FORM_sec_offset}
|
|
||||||
+ } {
|
|
||||||
+ declare_labels int_label class_A_label class_B_label \
|
|
||||||
+ B_ptr_label
|
|
||||||
+
|
|
||||||
+ int_label: DW_TAG_base_type {
|
|
||||||
+ {DW_AT_byte_size ${::long_size} DW_FORM_udata}
|
|
||||||
+ {DW_AT_encoding @DW_ATE_signed}
|
|
||||||
+ {DW_AT_name "int"}
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ class_A_label: DW_TAG_class_type {
|
|
||||||
+ {DW_AT_name "A"}
|
|
||||||
+ {DW_AT_byte_size ${::struct_A_size} DW_FORM_sdata}
|
|
||||||
+ } {
|
|
||||||
+ DW_TAG_member {
|
|
||||||
+ {DW_AT_name "a"}
|
|
||||||
+ {DW_AT_type :$int_label}
|
|
||||||
+ {DW_AT_data_member_location ${::A_a} DW_FORM_udata}
|
|
||||||
+ }
|
|
||||||
+ DW_TAG_member {
|
|
||||||
+ {DW_AT_name "x"}
|
|
||||||
+ {DW_AT_type :$int_label}
|
|
||||||
+ {DW_AT_data_member_location ${::A_x} DW_FORM_udata}
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ class_B_label: DW_TAG_class_type {
|
|
||||||
+ {DW_AT_name "B"}
|
|
||||||
+ {DW_AT_byte_size ${::struct_B_size} DW_FORM_sdata}
|
|
||||||
+ } {
|
|
||||||
+ # While there are easier / better ways to specify an
|
|
||||||
+ # offset used by DW_AT_data_member_location than that
|
|
||||||
+ # used below, we need a location expression here in
|
|
||||||
+ # order to reproduce the bug. Moreover, this location
|
|
||||||
+ # expression needs to use opcodes that aren't handled
|
|
||||||
+ # by decode_locdesc() in dwarf2/read.c; if we use
|
|
||||||
+ # opcodes that _are_ handled by that function, the
|
|
||||||
+ # location expression will be converted into a simple
|
|
||||||
+ # offset - which will then (again) not reproduce the
|
|
||||||
+ # bug. At the time that this test was written,
|
|
||||||
+ # neither DW_OP_pick nor DW_OP_drop were being handled
|
|
||||||
+ # by decode_locdesc(); this is why those opcodes were
|
|
||||||
+ # chosen.
|
|
||||||
+ DW_TAG_inheritance {
|
|
||||||
+ {DW_AT_type :$class_A_label}
|
|
||||||
+ {DW_AT_data_member_location {
|
|
||||||
+ DW_OP_constu ${::B_a}
|
|
||||||
+ DW_OP_plus
|
|
||||||
+ DW_OP_pick 0
|
|
||||||
+ DW_OP_drop} SPECIAL_expr}
|
|
||||||
+ {DW_AT_accessibility 1 DW_FORM_data1}
|
|
||||||
+ }
|
|
||||||
+ DW_TAG_member {
|
|
||||||
+ {DW_AT_name "b"}
|
|
||||||
+ {DW_AT_type :$int_label}
|
|
||||||
+ {DW_AT_data_member_location ${::B_b} DW_FORM_udata}
|
|
||||||
+ }
|
|
||||||
+ DW_TAG_member {
|
|
||||||
+ {DW_AT_name "x2"}
|
|
||||||
+ {DW_AT_type :$int_label}
|
|
||||||
+ {DW_AT_data_member_location ${::B_x2} DW_FORM_udata}
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ B_ptr_label: DW_TAG_pointer_type {
|
|
||||||
+ {DW_AT_type :$class_B_label}
|
|
||||||
+ {DW_AT_byte_size ${::addr_size} DW_FORM_sdata}
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ DW_TAG_variable {
|
|
||||||
+ {DW_AT_name "g_A"}
|
|
||||||
+ {DW_AT_type :$class_A_label}
|
|
||||||
+ {DW_AT_external 1 flag}
|
|
||||||
+ {DW_AT_location {DW_OP_addr [gdb_target_symbol "g_A"]} \
|
|
||||||
+ SPECIAL_expr}
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ DW_TAG_variable {
|
|
||||||
+ {DW_AT_name "g_B"}
|
|
||||||
+ {DW_AT_type :$class_B_label}
|
|
||||||
+ {DW_AT_external 1 flag}
|
|
||||||
+ {DW_AT_location {DW_OP_addr [gdb_target_symbol "g_B"]} \
|
|
||||||
+ SPECIAL_expr}
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ # We can't use MACRO_AT for the definitions of foo and bar
|
|
||||||
+ # because it doesn't provide a way to pass the appropriate
|
|
||||||
+ # flags. Therefore, we list the name, low_pc, and high_pc
|
|
||||||
+ # explicitly.
|
|
||||||
+ DW_TAG_subprogram {
|
|
||||||
+ {DW_AT_name foo}
|
|
||||||
+ {DW_AT_low_pc $foo_start DW_FORM_addr}
|
|
||||||
+ {DW_AT_high_pc $foo_end DW_FORM_addr}
|
|
||||||
+ {DW_AT_type :${B_ptr_label}}
|
|
||||||
+ {DW_AT_external 1 flag}
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ DW_TAG_subprogram {
|
|
||||||
+ {DW_AT_name bar}
|
|
||||||
+ {DW_AT_low_pc $bar_start DW_FORM_addr}
|
|
||||||
+ {DW_AT_high_pc $bar_end DW_FORM_addr}
|
|
||||||
+ {DW_AT_type :${B_ptr_label}}
|
|
||||||
+ {DW_AT_external 1 flag}
|
|
||||||
+ } {
|
|
||||||
+ DW_TAG_formal_parameter {
|
|
||||||
+ {DW_AT_name v}
|
|
||||||
+ {DW_AT_type :${B_ptr_label}}
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ lines {version 2} L {
|
|
||||||
+ include_dir "${::srcdir}/${::subdir}"
|
|
||||||
+ file_name "${::srcfile}" 1
|
|
||||||
+
|
|
||||||
+ # Generate a line table program.
|
|
||||||
+ program {
|
|
||||||
+ {DW_LNE_set_address $foo_start}
|
|
||||||
+ {line [gdb_get_line_number "foo prologue"]}
|
|
||||||
+ {DW_LNS_copy}
|
|
||||||
+ {DW_LNE_set_address foo_label}
|
|
||||||
+ {line [gdb_get_line_number "foo return"]}
|
|
||||||
+ {DW_LNS_copy}
|
|
||||||
+ {line [gdb_get_line_number "foo end"]}
|
|
||||||
+ {DW_LNS_copy}
|
|
||||||
+ {DW_LNE_set_address $foo_end}
|
|
||||||
+ {DW_LNS_advance_line 1}
|
|
||||||
+ {DW_LNS_copy}
|
|
||||||
+ {DW_LNE_end_sequence}
|
|
||||||
+
|
|
||||||
+ {DW_LNE_set_address $bar_start}
|
|
||||||
+ {line [gdb_get_line_number "bar prologue"]}
|
|
||||||
+ {DW_LNS_copy}
|
|
||||||
+ {DW_LNE_set_address bar_label}
|
|
||||||
+ {line [gdb_get_line_number "bar return"]}
|
|
||||||
+ {DW_LNS_copy}
|
|
||||||
+ {line [gdb_get_line_number "bar end"]}
|
|
||||||
+ {DW_LNS_copy}
|
|
||||||
+ {DW_LNE_set_address $bar_end}
|
|
||||||
+ {DW_LNS_advance_line 1}
|
|
||||||
+ {DW_LNS_copy}
|
|
||||||
+ {DW_LNE_end_sequence}
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# Compile the shared object again, but this time include / use the
|
|
||||||
+# DWARF info that we've created above. Note that (again)
|
|
||||||
+# -DIS_SHAREDLIB is used to prevent inclusion of main() in the shared
|
|
||||||
+# object. Also note the use of the "nodebug" option. Any debugging
|
|
||||||
+# information that we need will be provided by the DWARF info created
|
|
||||||
+# above.
|
|
||||||
+if {[gdb_compile_shlib [list $libsrc $asm_file] $lib_so \
|
|
||||||
+ {additional_flags=-DIS_SHAREDLIB nodebug}] != ""} {
|
|
||||||
+ untested "failed to compile shared library"
|
|
||||||
+ return
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# Compile the main program for use with the shared object.
|
|
||||||
+if [prepare_for_testing "failed to prepare" ${testfile} \
|
|
||||||
+ ${::srcfile2} [list debug shlib=$lib_so]] {
|
|
||||||
+ return -1
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# Do whatever is necessary to make sure that the shared library is
|
|
||||||
+# loaded for remote targets.
|
|
||||||
+gdb_load_shlib ${lib_so}
|
|
||||||
+
|
|
||||||
+if ![runto_main] then {
|
|
||||||
+ fail "can't run to main"
|
|
||||||
+ return
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# Step into foo so that we can finish out of it.
|
|
||||||
+gdb_test "step" "foo .. at .* foo end.*" "step into foo"
|
|
||||||
+
|
|
||||||
+# Finishing out of foo will create a value that will later need to
|
|
||||||
+# be preserved when restarting the program.
|
|
||||||
+gdb_test "finish" "= \\(class B \\*\\) ${::hex} .*" "finish out of foo"
|
|
||||||
+
|
|
||||||
+# Dereferencing and printing the return value isn't necessary
|
|
||||||
+# for reproducing the bug, but we should make sure that the
|
|
||||||
+# return value is what we expect it to be.
|
|
||||||
+gdb_test "p *$" { = {<A> = {a = 8, x = 9}, b = 10, x2 = 11}} \
|
|
||||||
+ "dereference return value"
|
|
||||||
+
|
|
||||||
+# The original PR28030 reproducer stepped back into the shared object,
|
|
||||||
+# so we'll do the same here:
|
|
||||||
+gdb_test "step" "bar \\(.*" "step into bar"
|
|
||||||
+
|
|
||||||
+# We don't want a clean restart here since that will be too clean.
|
|
||||||
+# The original reproducer for PR28030 set a breakpoint in the shared
|
|
||||||
+# library and then restarted via "run". The command below does roughly
|
|
||||||
+# the same thing. It's at this step that an internal error would
|
|
||||||
+# occur for PR28030. The "message" argument tells runto to turn on
|
|
||||||
+# the printing of PASSes while runto is doing its job.
|
|
||||||
+runto "bar" message
|
|
||||||
diff --git a/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h
|
|
||||||
new file mode 100644
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/gdb/testsuite/gdb.dwarf2/locexpr-data-member-location.h
|
|
||||||
@@ -0,0 +1,30 @@
|
|
||||||
+/* Copyright (C) 2021 Free Software Foundation, Inc.
|
|
||||||
+
|
|
||||||
+ This file is part of GDB.
|
|
||||||
+
|
|
||||||
+ 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/>. */
|
|
||||||
+
|
|
||||||
+typedef struct A {
|
|
||||||
+ long a;
|
|
||||||
+ long x;
|
|
||||||
+} A;
|
|
||||||
+
|
|
||||||
+typedef struct B {
|
|
||||||
+ A a;
|
|
||||||
+ long b;
|
|
||||||
+ long x2;
|
|
||||||
+} B;
|
|
||||||
+
|
|
||||||
+extern B *foo ();
|
|
||||||
+extern B *bar (B *v);
|
|
17
gdb.spec
17
gdb.spec
@ -29,15 +29,15 @@
|
|||||||
Name: %{?scl_prefix}gdb
|
Name: %{?scl_prefix}gdb
|
||||||
|
|
||||||
# Freeze it when GDB gets branched
|
# Freeze it when GDB gets branched
|
||||||
%global snapsrc 20200208
|
%global snapsrc 20220501
|
||||||
# See timestamp of source gnulib installed into gnulib/ .
|
# See timestamp of source gnulib installed into gnulib/ .
|
||||||
%global snapgnulib 20210105
|
%global snapgnulib 20210105
|
||||||
%global tarname gdb-%{version}
|
%global tarname gdb-%{version}
|
||||||
Version: 11.2
|
Version: 12.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: 3%{?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.
|
||||||
@ -934,7 +934,7 @@ touch -r %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit
|
|||||||
for i in `find $RPM_BUILD_ROOT%{_datadir}/gdb/python/gdb -name "*.py"`
|
for i in `find $RPM_BUILD_ROOT%{_datadir}/gdb/python/gdb -name "*.py"`
|
||||||
do
|
do
|
||||||
# Files could be also patched getting the current time.
|
# Files could be also patched getting the current time.
|
||||||
touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/ChangeLog $i
|
touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/version.in $i
|
||||||
done
|
done
|
||||||
|
|
||||||
%if 0%{?_enable_debug_packages:1} && 0%{!?_without_python:1}
|
%if 0%{?_enable_debug_packages:1} && 0%{!?_without_python:1}
|
||||||
@ -980,7 +980,7 @@ cp -a $RPM_BUILD_DIR/%{gdb_src}/%{libstdcxxpython}/libstdcxx \
|
|||||||
%endif # 0%{?rhel:1} && 0%{?rhel} <= 7
|
%endif # 0%{?rhel:1} && 0%{?rhel} <= 7
|
||||||
for i in `find $RPM_BUILD_ROOT%{_datadir}/gdb -name "*.py"`; do
|
for i in `find $RPM_BUILD_ROOT%{_datadir}/gdb -name "*.py"`; do
|
||||||
# Files are installed by install(1) not preserving the timestamps.
|
# Files are installed by install(1) not preserving the timestamps.
|
||||||
touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/ChangeLog $i
|
touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/version.in $i
|
||||||
done
|
done
|
||||||
%endif # 0%{!?_without_python:1}
|
%endif # 0%{!?_without_python:1}
|
||||||
|
|
||||||
@ -1026,6 +1026,7 @@ ln -s gstack $RPM_BUILD_ROOT%{_bindir}/pstack
|
|||||||
# Documentation only for development.
|
# Documentation only for development.
|
||||||
rm -f $RPM_BUILD_ROOT%{_infodir}/gdbint*
|
rm -f $RPM_BUILD_ROOT%{_infodir}/gdbint*
|
||||||
rm -f $RPM_BUILD_ROOT%{_infodir}/stabs*
|
rm -f $RPM_BUILD_ROOT%{_infodir}/stabs*
|
||||||
|
rm -f $RPM_BUILD_ROOT%{_infodir}/ctf-spec*
|
||||||
|
|
||||||
# Delete this too because the dir file will be updated at rpm install time.
|
# Delete this too because the dir file will be updated at rpm install time.
|
||||||
# We don't want a gdb specific one overwriting the system wide one.
|
# We don't want a gdb specific one overwriting the system wide one.
|
||||||
@ -1149,6 +1150,12 @@ fi
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu May 12 2022 Kevin Buettner - 12.1-1
|
||||||
|
- Rebase to FSF GDB 12.1.
|
||||||
|
- Update gdb-6.6-buildid-locate.patch.
|
||||||
|
- Update gdb-6.6-buildid-locate-rpm.patch.
|
||||||
|
- Dropped backported patches from GDB 11.1 and 11.2.
|
||||||
|
|
||||||
* Wed Mar 30 2022 Kevin Buettner - 11.2-3
|
* Wed Mar 30 2022 Kevin Buettner - 11.2-3
|
||||||
- Backport upstream patch which removes sizes from debuginfod download
|
- Backport upstream patch which removes sizes from debuginfod download
|
||||||
messages when the size is not available (RHBZ 2068280, Aaron Merey).
|
messages when the size is not available (RHBZ 2068280, Aaron Merey).
|
||||||
|
2
sources
2
sources
@ -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-11.2.tar.xz) = 07e9026423438049b11f4f784d57401ece4e940570f613bd6958b3714fe7fbc2c048470bcce3e7d7d9f93331cdf3881d30dcc964cb113a071143a02b28e5b127
|
SHA512 (gdb-12.1.tar.xz) = 425568d2e84672177d0fb87b1ad7daafdde097648d605e30cf0656970f66adc6a82ca2d83375ea4be583e9683a340e5bfdf5819668ddf66728200141ae50ff2d
|
||||||
|
Loading…
Reference in New Issue
Block a user