Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [RFC] Eliminate deprecated_show_value_hack from remote.c
Date: Wed, 06 Apr 2005 21:40:00 -0000	[thread overview]
Message-ID: <20050406144004.28b4a437@ironwood.lan> (raw)
In-Reply-To: <20050406205942.GA22779@nevyn.them.org>

On Wed, 6 Apr 2005 16:59:43 -0400
Daniel Jacobowitz <drow@false.org> wrote:

> On Wed, Apr 06, 2005 at 01:55:37PM -0700, Kevin Buettner wrote:
> > The patch below eliminates all calls to deprecated_show_value_hack()
> > from remote.c.
> > 
> > I considered adding the fprint_filtered() statement which is now in
> > the new show_remote_protocol_packet_cmd() to show_packet_config_cmd(),
> > but I found one other call to this latter function which didn't also
> > want/need the value printed.  This is why I created a brand new
> > function.
> > 
> > Comments?
> 
> > +  fprintf_filtered (file,
> > +                    _("Current use of remote protocol `%s' (%s) is %s.\n"),
> > +		    config->name, config->title, value);
> 
> Do you need the word "packet" here?  It looks like name will be simply
> 'p'.  Otherwise, thank you for doing this!

Yes.  Good catch!

FWIW, I made this mistake by copying the message from the following
line in add_packet_config_cmd():

  print = xstrprintf ("Current use of remote protocol `%s' (%s) is %%s",

But it turns out that this variable is no longer used.  It was
introduced sometime last summer and its use was eliminated in
February of this year.  It's not clear to me if it was ever actually
printed.  I'll prepare a separate patch to eliminate some of the cruft
from add_packet_config_cmd().

Here's an update to my recently posted patch.  The only difference
between it and my earlier patch is the addition of the word "packet"
to the message printed by show_remote_protocol_packet_cmd().

	* remote.c (show_remote_protocol_packet_cmd): New function.
	(show_remote_protocol_vcont_packet_cmd )
	(show_remote_protocol_qSymbol_packet_cmd)
	(show_remote_protocol_P_packet_cmd)
	(show_remote_protocol_Z_software_bp_packet_cmd)
	(show_remote_protocol_Z_hardware_bp_packet_cmd)
	(show_remote_protocol_Z_write_wp_packet_cmd)
	(show_remote_protocol_Z_read_wp_packet_cmd)
	(show_remote_protocol_Z_access_wp_packet_cmd)
	(show_remote_protocol_binary_download_cmd)
	(show_remote_protocol_qPart_auxv_packet_cmd)
	(show_remote_protocol_p_packet_cmd ): Replace calls to
	deprecated_show_value_hack() and show_packet_config_cmd()
	with single call to show_remote_protocol_packet_cmd().

Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.179
diff -u -p -r1.179 remote.c
--- remote.c	25 Mar 2005 20:39:45 -0000	1.179
+++ remote.c	6 Apr 2005 21:32:01 -0000
@@ -675,6 +675,18 @@ add_packet_config_cmd (struct packet_con
     }
 }
 
+static void
+show_remote_protocol_packet_cmd (struct ui_file *file, int from_tty,
+					 struct cmd_list_element *c,
+					 const char *value,
+					 struct packet_config *config)
+{
+  fprintf_filtered (file,
+                    _("Current use of remote protocol `%s' (%s) packet is %s.\n"),
+		    config->name, config->title, value);
+  show_packet_config_cmd (config);
+}
+
 static enum packet_result
 packet_ok (const char *buf, struct packet_config *config)
 {
@@ -754,8 +766,8 @@ show_remote_protocol_vcont_packet_cmd (s
 				       struct cmd_list_element *c,
 				       const char *value)
 {
-  deprecated_show_value_hack (file, from_tty, c, value);
-  show_packet_config_cmd (&remote_protocol_vcont);
+  show_remote_protocol_packet_cmd (file, from_tty, c, value,
+                                   &remote_protocol_vcont);
 }
 
 /* Should we try the 'qSymbol' (target symbol lookup service) request?  */
@@ -773,8 +785,8 @@ show_remote_protocol_qSymbol_packet_cmd 
 					 struct cmd_list_element *c,
 					 const char *value)
 {
-  deprecated_show_value_hack (file, from_tty, c, value);
-  show_packet_config_cmd (&remote_protocol_qSymbol);
+  show_remote_protocol_packet_cmd (file, from_tty, c, value,
+                                   &remote_protocol_qSymbol);
 }
 
 /* Should we try the 'P' (set register) request?  */
@@ -793,8 +805,8 @@ show_remote_protocol_P_packet_cmd (struc
 				   struct cmd_list_element *c,
 				   const char *value)
 {
-  deprecated_show_value_hack (file, from_tty, c, value);
-  show_packet_config_cmd (&remote_protocol_P);
+  show_remote_protocol_packet_cmd (file, from_tty, c, value,
+                                   &remote_protocol_P);
 }
 
 /* Should we try one of the 'Z' requests?  */
@@ -826,8 +838,8 @@ show_remote_protocol_Z_software_bp_packe
 					       struct cmd_list_element *c,
 					       const char *value)
 {
-  deprecated_show_value_hack (file, from_tty, c, value);
-  show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_SOFTWARE_BP]);
+  show_remote_protocol_packet_cmd (file, from_tty, c, value,
+                                   &remote_protocol_Z[Z_PACKET_SOFTWARE_BP]);
 }
 
 static void
@@ -842,8 +854,8 @@ show_remote_protocol_Z_hardware_bp_packe
 					       struct cmd_list_element *c,
 					       const char *value)
 {
-  deprecated_show_value_hack (file, from_tty, c, value);
-  show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_HARDWARE_BP]);
+  show_remote_protocol_packet_cmd (file, from_tty, c, value,
+                                   &remote_protocol_Z[Z_PACKET_HARDWARE_BP]);
 }
 
 static void
@@ -858,8 +870,8 @@ show_remote_protocol_Z_write_wp_packet_c
 					    struct cmd_list_element *c,
 					    const char *value)
 {
-  deprecated_show_value_hack (file, from_tty, c, value);
-  show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_WRITE_WP]);
+  show_remote_protocol_packet_cmd (file, from_tty, c, value,
+                                   &remote_protocol_Z[Z_PACKET_WRITE_WP]);
 }
 
 static void
@@ -874,8 +886,8 @@ show_remote_protocol_Z_read_wp_packet_cm
 					   struct cmd_list_element *c,
 					   const char *value)
 {
-  deprecated_show_value_hack (file, from_tty, c, value);
-  show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_READ_WP]);
+  show_remote_protocol_packet_cmd (file, from_tty, c, value,
+                                   &remote_protocol_Z[Z_PACKET_READ_WP]);
 }
 
 static void
@@ -890,8 +902,8 @@ show_remote_protocol_Z_access_wp_packet_
 					     struct cmd_list_element *c,
 					     const char *value)
 {
-  deprecated_show_value_hack (file, from_tty, c, value);
-  show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_ACCESS_WP]);
+  show_remote_protocol_packet_cmd (file, from_tty, c, value,
+                                   &remote_protocol_Z[Z_PACKET_ACCESS_WP]);
 }
 
 /* For compatibility with older distributions.  Provide a ``set remote
@@ -959,8 +971,8 @@ show_remote_protocol_binary_download_cmd
 					  struct cmd_list_element *c,
 					  const char *value)
 {
-  deprecated_show_value_hack (file, from_tty, c, value);
-  show_packet_config_cmd (&remote_protocol_binary_download);
+  show_remote_protocol_packet_cmd (file, from_tty, c, value,
+                                   &remote_protocol_binary_download);
 }
 
 /* Should we try the 'qPart:auxv' (target auxiliary vector read) request?  */
@@ -978,8 +990,8 @@ show_remote_protocol_qPart_auxv_packet_c
 					    struct cmd_list_element *c,
 					    const char *value)
 {
-  deprecated_show_value_hack (file, from_tty, c, value);
-  show_packet_config_cmd (&remote_protocol_qPart_auxv);
+  show_remote_protocol_packet_cmd (file, from_tty, c, value,
+                                   &remote_protocol_qPart_auxv);
 }
 
 static struct packet_config remote_protocol_p;
@@ -996,8 +1008,8 @@ show_remote_protocol_p_packet_cmd (struc
 				   struct cmd_list_element *c,
 				   const char *value)
 {
-  deprecated_show_value_hack (file, from_tty, c, value);
-  show_packet_config_cmd (&remote_protocol_p);
+  show_remote_protocol_packet_cmd (file, from_tty, c, value,
+                                   &remote_protocol_p);
 }
 
 


  reply	other threads:[~2005-04-06 21:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-06 20:55 Kevin Buettner
2005-04-06 20:59 ` Daniel Jacobowitz
2005-04-06 21:40   ` Kevin Buettner [this message]
2005-04-14 19:38     ` Daniel Jacobowitz
2005-04-15 16:22       ` Kevin Buettner
2005-04-15 17:20         ` Kevin Buettner

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=20050406144004.28b4a437@ironwood.lan \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sources.redhat.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