* srcfiles.cxx: Introduce new --zip option that places all the
source files associated with a specified dwarf/elf file
into a zip file and sends it to stdout. Files may be
fetched from debuginfod (if applicable) or locally as
a backup.
Added -b option to disable the backup of checking
for files locally in -z mode.
* run-srcfiles-self.sh: Added test-case for the new zip
feature that archives the source files of the srcfiles
tool and checks archive integrity. An additional test
ensures that if debuginfod is enabled, the files are
fetched and archived properly while maintaing integrity.
* debuginfod-subr.sh: On very slow/remote storage, it can
take O(minute) to finish indexing the entire elfutils
build tree, so a wait_ready4 shell function is one
way to let a longer debuginfod wait operation work.
* srcfiles.1, NEWS: Added documentation for the new zip feature.
* configure.ac: Simplify check for libarchive for srcfiles.cxx
by integrating it into the same check for debuginfod.
* Makefile.am: build with local copy of debuginfod-client.
Example:
% ./src/srcfiles -z -e /bin/ls > output.zip
https://sourceware.org/bugzilla/show_bug.cgi?id=30991
Signed-off-by: Housam Alamour
---
NEWS | 8 +
configure.ac | 5 +-
debuginfod/debuginfod.cxx | 2 -
doc/srcfiles.1 | 33 +++-
src/Makefile.am| 9 +-
src/srcfiles.cxx | 305 +
tests/debuginfod-subr.sh | 14 +-
tests/run-srcfiles-self.sh | 74 -
8 files changed, 400 insertions(+), 50 deletions(-)
diff --git a/NEWS b/NEWS
index 0420d3b8..3391d6a1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+Version 0.191 (after 0.189)
+
+srcfiles: Can now fetch the source files of a DWARF/ELF file and
+ place them into a zip.
+
Version 0.190 "Woke!"
CONTRIBUTING: Switch from real name policy to known identity policy.
@@ -9,6 +14,9 @@ libelf: Add RELR support.
libdw: Recognize .debug_[ct]u_index sections
+srcfiles: added srcfiles tool that lists all the source files of a given
+ DWARF/ELF file.
+
readelf: Support readelf -Ds, --use-dynamic --symbol.
Support .gdb_index version 9
diff --git a/configure.ac b/configure.ac
index af5b6bf7..ddb79b83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -841,7 +841,7 @@ AM_CONDITIONAL([LIBDEBUGINFOD],[test
"x$enable_libdebuginfod" = "xyes" || test "
AM_CONDITIONAL([DUMMY_LIBDEBUGINFOD],[test "x$enable_libdebuginfod" =
"xdummy"])
AC_CHECK_HEADERS([execinfo.h])
-# Look for libmicrohttpd, libarchive, sqlite for debuginfo server
+# Look for libmicrohttpd, libarchive, sqlite for debuginfo server and srcfiles
tool
# minimum versions as per rhel7.
AC_ARG_ENABLE([debuginfod],AS_HELP_STRING([--enable-debuginfod], [Build
debuginfod server]))
AS_IF([test "x$enable_debuginfod" != "xno"], [
@@ -853,11 +853,12 @@ AS_IF([test "x$enable_debuginfod" != "xno"], [
AC_MSG_ERROR([need libdebuginfod (or dummy), use --disable-debuginfod to
disable.])
fi
enable_debuginfod=yes # presume success
+AC_DEFINE([HAVE_LIBARCHIVE], [1], [Define to 1 if libarchive is
available]) # presume success
PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES([libmicrohttpd],[libmicrohttpd >=
0.9.33],[],[enable_debuginfod=no])
PKG_CHECK_MODULES([oldlibmicrohttpd],[libmicrohttpd <
0.9.51],[old_libmicrohttpd=yes],[old_libmicrohttpd=no])
PKG_CHECK_MODULES([sqlite3],[sqlite3 >= 3.7.17],[],[enable_debuginfod=no])
-PKG_CHECK_MODULES([libarchive],[libarchive >=
3.1.2],[],[enable_debuginfod=no])
+PKG_CHECK_MODULES([libarchive],[libarchive >=
3.1.2],[],[enable_debuginfod=no], AC_DEFINE([HAVE_LIBARCHIVE], [0], [Define to
0 if libarchive is not available]))
if test "x$enable_debuginfod" = "xno"; then
AC_MSG_ERROR([dependencies not found, use --disable-debuginfod to
disable.])
fi
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 524be948..6b21f46f 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -2996,8 +2996,6 @@ dwarf_extract_source_paths (Elf *elf, set&
debug_sourcefiles)
if (comp_dir[0] == '\0' && cuname[0] != '/')
{
- // This is a common symptom for dwz-compressed debug files,
- // where the altdebug file cannot be resolved.
if (verbose > 3)
obatched(clog) << "skipping cu=" << cuname << " due to empty
comp_dir" << endl;
continue;
diff --git a/doc/srcfiles.1 b/doc/srcfiles.1
index 6149c21b..c6338315 100644
--- a/doc/srcfiles.1
+++ b/doc/srcfiles.1
@@ -21,15 +21,18 @@
eu-srcfiles \- Lists the source files of a DWARF/ELF file.
.SH "SYNOPSIS"
-eu-srcfiles [\fB\-0\fR|\fB\-\-null\fR] [\fB\-c\fR|\fB\-\-cu\-only\fR]
[\fB\-v\fR|\fB\-\-verbose\fR] INPUT
+eu-srcfiles [\fB\-0\fR|\fB\-\-null\fR] [\fB\-c\fR|\fB\-\-cu\-only\fR]
[\fB\-v\fR|\fB\-\-verbose\fR] [\fB\-z\fR|\fB\-\-zip\fR] INPUT
.SH "DE