reduce debuginfod-related chatter

This commit is contained in:
Aaron Merey
2020-02-25 15:12:16 -05:00
parent 3e7611cfe2
commit 02b0255c7d
4 changed files with 141 additions and 151 deletions

View File

@@ -591,8 +591,7 @@ INTERNAL_CFLAGS_BASE = \
$(GDB_CFLAGS) $(OPCODES_CFLAGS) $(READLINE_CFLAGS) $(ZLIBINC) \ $(GDB_CFLAGS) $(OPCODES_CFLAGS) $(READLINE_CFLAGS) $(ZLIBINC) \
$(BFD_CFLAGS) $(INCLUDE_CFLAGS) $(LIBDECNUMBER_CFLAGS) \ $(BFD_CFLAGS) $(INCLUDE_CFLAGS) $(LIBDECNUMBER_CFLAGS) \
$(INTL_CFLAGS) $(INCGNU) $(INCSUPPORT) $(ENABLE_CFLAGS) \ $(INTL_CFLAGS) $(INCGNU) $(INCSUPPORT) $(ENABLE_CFLAGS) \
$(INTERNAL_CPPFLAGS) $(SRCHIGH_CFLAGS) $(TOP_CFLAGS) $(PTHREAD_CFLAGS) \ $(INTERNAL_CPPFLAGS) $(SRCHIGH_CFLAGS) $(TOP_CFLAGS) $(PTHREAD_CFLAGS)
@DEBUGINFOD_CFLAGS@
INTERNAL_WARN_CFLAGS = $(INTERNAL_CFLAGS_BASE) $(GDB_WARN_CFLAGS) INTERNAL_WARN_CFLAGS = $(INTERNAL_CFLAGS_BASE) $(GDB_WARN_CFLAGS)
INTERNAL_CFLAGS = $(INTERNAL_WARN_CFLAGS) $(GDB_WERROR_CFLAGS) INTERNAL_CFLAGS = $(INTERNAL_WARN_CFLAGS) $(GDB_WERROR_CFLAGS)
@@ -618,7 +617,7 @@ CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(LIBCTF) $(ZLIB) \
$(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) $(LIBIPT) \ $(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) $(LIBIPT) \
$(WIN32LIBS) $(LIBGNU) $(LIBICONV) \ $(WIN32LIBS) $(LIBGNU) $(LIBICONV) \
$(LIBMPFR) $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS) \ $(LIBMPFR) $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS) \
@DEBUGINFOD_LIBS@ @LIBDEBUGINFOD@
CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) $(LIBCTF) \ CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) $(LIBCTF) \
$(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) \ $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) \
$(LIBSUPPORT) $(LIBSUPPORT)

209
gdb/configure vendored
View File

@@ -719,6 +719,7 @@ GUILE_LIBS
GUILE_CPPFLAGS GUILE_CPPFLAGS
GUILD_TARGET_FLAG GUILD_TARGET_FLAG
GUILD GUILD
pkg_config_prog_path
HAVE_PYTHON_FALSE HAVE_PYTHON_FALSE
HAVE_PYTHON_TRUE HAVE_PYTHON_TRUE
PYTHON_LIBS PYTHON_LIBS
@@ -757,9 +758,7 @@ REPORT_BUGS_TEXI
REPORT_BUGS_TO REPORT_BUGS_TO
PKGVERSION PKGVERSION
CODESIGN_CERT CODESIGN_CERT
DEBUGINFOD_CFLAGS LIBDEBUGINFOD
DEBUGINFOD_LIBS
pkg_config_prog_path
HAVE_NATIVE_GCORE_TARGET HAVE_NATIVE_GCORE_TARGET
TARGET_OBS TARGET_OBS
subdirs subdirs
@@ -2256,6 +2255,52 @@ rm -f conftest.val
} # ac_fn_c_compute_int } # 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 # ac_fn_c_check_func LINENO FUNC VAR
# ---------------------------------- # ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly # Tests whether FUNC exists, setting the cache variable VAR accordingly
@@ -2377,52 +2422,6 @@ $as_echo "$ac_res" >&6; }
} # ac_fn_c_check_type } # 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 # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
# ---------------------------------------------------- # ----------------------------------------------------
# Tries to find if the field MEMBER exists in type AGGR, after including # Tries to find if the field MEMBER exists in type AGGR, after including
@@ -6831,6 +6830,8 @@ esac
# Handle optional debuginfod support # Handle optional debuginfod support
# Enable debuginfod
# Check whether --with-debuginfod was given. # Check whether --with-debuginfod was given.
if test "${with_debuginfod+set}" = set; then : if test "${with_debuginfod+set}" = set; then :
withval=$with_debuginfod; withval=$with_debuginfod;
@@ -6843,79 +6844,75 @@ $as_echo_n "checking whether to use debuginfod... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_debuginfod" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_debuginfod" >&5
$as_echo "$with_debuginfod" >&6; } $as_echo "$with_debuginfod" >&6; }
if test "x$with_debuginfod" != xno; then if test "${with_debuginfod}" = no; then
# Extract the first word of "pkg-config", so it can be a program name with args. { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: debuginfod support disabled; some features may be unavailable." >&5
set dummy pkg-config; ac_word=$2 $as_echo "$as_me: WARNING: debuginfod support disabled; some features may be unavailable." >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 else
$as_echo_n "checking for $ac_word... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for debuginfod_begin in -ldebuginfod" >&5
if ${ac_cv_path_pkg_config_prog_path+:} false; then : $as_echo_n "checking for debuginfod_begin in -ldebuginfod... " >&6; }
if ${ac_cv_lib_debuginfod_debuginfod_begin+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
case $pkg_config_prog_path in ac_check_lib_save_LIBS=$LIBS
[\\/]* | ?:[\\/]*) LIBS="-ldebuginfod $LIBS"
ac_cv_path_pkg_config_prog_path="$pkg_config_prog_path" # Let the user override the test with a path. cat confdefs.h - <<_ACEOF >conftest.$ac_ext
;; /* end confdefs.h. */
*)
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
test -z "$ac_cv_path_pkg_config_prog_path" && ac_cv_path_pkg_config_prog_path="missing" /* Override any GCC internal prototype to avoid an error.
;; Use char because int might match the return type of a GCC
esac builtin and then its argument prototype would still apply. */
fi #ifdef __cplusplus
pkg_config_prog_path=$ac_cv_path_pkg_config_prog_path extern "C"
if test -n "$pkg_config_prog_path"; then #endif
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pkg_config_prog_path" >&5 char debuginfod_begin ();
$as_echo "$pkg_config_prog_path" >&6; } int
main ()
{
return debuginfod_begin ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_debuginfod_debuginfod_begin=yes
else else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ac_cv_lib_debuginfod_debuginfod_begin=no
$as_echo "no" >&6; } 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 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 if test "x$have_debuginfod_lib" = "xyes" -a \
${pkg_config_prog_path} --exists --atleast-version=0.178 libdebuginfod "x$have_debuginfod_h" = "xyes"; then
if test $? = 0; then
DEBUGINFOD_LIBS=`${pkg_config_prog_path} --libs libdebuginfod`
DEBUGINFOD_CFLAGS=`${pkg_config_prog_path} --cflags libdebuginfod`
$as_echo "#define HAVE_LIBDEBUGINFOD 1" >>confdefs.h $as_echo "#define HAVE_LIBDEBUGINFOD 1" >>confdefs.h
else LIBDEBUGINFOD="-ldebuginfod"
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
else 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 else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config missing or unusable; debuginfod support disabled." >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: debuginfod is missing or unusable; some features may be unavailable." >&5
$as_echo "$as_me: WARNING: pkg-config missing or unusable; debuginfod support disabled." >&2;} $as_echo "$as_me: WARNING: debuginfod is missing or unusable; some features may be unavailable." >&2;}
fi fi
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 fi
# Libunwind support for ia64. # Libunwind support for ia64.
# Check whether --with-libunwind-ia64 was given. # Check whether --with-libunwind-ia64 was given.

View File

@@ -18,6 +18,8 @@ dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
m4_include(../config/debuginfod.m4)
AC_INIT(main.c) AC_INIT(main.c)
AC_CONFIG_HEADERS(config.h:config.in, [echo > stamp-h]) AC_CONFIG_HEADERS(config.h:config.in, [echo > stamp-h])
AM_MAINTAINER_MODE AM_MAINTAINER_MODE
@@ -324,37 +326,7 @@ case $host_os in
esac esac
# Handle optional debuginfod support # Handle optional debuginfod support
AC_ARG_WITH([debuginfod], AC_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
# Libunwind support for ia64. # Libunwind support for ia64.
AC_ARG_WITH(libunwind-ia64, AC_ARG_WITH(libunwind-ia64,

View File

@@ -43,15 +43,28 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
#else #else
#include <elfutils/debuginfod.h> #include <elfutils/debuginfod.h>
/* TODO: Use debuginfod API extensions to print filename from progressfn. */
static const char *fname;
static bool has_printed;
static int static int
progressfn (debuginfod_client *c, long cur, long total) progressfn (debuginfod_client *c, long cur, long total)
{ {
if (check_quit_flag ()) 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; 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; return 0;
} }
@@ -74,13 +87,16 @@ debuginfod_source_query (const unsigned char *build_id,
const char *srcpath, const char *srcpath,
gdb::unique_xmalloc_ptr<char> *destname) gdb::unique_xmalloc_ptr<char> *destname)
{ {
if (getenv (DEBUGINFOD_URLS_ENV_VAR) == NULL)
return scoped_fd (-ENOSYS);
debuginfod_client *c = debuginfod_init (); debuginfod_client *c = debuginfod_init ();
if (c == nullptr) if (c == nullptr)
return scoped_fd (-ENOMEM); return scoped_fd (-ENOMEM);
printf_filtered (_("Debuginfod fetching source file %ps...\n"), fname = srcpath;
styled_string (file_name_style.style (), srcpath)); has_printed = false;
scoped_fd fd (debuginfod_find_source (c, scoped_fd fd (debuginfod_find_source (c,
build_id, build_id,
@@ -88,10 +104,12 @@ debuginfod_source_query (const unsigned char *build_id,
srcpath, srcpath,
nullptr)); 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"), printf_filtered (_("Download failed: %s. Continuing without source file %ps.\n"),
styled_string (file_name_style.style (), srcpath)); strerror (-fd.get ()),
styled_string (file_name_style.style (), srcpath));
} }
else else
destname->reset (xstrdup (srcpath)); destname->reset (xstrdup (srcpath));
@@ -108,19 +126,23 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
const char *filename, const char *filename,
gdb::unique_xmalloc_ptr<char> *destname) gdb::unique_xmalloc_ptr<char> *destname)
{ {
if (getenv (DEBUGINFOD_URLS_ENV_VAR) == NULL)
return scoped_fd (-ENOSYS);
debuginfod_client *c = debuginfod_init (); debuginfod_client *c = debuginfod_init ();
if (c == nullptr) if (c == nullptr)
return scoped_fd (-ENOMEM); return scoped_fd (-ENOMEM);
printf_filtered (_("Debuginfod fetching debug info for %ps...\n"), fname = filename;
styled_string (file_name_style.style (), filename)); has_printed = false;
char *dname = nullptr; char *dname = nullptr;
scoped_fd fd (debuginfod_find_debuginfo (c, build_id, build_id_len, &dname)); scoped_fd fd (debuginfod_find_debuginfo (c, build_id, build_id_len, &dname));
if (fd.get () < 0) if (fd.get () < 0 && fd.get () != -ENOENT)
printf_filtered (_("Download failed. Continuing without debug info for %ps.\n"), printf_filtered (_("Download failed: %s. Continuing without debug info for %ps.\n"),
strerror (-fd.get ()),
styled_string (file_name_style.style (), filename)); styled_string (file_name_style.style (), filename));
destname->reset (dname); destname->reset (dname);