public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Aaron Merey <amerey@redhat.com>
To: gdb-patches@sourceware.org, binutils@sourceware.org
Cc: aburgess@redhat.com, Aaron Merey <amerey@redhat.com>
Subject: [PATCH 1/7] config/debuginfod.m4: Add check for libdebuginfod 0.188
Date: Wed, 16 Aug 2023 00:42:52 -0400	[thread overview]
Message-ID: <20230816044259.2675531-2-amerey@redhat.com> (raw)
In-Reply-To: <20230816044259.2675531-1-amerey@redhat.com>

Add check for libdebuginfod 0.188 in AC_DEBUGINFOD and if found
define macro HAVE_LIBDEBUGINFOD_FIND_SECTION.

This macro indicates support for downloading ELF sections from
debuginfod servers.
---
 binutils/config.in   |   3 ++
 binutils/configure   | 108 ++++++++++++++++++++++++++++++++++++++++++-
 config/debuginfod.m4 |  13 +++++-
 gdb/config.in        |   3 ++
 gdb/configure        | 108 ++++++++++++++++++++++++++++++++++++++++++-
 5 files changed, 232 insertions(+), 3 deletions(-)

diff --git a/binutils/config.in b/binutils/config.in
index 91fe00af777..8907a56fc15 100644
--- a/binutils/config.in
+++ b/binutils/config.in
@@ -94,6 +94,9 @@
 /* Define to 1 if debuginfod is enabled. */
 #undef HAVE_LIBDEBUGINFOD
 
+/* Define to 1 if debuginfod section downloading is supported. */
+#undef HAVE_LIBDEBUGINFOD_FIND_SECTION
+
 /* Define if mbstate_t exists in wchar.h. */
 #undef HAVE_MBSTATE_T
 
diff --git a/binutils/configure b/binutils/configure
index 101671411a5..7806ff2a0b3 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -11809,7 +11809,13 @@ $as_echo "no" >&6; }
 	fi
 fi
 
-# Handle optional debuginfod support
+# Handle optional debuginfod support as well as optional section
+# downloading support.
+#
+# Define HAVE_LIBDEBUGINFOD if libdebuginfod is found with version >= 0.179.
+#
+# Define HAVE_LIBDEBUGINFOD_FIND_SECTION if libdebuginfod is found with
+# version >= 0.188.
 
 # Check whether --with-debuginfod was given.
 if test "${with_debuginfod+set}" = set; then :
@@ -11825,6 +11831,106 @@ $as_echo "$with_debuginfod" >&6; }
 
 if test "x$with_debuginfod" != xno; then
 
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdebuginfod >= 0.188" >&5
+$as_echo_n "checking for libdebuginfod >= 0.188... " >&6; }
+
+if test -n "$DEBUGINFOD_CFLAGS"; then
+    pkg_cv_DEBUGINFOD_CFLAGS="$DEBUGINFOD_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdebuginfod >= 0.188\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libdebuginfod >= 0.188") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DEBUGINFOD_CFLAGS=`$PKG_CONFIG --cflags "libdebuginfod >= 0.188" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$DEBUGINFOD_LIBS"; then
+    pkg_cv_DEBUGINFOD_LIBS="$DEBUGINFOD_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdebuginfod >= 0.188\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libdebuginfod >= 0.188") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DEBUGINFOD_LIBS=`$PKG_CONFIG --libs "libdebuginfod >= 0.188" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+if test $pkg_failed = no; then
+  pkg_save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS $pkg_cv_DEBUGINFOD_LIBS"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+else
+  pkg_failed=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  LDFLAGS=$pkg_save_LDFLAGS
+fi
+
+
+
+if test $pkg_failed = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        DEBUGINFOD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libdebuginfod >= 0.188" 2>&1`
+        else
+	        DEBUGINFOD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libdebuginfod >= 0.188" 2>&1`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$DEBUGINFOD_PKG_ERRORS" >&5
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libdebuginfod is missing or some features may be unavailable." >&5
+$as_echo "$as_me: WARNING: libdebuginfod is missing or some features may be unavailable." >&2;}
+elif test $pkg_failed = untried; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libdebuginfod is missing or some features may be unavailable." >&5
+$as_echo "$as_me: WARNING: libdebuginfod is missing or some features may be unavailable." >&2;}
+else
+	DEBUGINFOD_CFLAGS=$pkg_cv_DEBUGINFOD_CFLAGS
+	DEBUGINFOD_LIBS=$pkg_cv_DEBUGINFOD_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_LIBDEBUGINFOD_FIND_SECTION 1" >>confdefs.h
+
+fi
+
+
 pkg_failed=no
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdebuginfod >= 0.179" >&5
 $as_echo_n "checking for libdebuginfod >= 0.179... " >&6; }
diff --git a/config/debuginfod.m4 b/config/debuginfod.m4
index 2c1bfbdb544..c5077acb4c3 100644
--- a/config/debuginfod.m4
+++ b/config/debuginfod.m4
@@ -7,7 +7,13 @@ dnl the same distribution terms as the rest of that program.
 
 AC_DEFUN([AC_DEBUGINFOD],
 [
-# Handle optional debuginfod support
+# Handle optional debuginfod support as well as optional section
+# downloading support.
+#
+# Define HAVE_LIBDEBUGINFOD if libdebuginfod is found with version >= 0.179.
+#
+# Define HAVE_LIBDEBUGINFOD_FIND_SECTION if libdebuginfod is found with
+# version >= 0.188.
 AC_ARG_WITH([debuginfod],
   AC_HELP_STRING([--with-debuginfod], [Enable debuginfo lookups with debuginfod (auto/yes/no)]),
   [], [with_debuginfod=auto])
@@ -15,6 +21,11 @@ AC_MSG_CHECKING([whether to use debuginfod])
 AC_MSG_RESULT([$with_debuginfod])
 
 if test "x$with_debuginfod" != xno; then
+  PKG_CHECK_MODULES([DEBUGINFOD], [libdebuginfod >= 0.188],
+    [AC_DEFINE([HAVE_LIBDEBUGINFOD_FIND_SECTION], [1],
+               [Define to 1 if debuginfod section downloading is supported.])],
+    [AC_MSG_WARN([libdebuginfod is missing or some features may be unavailable.])])
+
   PKG_CHECK_MODULES([DEBUGINFOD], [libdebuginfod >= 0.179],
     [AC_DEFINE([HAVE_LIBDEBUGINFOD], [1], [Define to 1 if debuginfod is enabled.])],
     [if test "x$with_debuginfod" = xyes; then
diff --git a/gdb/config.in b/gdb/config.in
index bc562669d2c..f67d3029d82 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -244,6 +244,9 @@
 /* Define to 1 if debuginfod is enabled. */
 #undef HAVE_LIBDEBUGINFOD
 
+/* Define to 1 if debuginfod section downloading is supported. */
+#undef HAVE_LIBDEBUGINFOD_FIND_SECTION
+
 /* Define if you have the expat library. */
 #undef HAVE_LIBEXPAT
 
diff --git a/gdb/configure b/gdb/configure
index ab1a299d860..2d07e0cb596 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -18405,7 +18405,13 @@ esac
 
 # Handle optional debuginfod support
 
-# Handle optional debuginfod support
+# Handle optional debuginfod support as well as optional section
+# downloading support.
+#
+# Define HAVE_LIBDEBUGINFOD if libdebuginfod is found with version >= 0.179.
+#
+# Define HAVE_LIBDEBUGINFOD_FIND_SECTION if libdebuginfod is found with
+# version >= 0.188.
 
 # Check whether --with-debuginfod was given.
 if test "${with_debuginfod+set}" = set; then :
@@ -18421,6 +18427,106 @@ $as_echo "$with_debuginfod" >&6; }
 
 if test "x$with_debuginfod" != xno; then
 
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdebuginfod >= 0.188" >&5
+$as_echo_n "checking for libdebuginfod >= 0.188... " >&6; }
+
+if test -n "$DEBUGINFOD_CFLAGS"; then
+    pkg_cv_DEBUGINFOD_CFLAGS="$DEBUGINFOD_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdebuginfod >= 0.188\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libdebuginfod >= 0.188") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DEBUGINFOD_CFLAGS=`$PKG_CONFIG --cflags "libdebuginfod >= 0.188" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$DEBUGINFOD_LIBS"; then
+    pkg_cv_DEBUGINFOD_LIBS="$DEBUGINFOD_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdebuginfod >= 0.188\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libdebuginfod >= 0.188") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DEBUGINFOD_LIBS=`$PKG_CONFIG --libs "libdebuginfod >= 0.188" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+if test $pkg_failed = no; then
+  pkg_save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS $pkg_cv_DEBUGINFOD_LIBS"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+else
+  pkg_failed=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  LDFLAGS=$pkg_save_LDFLAGS
+fi
+
+
+
+if test $pkg_failed = yes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        DEBUGINFOD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libdebuginfod >= 0.188" 2>&1`
+        else
+	        DEBUGINFOD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libdebuginfod >= 0.188" 2>&1`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$DEBUGINFOD_PKG_ERRORS" >&5
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libdebuginfod is missing or some features may be unavailable." >&5
+$as_echo "$as_me: WARNING: libdebuginfod is missing or some features may be unavailable." >&2;}
+elif test $pkg_failed = untried; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libdebuginfod is missing or some features may be unavailable." >&5
+$as_echo "$as_me: WARNING: libdebuginfod is missing or some features may be unavailable." >&2;}
+else
+	DEBUGINFOD_CFLAGS=$pkg_cv_DEBUGINFOD_CFLAGS
+	DEBUGINFOD_LIBS=$pkg_cv_DEBUGINFOD_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_LIBDEBUGINFOD_FIND_SECTION 1" >>confdefs.h
+
+fi
+
+
 pkg_failed=no
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdebuginfod >= 0.179" >&5
 $as_echo_n "checking for libdebuginfod >= 0.179... " >&6; }
-- 
2.41.0


  reply	other threads:[~2023-08-16  4:43 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16  4:42 [PATCH 0/7] gdb/debuginfod: Add on-demand debuginfo downloading Aaron Merey
2023-08-16  4:42 ` Aaron Merey [this message]
2023-09-19 14:33   ` [PATCH 1/7] config/debuginfod.m4: Add check for libdebuginfod 0.188 Aaron Merey
2023-09-27 10:28     ` Nick Clifton
2023-09-27 19:14       ` Aaron Merey
2023-08-16  4:42 ` [PATCH 2/7 v3] gdb/debuginfod: Add debuginfod_section_query Aaron Merey
2023-09-19 14:33   ` Aaron Merey
2023-09-28 18:28   ` Andrew Burgess
2023-10-02 18:07     ` Aaron Merey
2023-08-16  4:42 ` [PATCH 3/7 v3] gdb: Add command 'maint set/show debuginfod download-sections' Aaron Merey
2023-08-16 12:45   ` Eli Zaretskii
2023-09-19 14:34     ` Aaron Merey
2023-09-28 18:32   ` Andrew Burgess
2023-10-02 18:08     ` Aaron Merey
2023-08-16  4:42 ` [PATCH 4/7 v5] gdb: Buffer output streams during events that might download debuginfo Aaron Merey
2023-09-19 14:34   ` Aaron Merey
2023-10-10 21:55   ` [PATCH v6] " Aaron Merey
2023-10-24 11:22     ` Andrew Burgess
2023-10-28  0:25       ` Aaron Merey
2023-08-16  4:42 ` [PATCH 5/7 v2] gdb/progspace: Add reverse safe iterator and template for unwrapping iterator Aaron Merey
2023-09-19 14:35   ` Aaron Merey
2023-10-10 21:56     ` [PING*2][PATCH " Aaron Merey
2023-08-16  4:42 ` [PATCH 6/7 v4] gdb/debuginfod: Support on-demand debuginfo downloading Aaron Merey
2023-09-19 14:35   ` Aaron Merey
2023-10-10 21:57     ` [PING*2][PATCH " Aaron Merey
2023-08-16  4:42 ` [PATCH 7/7 v4] gdb/debuginfod: Add .debug_line downloading Aaron Merey
2023-09-19 14:35   ` Aaron Merey
2023-10-10 21:58     ` [PING*2][PATCH " Aaron Merey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230816044259.2675531-2-amerey@redhat.com \
    --to=amerey@redhat.com \
    --cc=aburgess@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).