Bug 453602 - Missing command line option to enable/disable debuginfod
Summary: Missing command line option to enable/disable debuginfod
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-09 21:08 UTC by Aaron Merey
Modified: 2022-05-20 13:02 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
enable-debuginfod-opt.patch (6.28 KB, patch)
2022-05-09 21:08 UTC, Aaron Merey
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Merey 2022-05-09 21:08:03 UTC
Created attachment 148692 [details]
enable-debuginfod-opt.patch

SUMMARY
Currently debuginfod is enabled in Valgrind when the $DEBUGINFOD_URLS environment variable is set and disabled when the env. var isn't set. There should also be a command line option to help control whether Valgrind attempts to download missing debuginfo.

I've attached a patch to add an --enable-debuginfod=<yes|no> option with "yes" as the default value.

SOFTWARE/OS VERSIONS
Linux
Comment 1 Mark Wielaard 2022-05-20 00:50:17 UTC
Thanks for the updated documentation. I did have to make one small change:

diff --git a/docs/xml/manual-core.xml b/docs/xml/manual-core.xml
index 4830e52da..1cb4e8e57 100644
--- a/docs/xml/manual-core.xml
+++ b/docs/xml/manual-core.xml
@@ -998,8 +998,10 @@ in most cases.  We group the available options by rough categories.</para>
       <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. For more information
-      see <xref linkend="Debuginfod">.</para>
+      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>
 
Because this entry is used both in the manual and the manpage the xref doesn't work (in the manpage case).

Also the none/tests/cmdline{1,2} tests needed updating:

diff --git a/none/tests/cmdline1.stdout.exp b/none/tests/cmdline1.stdout.exp
index 7f0570954..ca74f7bd8 100644
--- a/none/tests/cmdline1.stdout.exp
+++ b/none/tests/cmdline1.stdout.exp
@@ -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)
diff --git a/none/tests/cmdline2.stdout.exp b/none/tests/cmdline2.stdout.exp
index 7c8a23f8b..0da944f5a 100644
--- a/none/tests/cmdline2.stdout.exp
+++ b/none/tests/cmdline2.stdout.exp
@@ -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)

I pushed your patch with those updates:

commit 8d4eb6be2050e34fd396315335235dcd8ce96f5f (HEAD -> master, origin/master, origin/HEAD)
Author: Aaron Merey <amerey@redhat.com>
Date:   Mon May 9 16:56:23 2022 -0400

    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
Comment 2 Mark Wielaard 2022-05-20 13:02:37 UTC
I saw that cmdline1/2 tests failing on freebsd. That is because the new command line flag isn't available there. I added alternative .exp files

commit 2dad922aba5998441f41f8af8c777d3771c189c4
Author: Mark Wielaard <mark@klomp.org>
Date:   Fri May 20 14:58:45 2022 +0200

    Add cmdline{1,2}.stdout.exp-non-linux files
    
    The new --enable-debuginfod=<yes|no> command line flag is only
    available on GNU/Linux systems. Add new exp file for other systems.