public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdb] Fix set info with --with-debuginfod=no
@ 2021-11-15 16:15 Tom de Vries
  2021-11-15 16:26 ` Simon Marchi
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2021-11-15 16:15 UTC (permalink / raw)
  To: gdb-patches

When configuring gdb with --with-debuginfod=no, we run into:
...
debug xml:  XML debugging is off.^M
debug-file-directory:  The directory where separate debug symbols are \
  searched for is "/usr/lib/debug".^M
debuginfod status:  Support for debuginfod is not compiled into GDB.^M
(gdb) FAIL: gdb.base/default.exp: info set
...

The problem is that the show_debuginfod_status_command throws an error:
...
static void
show_debuginfod_status_command (const char *args, int from_tty)
{
  error (NO_IMPL);
}
...
which stops the "set info" command from iterating further.

Fix this by catching the error in cmd_show_list.

Tested on x86_64-linux.
---
 gdb/cli/cli-setshow.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index 18e2d4ed5c8..0ff97b2e4a3 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -732,10 +732,18 @@ cmd_show_list (struct cmd_list_element *list, int from_tty)
 	    }
 	  uiout->field_string ("name", list->name);
 	  uiout->text (":  ");
-	  if (list->type == show_cmd)
-	    do_show_command (NULL, from_tty, list);
-	  else
-	    cmd_func (list, NULL, from_tty);
+	  try
+	    {
+	      if (list->type == show_cmd)
+		do_show_command (NULL, from_tty, list);
+	      else
+		cmd_func (list, NULL, from_tty);
+	    }
+	  catch (const gdb_exception &ex)
+	    {
+	      /* Some show commands throw an error when they're not
+		 supported.  Catch it and continue with other commands.  */
+	    }
 	}
     }
 }

base-commit: eae06bb301512a21277dd48a4bff025c4dceda9e
-- 
2.26.2


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

* Re: [PATCH] [gdb] Fix set info with --with-debuginfod=no
  2021-11-15 16:15 [PATCH] [gdb] Fix set info with --with-debuginfod=no Tom de Vries
@ 2021-11-15 16:26 ` Simon Marchi
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Marchi @ 2021-11-15 16:26 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches, Aaron Merey

On 2021-11-15 11:15 a.m., Tom de Vries via Gdb-patches wrote:
> When configuring gdb with --with-debuginfod=no, we run into:
> ...
> debug xml:  XML debugging is off.^M
> debug-file-directory:  The directory where separate debug symbols are \
>   searched for is "/usr/lib/debug".^M
> debuginfod status:  Support for debuginfod is not compiled into GDB.^M
> (gdb) FAIL: gdb.base/default.exp: info set
> ...
>
> The problem is that the show_debuginfod_status_command throws an error:
> ...
> static void
> show_debuginfod_status_command (const char *args, int from_tty)
> {
>   error (NO_IMPL);
> }
> ...
> which stops the "set info" command from iterating further.
>
> Fix this by catching the error in cmd_show_list.

I think the show command should simply not throw.

I have a patch to re-work the debuginfod commands here, based on a
discussion we had with Aaron in another thread.  It fixes that failure
at the same time.

  https://sourceware.org/pipermail/gdb-patches/2021-November/183296.html

I'm just waiting for Aaron to give his ok.

Simon

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

end of thread, other threads:[~2021-11-15 16:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 16:15 [PATCH] [gdb] Fix set info with --with-debuginfod=no Tom de Vries
2021-11-15 16:26 ` Simon Marchi

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).