|
From: Mark W. <ma...@so...> - 2022-05-20 00:49:48
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=8d4eb6be2050e34fd396315335235dcd8ce96f5f commit 8d4eb6be2050e34fd396315335235dcd8ce96f5f Author: Aaron Merey <am...@re...> 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 Diff: --- NEWS | 1 + coregrind/m_debuginfo/readelf.c | 2 +- coregrind/m_main.c | 7 +++++++ coregrind/m_options.c | 3 +++ coregrind/pub_core_options.h | 6 ++++++ docs/xml/manual-core.xml | 28 ++++++++++++++++++++++------ none/tests/cmdline1.stdout.exp | 2 ++ none/tests/cmdline2.stdout.exp | 2 ++ 8 files changed, 44 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 4bf76608b7..a0cf73eaff 100644 --- 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 diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c index 998bc08fab..ea9c80415b 100644 --- a/coregrind/m_debuginfo/readelf.c +++ b/coregrind/m_debuginfo/readelf.c @@ -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 diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 2a7712b3ce..d0fbc0c56c 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -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) diff --git a/coregrind/m_options.c b/coregrind/m_options.c index 688523324e..c35d0aa1dd 100644 --- a/coregrind/m_options.c +++ b/coregrind/m_options.c @@ -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 diff --git a/coregrind/pub_core_options.h b/coregrind/pub_core_options.h index 5dd01addcc..22875c824b 100644 --- a/coregrind/pub_core_options.h +++ b/coregrind/pub_core_options.h @@ -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); diff --git a/docs/xml/manual-core.xml b/docs/xml/manual-core.xml index dc33e12696..1cb4e8e579 100644 --- a/docs/xml/manual-core.xml +++ b/docs/xml/manual-core.xml @@ -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 --> diff --git a/none/tests/cmdline1.stdout.exp b/none/tests/cmdline1.stdout.exp index 7f05709548..ca74f7bd89 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 7c8a23f8b0..0da944f5a0 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) |