This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFC] Eliminate deprecated_show_value_hack from remote.c
- From: Kevin Buettner <kevinb at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 6 Apr 2005 13:55:37 -0700
- Subject: [RFC] Eliminate deprecated_show_value_hack from remote.c
- Organization: Red Hat
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?
* 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 20:28:00 -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) 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);
}