[PATCH] [PR gdb/29316] gdb-add-index always generates an error when libdebuginfod wasn't compiled in

Lancelot SIX lsix@lancelotsix.com
Wed Jul 6 10:32:42 GMT 2022


On Tue, Jul 05, 2022 at 06:37:11PM -0400, Aaron Merey via Gdb-patches wrote:
> gdb-add-index runs gdb with -iex 'set debuginfod enabled off'.  If gdb
> is not compiled against libdebuginfod this causes an unnecessary error
> message to be printed to stderr indicating that gdb was not built with
> debuginfod support.
> 
> Fix this by changing the 'set debuginfod enabled off' command to a
> no-op when gdb isn't built with libdebuginfod.
> ---
>  gdb/debuginfod-support.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
> index 9dbe6b5d8b2..2c346abf958 100644
> --- a/gdb/debuginfod-support.c
> +++ b/gdb/debuginfod-support.c
> @@ -368,7 +368,9 @@ set_debuginfod_enabled (const char *value)
>  #if defined(HAVE_LIBDEBUGINFOD)
>    debuginfod_enabled = value;
>  #else
> -  error (NO_IMPL);
> +  /* Disabling debuginfod when gdb is not built with it is a no-op.  */
> +  if (strcmp (value, debuginfod_off) != 0)
> +    error (NO_IMPL);

Hii Aaron,

You could compare the pointers themselves instead of doing a strcmp.
The call to parse_cli_var_enum earlier in the processing ensures that
VALUE is a member of debuginfod_enabled_enum.

Otherwise, and for what it is worth (I am no maintainer), the change
seems reasonable.

Best,
Lancelot.

>  #endif
>  }
>  
> -- 
> 2.35.3
> 


More information about the Gdb-patches mailing list