Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: gdb-patches@sourceware.org
Subject: RFC: Clean up "show remote"
Date: Sun, 22 Jan 2006 20:18:00 -0000	[thread overview]
Message-ID: <20060122201759.GA28863@nevyn.them.org> (raw)

Does anyone have an opinion on this patch?  It's, um, a bit inelegant;
but it removes the hardcoded list of subcommands in show_remote_cmd, which
happens to be missing two.  I always try "show remote" when I want to
remember the spelling of "set remote hardware-breakpoint-limit", but
it didn't include that.

Also shorten the messages a bit by removing redundancy; either the user
typed config->title, or it was prefixed to the output already.

An alternative if the code in show_remote_cmd is too ugly would be to delete
"show remote Z-packet".  I think we have to leave "set remote Z-packet" -
it's five years obsoleted but never marked as deprecated and I know people
are continuing to use it - but the show command is completely redundant.

-- 
Daniel Jacobowitz
CodeSourcery

2006-01-22  Daniel Jacobowitz  <dan@codesourcery.com>

	* Makefile.in (remote.o): Update.
	* remote.c (show_packet_config_cmd): Shorten messages.
	(remote_set_cmdlist, remote_show_cmdlist): Make file-static.
	(show_remote_cmd): Iterate.
	(_initialize_remote): Remove remote_set_cmdlist,
	remote_show_cmdlist.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.777
diff -u -p -r1.777 Makefile.in
--- Makefile.in	21 Jan 2006 01:29:03 -0000	1.777
+++ Makefile.in	22 Jan 2006 20:12:52 -0000
@@ -2441,7 +2441,8 @@ remote.o: remote.c $(defs_h) $(gdb_strin
 	$(symfile_h) $(exceptions_h) $(target_h) $(gdbcmd_h) $(objfiles_h) \
 	$(gdb_stabs_h) $(gdbthread_h) $(remote_h) $(regcache_h) $(value_h) \
 	$(gdb_assert_h) $(event_loop_h) $(event_top_h) $(inf_loop_h) \
-	$(serial_h) $(gdbcore_h) $(remote_fileio_h) $(solib_h) $(observer_h)
+	$(serial_h) $(gdbcore_h) $(remote_fileio_h) $(solib_h) $(observer_h) \
+	$(cli_decode_h) $(cli_setshow_h)
 remote-e7000.o: remote-e7000.c $(defs_h) $(gdbcore_h) $(gdbarch_h) \
 	$(inferior_h) $(target_h) $(value_h) $(command_h) $(gdb_string_h) \
 	$(exceptions_h) $(gdbcmd_h) $(serial_h) $(remote_utils_h) \
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.198
diff -u -p -r1.198 remote.c
--- remote.c	17 Jan 2006 14:11:16 -0000	1.198
+++ remote.c	22 Jan 2006 20:12:52 -0000
@@ -43,6 +43,8 @@
 #include "gdb_assert.h"
 #include "observer.h"
 #include "solib.h"
+#include "cli/cli-decode.h"
+#include "cli/cli-setshow.h"
 
 #include <ctype.h>
 #include <sys/time.h>
@@ -612,13 +614,13 @@ show_packet_config_cmd (struct packet_co
   switch (config->detect)
     {
     case AUTO_BOOLEAN_AUTO:
-      printf_filtered (_("Support for remote protocol `%s' (%s) packet is auto-detected, currently %s.\n"),
-		       config->name, config->title, support);
+      printf_filtered (_("Support for the `%s' packet is auto-detected, currently %s.\n"),
+		       config->name, support);
       break;
     case AUTO_BOOLEAN_TRUE:
     case AUTO_BOOLEAN_FALSE:
-      printf_filtered (_("Support for remote protocol `%s' (%s) packet is currently %s.\n"),
-		       config->name, config->title, support);
+      printf_filtered (_("Support for the `%s' packet is currently %s.\n"),
+		       config->name, support);
       break;
     }
 }
@@ -5564,6 +5566,9 @@ Specify the serial device it is connecte
   extended_async_remote_ops.to_mourn_inferior = extended_remote_mourn;
 }
 
+static struct cmd_list_element *remote_set_cmdlist;
+static struct cmd_list_element *remote_show_cmdlist;
+
 static void
 set_remote_cmd (char *args, int from_tty)
 {
@@ -5572,16 +5577,25 @@ set_remote_cmd (char *args, int from_tty
 static void
 show_remote_cmd (char *args, int from_tty)
 {
-  /* FIXME: cagney/2002-06-15: This function should iterate over
-     remote_show_cmdlist for a list of sub commands to show.  */
-  show_remote_protocol_Z_packet_cmd (gdb_stdout, from_tty, NULL, NULL);
-  show_remote_protocol_P_packet_cmd (gdb_stdout, from_tty, NULL, NULL);
-  show_remote_protocol_p_packet_cmd (gdb_stdout, from_tty, NULL, NULL);
-  show_remote_protocol_qSymbol_packet_cmd (gdb_stdout, from_tty, NULL, NULL);
-  show_remote_protocol_vcont_packet_cmd (gdb_stdout, from_tty, NULL, NULL);
-  show_remote_protocol_binary_download_cmd (gdb_stdout, from_tty, NULL, NULL);
-  show_remote_protocol_qPart_auxv_packet_cmd (gdb_stdout, from_tty, NULL, NULL);
-  show_remote_protocol_qGetTLSAddr_packet_cmd (gdb_stdout, from_tty, NULL, NULL);
+  /* We can't just use cmd_show_list here, because we want to skip
+     the redundant "show remote Z-packet".  */
+  struct cleanup *showlist_chain;
+  struct cmd_list_element *list = remote_show_cmdlist;
+
+  showlist_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "showlist");
+  for (; list != NULL; list = list->next)
+    if (strcmp (list->name, "Z-packet") == 0)
+      continue;
+    else if (list->type == show_cmd)
+      {
+	struct cleanup *option_chain
+	  = make_cleanup_ui_out_tuple_begin_end (uiout, "option");
+	ui_out_field_string (uiout, "name", list->name);
+	ui_out_text (uiout, ":  ");
+	do_setshow_command ((char *) NULL, from_tty, list);
+	/* Close the tuple.  */
+	do_cleanups (option_chain);
+      }
 }
 
 static void
@@ -5610,9 +5624,6 @@ remote_new_objfile (struct objfile *objf
 void
 _initialize_remote (void)
 {
-  static struct cmd_list_element *remote_set_cmdlist;
-  static struct cmd_list_element *remote_show_cmdlist;
-
   /* architecture specific data */
   remote_gdbarch_data_handle = 
     gdbarch_data_register_post_init (init_remote_state);


             reply	other threads:[~2006-01-22 20:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-22 20:18 Daniel Jacobowitz [this message]
2006-01-23  4:38 ` Eli Zaretskii
2006-01-23  5:15   ` Daniel Jacobowitz
2006-01-23 22:44     ` Eli Zaretskii
2006-01-24 16:53       ` Daniel Jacobowitz
2006-01-24 21:24         ` Eli Zaretskii
2006-01-24 21:28         ` Eli Zaretskii
2006-01-24 21:49           ` Daniel Jacobowitz
2006-01-24 22:10             ` Eli Zaretskii
2006-01-24 22:18               ` Daniel Jacobowitz
2006-02-02  2:07     ` Daniel Jacobowitz
2006-01-23 23:01 ` Jim Blandy
2006-01-23 23:24   ` Daniel Jacobowitz

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=20060122201759.GA28863@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    /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