public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [PR gdb/29316] gdb-add-index always generates an error when libdebuginfod wasn't compiled in
@ 2022-07-05 22:37 Aaron Merey
  2022-07-06 10:32 ` Lancelot SIX
  0 siblings, 1 reply; 5+ messages in thread
From: Aaron Merey @ 2022-07-05 22:37 UTC (permalink / raw)
  To: gdb-patches

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);
 #endif
 }
 
-- 
2.35.3


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] [PR gdb/29316] gdb-add-index always generates an error when libdebuginfod wasn't compiled in
  2022-07-05 22:37 [PATCH] [PR gdb/29316] gdb-add-index always generates an error when libdebuginfod wasn't compiled in Aaron Merey
@ 2022-07-06 10:32 ` Lancelot SIX
  2022-07-06 19:14   ` Aaron Merey
  0 siblings, 1 reply; 5+ messages in thread
From: Lancelot SIX @ 2022-07-06 10:32 UTC (permalink / raw)
  To: Aaron Merey; +Cc: gdb-patches

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
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] [PR gdb/29316] gdb-add-index always generates an error when libdebuginfod wasn't compiled in
  2022-07-06 10:32 ` Lancelot SIX
@ 2022-07-06 19:14   ` Aaron Merey
  2022-07-15 17:14     ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Aaron Merey @ 2022-07-06 19:14 UTC (permalink / raw)
  To: lsix; +Cc: gdb-patches, Aaron Merey

On Wed, Jul 6, 2022 at 6:41 AM Lancelot SIX <lsix@lancelotsix.com> wrote:
>
> On Tue, Jul 05, 2022 at 06:37:11PM -0400, Aaron Merey via Gdb-patches wrote:
> > -  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);
>
> 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.

Thanks Lancelot, I've updated the patch below.

Aaron

---
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..5f04a2b38ca 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 (value != debuginfod_off)
+    error (NO_IMPL);
 #endif
 }
 
-- 
2.35.3


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] [PR gdb/29316] gdb-add-index always generates an error when libdebuginfod wasn't compiled in
  2022-07-06 19:14   ` Aaron Merey
@ 2022-07-15 17:14     ` Tom Tromey
  2022-07-15 21:38       ` Aaron Merey
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2022-07-15 17:14 UTC (permalink / raw)
  To: Aaron Merey via Gdb-patches; +Cc: lsix, Aaron Merey

>>>>> "Aaron" == Aaron Merey via Gdb-patches <gdb-patches@sourceware.org> writes:

Aaron> gdb-add-index runs gdb with -iex 'set debuginfod enabled off'.  If gdb
Aaron> is not compiled against libdebuginfod this causes an unnecessary error
Aaron> message to be printed to stderr indicating that gdb was not built with
Aaron> debuginfod support.

Aaron> Fix this by changing the 'set debuginfod enabled off' command to a
Aaron> no-op when gdb isn't built with libdebuginfod.

Thanks, this is ok.

Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] [PR gdb/29316] gdb-add-index always generates an error when libdebuginfod wasn't compiled in
  2022-07-15 17:14     ` Tom Tromey
@ 2022-07-15 21:38       ` Aaron Merey
  0 siblings, 0 replies; 5+ messages in thread
From: Aaron Merey @ 2022-07-15 21:38 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Aaron Merey via Gdb-patches, lsix

On Fri, Jul 15, 2022 at 1:14 PM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> "Aaron" == Aaron Merey via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Aaron> gdb-add-index runs gdb with -iex 'set debuginfod enabled off'.  If gdb
> Aaron> is not compiled against libdebuginfod this causes an unnecessary error
> Aaron> message to be printed to stderr indicating that gdb was not built with
> Aaron> debuginfod support.
>
> Aaron> Fix this by changing the 'set debuginfod enabled off' command to a
> Aaron> no-op when gdb isn't built with libdebuginfod.
>
> Thanks, this is ok.

Thanks, pushed as commit 92b0a182fe00.

Aaron


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-07-15 21:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 22:37 [PATCH] [PR gdb/29316] gdb-add-index always generates an error when libdebuginfod wasn't compiled in Aaron Merey
2022-07-06 10:32 ` Lancelot SIX
2022-07-06 19:14   ` Aaron Merey
2022-07-15 17:14     ` Tom Tromey
2022-07-15 21:38       ` Aaron Merey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).