public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Aaron Merey <amerey@redhat.com>
To: lsix@lancelotsix.com
Cc: gdb-patches@sourceware.org, Aaron Merey <amerey@redhat.com>
Subject: [PATCH] [PR gdb/29316] gdb-add-index always generates an error when libdebuginfod wasn't compiled in
Date: Wed,  6 Jul 2022 15:14:02 -0400	[thread overview]
Message-ID: <20220706191402.55765-1-amerey@redhat.com> (raw)
In-Reply-To: <20220706103242.xexrlcuctwbl3izp@ubuntu.lan>

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


  reply	other threads:[~2022-07-06 19:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-05 22:37 Aaron Merey
2022-07-06 10:32 ` Lancelot SIX
2022-07-06 19:14   ` Aaron Merey [this message]
2022-07-15 17:14     ` Tom Tromey
2022-07-15 21:38       ` Aaron Merey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220706191402.55765-1-amerey@redhat.com \
    --to=amerey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lsix@lancelotsix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).