Add --enabled-debuginfod command line option

Currently debuginfod is enabled in Valgrind when the $DEBUGINFOD_URLS
environment variable is set and disabled when it isn't set.

This patch adds an --enable-debuginfod=<yes|no> command line option
to provide another level of control over whether Valgrind attempts
to download debuginfo. "yes" is the default value.

$DEBUGINFOD_URLS must still contain debuginfod server URLs in order
for this feature to work when --enable-debuginfod=yes.

https://bugs.kde.org/show_bug.cgi?id=453602
This commit is contained in:
Aaron Merey 2022-05-09 16:56:23 -04:00 committed by Mark Wielaard
parent 98774bffd2
commit 8d4eb6be20
8 changed files with 44 additions and 7 deletions

1
NEWS
View File

@ -40,6 +40,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
452274 memcheck crashes with Assertion 'sci->status.what == SsIdle' failed
452779 Valgrind fails to build on FreeBSD 13.0 with llvm-devel (15.0.0)
453055 shared_timed_mutex drd test fails with "Lock shared failed" message
453602 Missing command line option to enable/disable debuginfod
To see details of a given bug, visit
https://bugs.kde.org/show_bug.cgi?id=XXXXXX

View File

@ -1595,7 +1595,7 @@ DiImage* find_debug_file( struct _DebugInfo* di,
}
# if defined(VGO_linux)
if (dimg == NULL)
if (VG_(clo_enable_debuginfod) && dimg == NULL)
dimg = find_debug_file_debuginfod(objpath, &debugpath, buildid, crc, rel_ok);
# endif

View File

@ -116,6 +116,10 @@ static void usage_NORETURN ( int need_help )
" --log-fd=<number> log messages to file descriptor [2=stderr]\n"
" --log-file=<file> log messages to <file>\n"
" --log-socket=ipaddr:port log messages to socket ipaddr:port\n"
#if defined(VGO_linux)
" --enable-debuginfod=no|yes query debuginfod servers for missing\n"
" debuginfo [yes]\n"
#endif
"\n"
" user options for Valgrind tools that report errors:\n"
" --xml=yes emit error output in XML (some tools only)\n"
@ -600,6 +604,9 @@ static void process_option (Clo_Mode mode,
else if VG_BOOL_CLO(arg, "--run-cxx-freeres", VG_(clo_run_cxx_freeres)) {}
else if VG_BOOL_CLOM(cloPD, arg, "--show-below-main", VG_(clo_show_below_main)) {}
else if VG_BOOL_CLO(arg, "--keep-debuginfo", VG_(clo_keep_debuginfo)) {}
#if defined(VGO_linux)
else if VG_BOOL_CLO(arg, "--enable-debuginfod", VG_(clo_enable_debuginfod)) {}
#endif
else if VG_BOOL_CLOM(cloPD, arg, "--time-stamp", VG_(clo_time_stamp)) {}
else if VG_STR_CLO(arg, "--track-fds", tmp_str) {
if (VG_(strcmp)(tmp_str, "yes") == 0)

View File

@ -162,6 +162,9 @@ VgXTMemory VG_(clo_xtree_memory) = Vg_XTMemory_None;
const HChar* VG_(clo_xtree_memory_file) = "xtmemory.kcg.%p";
Bool VG_(clo_xtree_compress_strings) = True;
#if defined(VGO_linux)
Bool VG_(clo_enable_debuginfod) = True;
#endif
Int VG_(clo_dump_error) = 0;
Int VG_(clo_backtrace_size) = 12;
Int VG_(clo_merge_recursive_frames) = 0; // default value: no merge

View File

@ -126,6 +126,12 @@ extern const HChar* VG_(clo_trace_children_skip_by_arg);
after the subsequent exec(). */
extern Bool VG_(clo_child_silent_after_fork);
#if defined(VGO_linux)
/* If True, valgrind will attempt to query debuginfod servers for
any missing debuginfo. */
extern Bool VG_(clo_enable_debuginfod);
#endif
/* If the user specified --log-file=STR and/or --xml-file=STR, these
hold STR before expansion. */
extern const HChar *VG_(clo_log_fname_unexpanded);

View File

@ -599,19 +599,20 @@ to <computeroutput>malloc.</computeroutput>.</para>
<para id="debuginfod.para.1">Valgrind supports the downloading of debuginfo
files via debuginfod, an HTTP server for distributing ELF/DWARF debugging
information. When a debuginfo file cannot be found locally, Valgrind is able
to query debuginfod servers for the file using its build-id.</para>
to query debuginfod servers for the file using the file's build-id.</para>
<para id="debuginfod.para.2">In order to use this feature
<computeroutput>debuginfod-find</computeroutput> must be installed and
<computeroutput>$DEBUGINFOD_URLS</computeroutput> must contain URLs of
debuginfod servers. Valgrind does not support
<computeroutput>debuginfod-find</computeroutput> must be installed and the
<computeroutput>$DEBUGINFOD_URLS</computeroutput> environment variable must
contain space-separated URLs of debuginfod servers. Valgrind does not support
<computeroutput>debuginfod-find</computeroutput> verbose output that is
normally enabled with <computeroutput>$DEBUGINFOD_PROGRESS</computeroutput>
and <computeroutput>$DEBUGINFOD_VERBOSE</computeroutput>. These environment
variables will be ignored.</para>
variables will be ignored. This feature is supported on Linux only.</para>
<para id="debuginfod.para.3">For more information regarding debuginfod, see
https://sourceware.org/elfutils/Debuginfod.html</para>
<ulink url="https://sourceware.org/elfutils/Debuginfod.html">Elfutils Debuginfod</ulink>
.</para>
</sect1>
@ -989,6 +990,21 @@ in most cases. We group the available options by rough categories.</para>
</listitem>
</varlistentry>
<varlistentry id="opt.enable-debuginfod" xreflabel="--enable-debuginfod">
<term>
<option><![CDATA[--enable-debuginfod=<no|yes> [default: yes] ]]></option>
</term>
<listitem>
<para>When enabled Valgrind will attempt to download missing debuginfo
from debuginfod servers if space-separated server URLs are present
in the <computeroutput>$DEBUGINFOD_URLS</computeroutput> environment
variable. This option is supported on Linux only.
<!-- commented out because it causes broken links in the man page
For more information see <xref linkend="manual-core.debuginfod"/>.
--></para>
</listitem>
</varlistentry>
</variablelist>
<!-- end of xi:include in the manpage -->

View File

@ -31,6 +31,8 @@ usage: valgrind [options] prog-and-args
--log-fd=<number> log messages to file descriptor [2=stderr]
--log-file=<file> log messages to <file>
--log-socket=ipaddr:port log messages to socket ipaddr:port
--enable-debuginfod=no|yes query debuginfod servers for missing
debuginfo [yes]
user options for Valgrind tools that report errors:
--xml=yes emit error output in XML (some tools only)

View File

@ -31,6 +31,8 @@ usage: valgrind [options] prog-and-args
--log-fd=<number> log messages to file descriptor [2=stderr]
--log-file=<file> log messages to <file>
--log-socket=ipaddr:port log messages to socket ipaddr:port
--enable-debuginfod=no|yes query debuginfod servers for missing
debuginfo [yes]
user options for Valgrind tools that report errors:
--xml=yes emit error output in XML (some tools only)