GUILE_CPPFLAGS
GUILD_TARGET_FLAG
GUILD
+pkg_config_prog_path
HAVE_PYTHON_FALSE
HAVE_PYTHON_TRUE
PYTHON_LIBS
REPORT_BUGS_TO
PKGVERSION
CODESIGN_CERT
-DEBUGINFOD_CFLAGS
-DEBUGINFOD_LIBS
-pkg_config_prog_path
+LIBDEBUGINFOD
HAVE_NATIVE_GCORE_TARGET
TARGET_OBS
subdirs
} # ac_fn_c_compute_int
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
+ac_fn_c_check_decl ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_decl
+
# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
} # ac_fn_c_check_type
-# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
-# ---------------------------------------------
-# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
-# accordingly.
-ac_fn_c_check_decl ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- as_decl_name=`echo $2|sed 's/ *(.*//'`
- as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
-$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-#ifndef $as_decl_name
-#ifdef __cplusplus
- (void) $as_decl_use;
-#else
- (void) $as_decl_name;
-#endif
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- eval "$3=yes"
-else
- eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_decl
-
# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
# ----------------------------------------------------
# Tries to find if the field MEMBER exists in type AGGR, after including
# Handle optional debuginfod support
+# Enable debuginfod
+
# Check whether --with-debuginfod was given.
if test "${with_debuginfod+set}" = set; then :
withval=$with_debuginfod;
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_debuginfod" >&5
$as_echo "$with_debuginfod" >&6; }
-if test "x$with_debuginfod" != xno; then
- # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_pkg_config_prog_path+:} false; then :
+if test "${with_debuginfod}" = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: debuginfod support disabled; some features may be unavailable." >&5
+$as_echo "$as_me: WARNING: debuginfod support disabled; some features may be unavailable." >&2;}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for debuginfod_begin in -ldebuginfod" >&5
+$as_echo_n "checking for debuginfod_begin in -ldebuginfod... " >&6; }
+if ${ac_cv_lib_debuginfod_debuginfod_begin+:} false; then :
$as_echo_n "(cached) " >&6
else
- case $pkg_config_prog_path in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_pkg_config_prog_path="$pkg_config_prog_path" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_pkg_config_prog_path="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldebuginfod $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
- test -z "$ac_cv_path_pkg_config_prog_path" && ac_cv_path_pkg_config_prog_path="missing"
- ;;
-esac
-fi
-pkg_config_prog_path=$ac_cv_path_pkg_config_prog_path
-if test -n "$pkg_config_prog_path"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pkg_config_prog_path" >&5
-$as_echo "$pkg_config_prog_path" >&6; }
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char debuginfod_begin ();
+int
+main ()
+{
+return debuginfod_begin ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_debuginfod_debuginfod_begin=yes
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ ac_cv_lib_debuginfod_debuginfod_begin=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_debuginfod_debuginfod_begin" >&5
+$as_echo "$ac_cv_lib_debuginfod_debuginfod_begin" >&6; }
+if test "x$ac_cv_lib_debuginfod_debuginfod_begin" = xyes; then :
+ have_debuginfod_lib=yes
fi
+ ac_fn_c_check_decl "$LINENO" "debuginfod_begin" "ac_cv_have_decl_debuginfod_begin" "#include <elfutils/debuginfod.h>
+"
+if test "x$ac_cv_have_decl_debuginfod_begin" = xyes; then :
+ have_debuginfod_h=yes
+fi
- if test "${pkg_config_prog_path}" != "missing"; then
- ${pkg_config_prog_path} --exists --atleast-version=0.178 libdebuginfod
- if test $? = 0; then
- DEBUGINFOD_LIBS=`${pkg_config_prog_path} --libs libdebuginfod`
-
- DEBUGINFOD_CFLAGS=`${pkg_config_prog_path} --cflags libdebuginfod`
-
+ if test "x$have_debuginfod_lib" = "xyes" -a \
+ "x$have_debuginfod_h" = "xyes"; then
$as_echo "#define HAVE_LIBDEBUGINFOD 1" >>confdefs.h
- else
- if test "x$with_debuginfod" = xyes; then
- as_fn_error $? "\"--with-debuginfod was given, but libdebuginfod is missing or unusable.\"" "$LINENO" 5
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libdebuginfod is missing or unusable; some features may be unavailable." >&5
-$as_echo "$as_me: WARNING: libdebuginfod is missing or unusable; some features may be unavailable." >&2;}
- fi
- fi
+ LIBDEBUGINFOD="-ldebuginfod"
+
else
- if test "x$with_debuginfod" = xyes; then
- as_fn_error $? "--with-debuginfod was given, but pkg-config missing or unusable; cannot find libdebuginfod" "$LINENO" 5
+
+ if test "$with_debuginfod" = yes; then
+ as_fn_error $? "debuginfod is missing or unusable" "$LINENO" 5
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config missing or unusable; debuginfod support disabled." >&5
-$as_echo "$as_me: WARNING: pkg-config missing or unusable; debuginfod support disabled." >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: debuginfod is missing or unusable; some features may be unavailable." >&5
+$as_echo "$as_me: WARNING: debuginfod is missing or unusable; some features may be unavailable." >&2;}
fi
fi
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: debuginfod support disabled; some features may be unavailable." >&5
-$as_echo "$as_me: WARNING: debuginfod support disabled; some features may be unavailable." >&2;}
fi
+
# Libunwind support for ia64.
# Check whether --with-libunwind-ia64 was given.
dnl Process this file with autoconf to produce a configure script.
+m4_include(../config/debuginfod.m4)
+
AC_INIT(main.c)
AC_CONFIG_HEADERS(config.h:config.in, [echo > stamp-h])
AM_MAINTAINER_MODE
esac
# Handle optional debuginfod support
-AC_ARG_WITH([debuginfod],
- AC_HELP_STRING([--with-debuginfod], [Enable debuginfo lookups with debuginfod (auto/yes/no)]),
- [], [with_debuginfod=auto])
-AC_MSG_CHECKING([whether to use debuginfod])
-AC_MSG_RESULT([$with_debuginfod])
-
-if test "x$with_debuginfod" != xno; then
- AC_PATH_PROG(pkg_config_prog_path, pkg-config, missing)
- if test "${pkg_config_prog_path}" != "missing"; then
- ${pkg_config_prog_path} --exists --atleast-version=0.178 libdebuginfod
- if test $? = 0; then
- AC_SUBST([DEBUGINFOD_LIBS], [`${pkg_config_prog_path} --libs libdebuginfod`])
- AC_SUBST([DEBUGINFOD_CFLAGS], [`${pkg_config_prog_path} --cflags libdebuginfod`])
- AC_DEFINE([HAVE_LIBDEBUGINFOD], [1], [Define to 1 if debuginfod is enabled.])
- else
- if test "x$with_debuginfod" = xyes; then
- AC_MSG_ERROR(["--with-debuginfod was given, but libdebuginfod is missing or unusable."])
- else
- AC_MSG_WARN([libdebuginfod is missing or unusable; some features may be unavailable.])
- fi
- fi
- else
- if test "x$with_debuginfod" = xyes; then
- AC_MSG_ERROR([--with-debuginfod was given, but pkg-config missing or unusable; cannot find libdebuginfod])
- else
- AC_MSG_WARN([pkg-config missing or unusable; debuginfod support disabled.])
- fi
- fi
-else
- AC_MSG_WARN([debuginfod support disabled; some features may be unavailable.])
-fi
+AC_DEBUGINFOD
# Libunwind support for ia64.
AC_ARG_WITH(libunwind-ia64,
#else
#include <elfutils/debuginfod.h>
+/* TODO: Use debuginfod API extensions to print filename from progressfn. */
+static const char *fname;
+static bool has_printed;
+
static int
progressfn (debuginfod_client *c, long cur, long total)
{
if (check_quit_flag ())
{
- printf_filtered ("Cancelling download...\n");
+ printf_filtered ("Cancelling download of %ps...\n",
+ styled_string (file_name_style.style (), fname));
return 1;
}
+ if (!has_printed)
+ {
+ /* Print this message only once. */
+ has_printed = true;
+ printf_unfiltered ("Debuginfod downloading %ps...\n",
+ styled_string (file_name_style.style (), fname));
+ }
+
return 0;
}
const char *srcpath,
gdb::unique_xmalloc_ptr<char> *destname)
{
+ if (getenv (DEBUGINFOD_URLS_ENV_VAR) == NULL)
+ return scoped_fd (-ENOSYS);
+
debuginfod_client *c = debuginfod_init ();
if (c == nullptr)
return scoped_fd (-ENOMEM);
- printf_filtered (_("Debuginfod fetching source file %ps...\n"),
- styled_string (file_name_style.style (), srcpath));
+ fname = srcpath;
+ has_printed = false;
scoped_fd fd (debuginfod_find_source (c,
build_id,
srcpath,
nullptr));
- if (fd.get () < 0)
+ /* TODO: Add 'set debug debuginfod' command to control when error messages are shown. */
+ if (fd.get () < 0 && fd.get () != -ENOENT)
{
- printf_filtered (_("Download failed. Continuing without source file %ps.\n"),
- styled_string (file_name_style.style (), srcpath));
+ printf_filtered (_("Download failed: %s. Continuing without source file %ps.\n"),
+ strerror (-fd.get ()),
+ styled_string (file_name_style.style (), srcpath));
}
else
destname->reset (xstrdup (srcpath));
const char *filename,
gdb::unique_xmalloc_ptr<char> *destname)
{
+ if (getenv (DEBUGINFOD_URLS_ENV_VAR) == NULL)
+ return scoped_fd (-ENOSYS);
+
debuginfod_client *c = debuginfod_init ();
if (c == nullptr)
return scoped_fd (-ENOMEM);
- printf_filtered (_("Debuginfod fetching debug info for %ps...\n"),
- styled_string (file_name_style.style (), filename));
-
+ fname = filename;
+ has_printed = false;
char *dname = nullptr;
+
scoped_fd fd (debuginfod_find_debuginfo (c, build_id, build_id_len, &dname));
- if (fd.get () < 0)
- printf_filtered (_("Download failed. Continuing without debug info for %ps.\n"),
+ if (fd.get () < 0 && fd.get () != -ENOENT)
+ printf_filtered (_("Download failed: %s. Continuing without debug info for %ps.\n"),
+ strerror (-fd.get ()),
styled_string (file_name_style.style (), filename));
destname->reset (dname);