From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4892 invoked by alias); 6 Apr 2005 21:40:22 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 4749 invoked from network); 6 Apr 2005 21:40:10 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 6 Apr 2005 21:40:10 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j36LeAwM010122 for ; Wed, 6 Apr 2005 17:40:10 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j36LeAO27588 for ; Wed, 6 Apr 2005 17:40:10 -0400 Received: from localhost.localdomain (vpn50-19.rdu.redhat.com [172.16.50.19]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id j36Le9ec029387 for ; Wed, 6 Apr 2005 17:40:09 -0400 Received: from ironwood.lan (ironwood.lan [192.168.64.8]) by localhost.localdomain (8.12.11/8.12.10) with ESMTP id j36Le4J5001864 for ; Wed, 6 Apr 2005 14:40:04 -0700 Date: Wed, 06 Apr 2005 21:40:00 -0000 From: Kevin Buettner To: gdb-patches@sources.redhat.com Subject: Re: [RFC] Eliminate deprecated_show_value_hack from remote.c Message-ID: <20050406144004.28b4a437@ironwood.lan> In-Reply-To: <20050406205942.GA22779@nevyn.them.org> References: <20050406135537.0ebe7edc@ironwood.lan> <20050406205942.GA22779@nevyn.them.org> Organization: Red Hat Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2005-04/txt/msg00060.txt.bz2 On Wed, 6 Apr 2005 16:59:43 -0400 Daniel Jacobowitz 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); }