Re: [PATCH] perf: print warning when HAVE_DEBUGINFOD_SUPPORT is not set

From: Arnaldo Carvalho de Melo
Date: Wed Apr 20 2022 - 12:34:33 EST


Em Wed, Apr 20, 2022 at 03:32:55PM +0200, Martin Liška escreveu:
> When one requests debuginfod, either via --debuginfod option, or
> with a perf-config value, complain when perf is not built with it.
>
> Signed-off-by: Martin Liska <mliska@xxxxxxx>

I'll go and apply this manually:

⬢[acme@toolbox perf]$ am
warning: Patch sent with format=flowed; space at the end of lines might be lost.
Applying: perf: print warning when HAVE_DEBUGINFOD_SUPPORT is not set
error: corrupt patch at line 19
Patch failed at 0001 perf: print warning when HAVE_DEBUGINFOD_SUPPORT is not set
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
⬢[acme@toolbox perf]$ git am --abort
⬢[acme@toolbox perf]$ vim ~/wb/1.patch
⬢[acme@toolbox perf]$ patch -p1 < ~/wb/1.patch
patching file tools/perf/util/util.c
Hunk #1 FAILED at 430.
1 out of 1 hunk FAILED -- saving rejects to file tools/perf/util/util.c.rej
⬢[acme@toolbox perf]$ git diff
⬢[acme@toolbox perf]$
⬢[acme@toolbox perf]$ cat tools/perf/util/util.c.rej
--- tools/perf/util/util.c
+++ tools/perf/util/util.c
@@ -430,4 +430,9 @@ void perf_debuginfod_setup(struct perf_debuginfod *di)
setenv("DEBUGINFOD_URLS", di->urls, 1);

pr_debug("DEBUGINFOD_URLS=%s\n", getenv("DEBUGINFOD_URLS"));
+
+#ifndef HAVE_DEBUGINFOD_SUPPORT
+ if (di->set)
+ pr_warning("WARNING: debuginfod support requested, but perf is not built with it\n");
+#endif
}
⬢[acme@toolbox perf]$

> ---
> tools/perf/util/util.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
> index fb4f6616b5fa..289d83baaa2f 100644
> --- a/tools/perf/util/util.c
> +++ b/tools/perf/util/util.c
> @@ -430,4 +430,9 @@ void perf_debuginfod_setup(struct perf_debuginfod *di)
> setenv("DEBUGINFOD_URLS", di->urls, 1);
> pr_debug("DEBUGINFOD_URLS=%s\n", getenv("DEBUGINFOD_URLS"));
> +
> +#ifndef HAVE_DEBUGINFOD_SUPPORT
> + if (di->set)
> + pr_warning("WARNING: debuginfod support requested, but perf is not built with it\n");
> +#endif
> }
> --
> 2.35.3

--

- Arnaldo