]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add --enabled-debuginfod command line option
authorAaron Merey <amerey@redhat.com>
Mon, 9 May 2022 20:56:23 +0000 (16:56 -0400)
committerMark Wielaard <mark@klomp.org>
Fri, 20 May 2022 00:48:53 +0000 (02:48 +0200)
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

NEWS
coregrind/m_debuginfo/readelf.c
coregrind/m_main.c
coregrind/m_options.c
coregrind/pub_core_options.h
docs/xml/manual-core.xml
none/tests/cmdline1.stdout.exp
none/tests/cmdline2.stdout.exp

diff --git a/NEWS b/NEWS
index 4bf76608b707103540a90d863be4c117c44cfda0..a0cf73eafffad6afd42a988bde5ee8273491523d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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
index 998bc08fabd1fd2394bed6abac9b5e37a453d940..ea9c80415b83734f04ed498d5661a0280cd03854 100644 (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
 
index 2a7712b3cea4c09cc4fbc03a30affc9daa3a6846..d0fbc0c56c7cb33b923ca0c71557d6c1e755479e 100644 (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)
index 688523324e1d9d427eed5c96b7022886bbed410f..c35d0aa1dd06bdcb1231635b050163e8700ced66 100644 (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
index 5dd01addcc34d0a9ef8187b813366b84d1b442bd..22875c824b05dce35572c2c85c2e903d2996f61e 100644 (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);
index dc33e12696d63c95ef998599e062db0328410632..1cb4e8e5790719a5cb00bebb8b403a6eeb029a65 100644 (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 -->
 
index 7f057095488749baa67fc3a7ec72013d32ed2858..ca74f7bd898195d9cdbffe89daf65ba398db5899 100644 (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)
index 7c8a23f8b07e5236d81650975b71edeb0c54bee6..0da944f5a05746ef189b598120474b0137ff2102 100644 (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)