[PATCH] [gdb] Fix set info with --with-debuginfod=no

Tom de Vries tdevries@suse.de
Mon Nov 15 16:15:07 GMT 2021


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



More information about the Gdb-patches mailing list