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

209
gdb/configure vendored
View File

@@ -719,6 +719,7 @@ GUILE_LIBS
GUILE_CPPFLAGS
GUILD_TARGET_FLAG
GUILD
pkg_config_prog_path
HAVE_PYTHON_FALSE
HAVE_PYTHON_TRUE
PYTHON_LIBS
@@ -757,9 +758,7 @@ REPORT_BUGS_TEXI
REPORT_BUGS_TO
PKGVERSION
CODESIGN_CERT
DEBUGINFOD_CFLAGS
DEBUGINFOD_LIBS
pkg_config_prog_path
LIBDEBUGINFOD
HAVE_NATIVE_GCORE_TARGET
TARGET_OBS
subdirs
@@ -2256,6 +2255,52 @@ rm -f conftest.val
} # 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
@@ -2377,52 +2422,6 @@ $as_echo "$ac_res" >&6; }
} # 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
@@ -6831,6 +6830,8 @@ esac
# Handle optional debuginfod support
# Enable debuginfod
# Check whether --with-debuginfod was given.
if test "${with_debuginfod+set}" = set; then :
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 "$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
LIBDEBUGINFOD="-ldebuginfod"
else
if test "x$with_debuginfod" = xyes; then
as_fn_error $? "\"--with-debuginfod was given, but libdebuginfod is missing or unusable.\"" "$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: 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;}
{ $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
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
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;}
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.

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.
m4_include(../config/debuginfod.m4)
AC_INIT(main.c)
AC_CONFIG_HEADERS(config.h:config.in, [echo > stamp-h])
AM_MAINTAINER_MODE
@@ -324,37 +326,7 @@ case $host_os in
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,

View File

@@ -43,15 +43,28 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
#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;
}
@@ -74,13 +87,16 @@ debuginfod_source_query (const unsigned char *build_id,
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,
@@ -88,9 +104,11 @@ debuginfod_source_query (const unsigned char *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"),
printf_filtered (_("Download failed: %s. Continuing without source file %ps.\n"),
strerror (-fd.get ()),
styled_string (file_name_style.style (), srcpath));
}
else
@@ -108,19 +126,23 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
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);