From e9e68a56bc8f22dd3234810e0b39edfeb81f81f4 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sat, 15 Jun 2002 22:05:33 +0000 Subject: [PATCH] * command.h (add_setshow_auto_boolean_cmd): Replace add_set_auto_boolean_cmd. * cli/cli-decode.c (add_setshow_auto_boolean_cmd): Replace add_set_auto_boolean_cmd. * cli/cli-decode.h (add_set_auto_boolean_cmd): Delete declaration. * mips-tdep.c (_initialize_mips_tdep): Update ``set mips mask-address'' command. (show_mask_address): Add cmd parameter. * remote.c (add_packet_config_cmd): Update. Change type of set_func and show_func to cmd_sfunc_ftype. (_initialize_remote): Update `set remote Z-packet' (show_remote_protocol_qSymbol_packet_cmd): Add cmd parameter. (show_remote_protocol_e_packet_cmd): Ditto. (show_remote_protocol_E_packet_cmd): Ditto. (show_remote_protocol_P_packet_cmd): Ditto. (show_remote_protocol_Z_software_bp_packet_cmd): Ditto. (show_remote_protocol_Z_hardware_bp_packet_cmd): Ditto. (show_remote_protocol_Z_write_wp_packet_cmd): Ditto. (show_remote_protocol_Z_read_wp_packet_cmd): Ditto. (show_remote_protocol_Z_access_wp_packet_cmd): Ditto. (show_remote_protocol_Z_packet_cmd): Ditto. (show_remote_protocol_binary_download_cmd): Ditto. (show_remote_cmd): Pass NULL to all of above. --- gdb/ChangeLog | 26 ++++++++++++++ gdb/cli/cli-decode.c | 29 +++++++++------- gdb/cli/cli-decode.h | 6 ---- gdb/command.h | 13 ++++--- gdb/mips-tdep.c | 16 ++++----- gdb/remote.c | 81 +++++++++++++++++++++++--------------------- 6 files changed, 101 insertions(+), 70 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8209a7f1d87..5e50b0f6397 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,29 @@ +2002-06-15 Andrew Cagney + + * command.h (add_setshow_auto_boolean_cmd): Replace + add_set_auto_boolean_cmd. + * cli/cli-decode.c (add_setshow_auto_boolean_cmd): Replace + add_set_auto_boolean_cmd. + * cli/cli-decode.h (add_set_auto_boolean_cmd): Delete declaration. + * mips-tdep.c (_initialize_mips_tdep): Update ``set mips + mask-address'' command. + (show_mask_address): Add cmd parameter. + * remote.c (add_packet_config_cmd): Update. Change type of + set_func and show_func to cmd_sfunc_ftype. + (_initialize_remote): Update `set remote Z-packet' + (show_remote_protocol_qSymbol_packet_cmd): Add cmd parameter. + (show_remote_protocol_e_packet_cmd): Ditto. + (show_remote_protocol_E_packet_cmd): Ditto. + (show_remote_protocol_P_packet_cmd): Ditto. + (show_remote_protocol_Z_software_bp_packet_cmd): Ditto. + (show_remote_protocol_Z_hardware_bp_packet_cmd): Ditto. + (show_remote_protocol_Z_write_wp_packet_cmd): Ditto. + (show_remote_protocol_Z_read_wp_packet_cmd): Ditto. + (show_remote_protocol_Z_access_wp_packet_cmd): Ditto. + (show_remote_protocol_Z_packet_cmd): Ditto. + (show_remote_protocol_binary_download_cmd): Ditto. + (show_remote_cmd): Pass NULL to all of above. + 2002-06-15 Mark Kettenis * config/i386/tm-i386.h (PUSH_ARGUMENTS, STORE_STRUCT_RETURN, diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index b552c531388..a6fadd91360 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -389,23 +389,26 @@ add_set_enum_cmd (char *name, return c; } -/* Add element named NAME to command list LIST (the list for set - or some sublist thereof). - CLASS is as in add_cmd. - VAR is address of the variable which will contain the value. - DOC is the documentation string. */ -struct cmd_list_element * -add_set_auto_boolean_cmd (char *name, - enum command_class class, - enum auto_boolean *var, - char *doc, - struct cmd_list_element **list) +/* Add an auto-boolean command named NAME to both the set and show + command list lists. CLASS is as in add_cmd. VAR is address of the + variable which will contain the value. DOC is the documentation + string. FUNC is the corresponding callback. */ +void +add_setshow_auto_boolean_cmd (char *name, + enum command_class class, + enum auto_boolean *var, + char *set_doc, char *show_doc, + cmd_sfunc_ftype *set_func, + cmd_sfunc_ftype *show_func, + struct cmd_list_element **set_list, + struct cmd_list_element **show_list) { static const char *auto_boolean_enums[] = { "on", "off", "auto", NULL }; struct cmd_list_element *c; - c = add_set_cmd (name, class, var_auto_boolean, var, doc, list); + c = add_setshow_cmd (name, class, var_auto_boolean, var, + set_doc, show_doc, set_func, show_func, + set_list, show_list); c->enums = auto_boolean_enums; - return c; } /* Add element named NAME to both the set and show command LISTs (the diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h index c5d06d5cf61..e8563ff5c59 100644 --- a/gdb/cli/cli-decode.h +++ b/gdb/cli/cli-decode.h @@ -293,12 +293,6 @@ extern struct cmd_list_element *add_set_enum_cmd (char *name, char *doc, struct cmd_list_element **list); -extern struct cmd_list_element *add_set_auto_boolean_cmd (char *name, - enum command_class class, - enum auto_boolean *var, - char *doc, - struct cmd_list_element **list); - extern struct cmd_list_element *add_show_from_set (struct cmd_list_element *, struct cmd_list_element **); diff --git a/gdb/command.h b/gdb/command.h index 75462e5d645..00110ce555d 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -223,11 +223,14 @@ extern struct cmd_list_element *add_set_enum_cmd (char *name, char *doc, struct cmd_list_element **list); -extern struct cmd_list_element *add_set_auto_boolean_cmd (char *name, - enum command_class class, - enum auto_boolean *var, - char *doc, - struct cmd_list_element **list); +extern void add_setshow_auto_boolean_cmd (char *name, + enum command_class class, + enum auto_boolean *var, + char *set_doc, char *show_doc, + cmd_sfunc_ftype *set_func, + cmd_sfunc_ftype *show_func, + struct cmd_list_element **set_list, + struct cmd_list_element **show_list); extern void add_setshow_boolean_cmd (char *name, enum command_class class, diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 85bac4f96a3..8b1e6d500c4 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -491,7 +491,7 @@ mips_mask_address_p (void) } static void -show_mask_address (char *cmd, int from_tty) +show_mask_address (char *cmd, int from_tty, struct cmd_list_element *c) { switch (mask_address_var) { @@ -5083,13 +5083,13 @@ search. The only need to set it is when debugging a stripped executable.", /* Allow the user to control whether the upper bits of 64-bit addresses should be zeroed. */ - c = add_set_auto_boolean_cmd ("mask-address", no_class, &mask_address_var, - "Set zeroing of upper 32 bits of 64-bit addresses.\n\ -Use \"on\" to enable the masking, \"off\" to disable it and \"auto\" to allow GDB to determine\n\ -the correct value.\n", - &setmipscmdlist); - add_cmd ("mask-address", no_class, show_mask_address, - "Show current mask-address value", &showmipscmdlist); + add_setshow_auto_boolean_cmd ("mask-address", no_class, &mask_address_var, "\ +Set zeroing of upper 32 bits of 64-bit addresses.\n\ +Use \"on\" to enable the masking, \"off\" to disable it and \"auto\" to \n\ +allow GDB to determine the correct value.\n", "\ +Show zeroing of upper 32 bits of 64-bit addresses.", + NULL, show_mask_address, + &setmipscmdlist, &showmipscmdlist); /* Allow the user to control the size of 32 bit registers within the raw remote packet. */ diff --git a/gdb/remote.c b/gdb/remote.c index c6bfc66993b..8231a574ff9 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -648,11 +648,8 @@ static void add_packet_config_cmd (struct packet_config *config, char *name, char *title, - void (*set_func) (char *args, int from_tty, - struct cmd_list_element * - c), - void (*show_func) (char *name, - int from_tty), + cmd_sfunc_ftype *set_func, + cmd_sfunc_ftype *show_func, struct cmd_list_element **set_remote_list, struct cmd_list_element **show_remote_list, int legacy) @@ -672,12 +669,10 @@ add_packet_config_cmd (struct packet_config *config, name, title); /* set/show TITLE-packet {auto,on,off} */ xasprintf (&cmd_name, "%s-packet", title); - set_cmd = add_set_auto_boolean_cmd (cmd_name, class_obscure, - &config->detect, set_doc, - set_remote_list); - set_cmd_sfunc (set_cmd, set_func); - show_cmd = add_cmd (cmd_name, class_obscure, show_func, show_doc, - show_remote_list); + add_setshow_auto_boolean_cmd (cmd_name, class_obscure, + &config->detect, set_doc, show_doc, + set_func, show_func, + set_remote_list, show_remote_list); /* set/show remote NAME-packet {auto,on,off} -- legacy */ if (legacy) { @@ -765,7 +760,8 @@ set_remote_protocol_qSymbol_packet_cmd (char *args, int from_tty, } static void -show_remote_protocol_qSymbol_packet_cmd (char *args, int from_tty) +show_remote_protocol_qSymbol_packet_cmd (char *args, int from_tty, + struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_qSymbol); } @@ -781,7 +777,8 @@ set_remote_protocol_e_packet_cmd (char *args, int from_tty, } static void -show_remote_protocol_e_packet_cmd (char *args, int from_tty) +show_remote_protocol_e_packet_cmd (char *args, int from_tty, + struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_e); } @@ -798,7 +795,8 @@ set_remote_protocol_E_packet_cmd (char *args, int from_tty, } static void -show_remote_protocol_E_packet_cmd (char *args, int from_tty) +show_remote_protocol_E_packet_cmd (char *args, int from_tty, + struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_E); } @@ -816,7 +814,8 @@ set_remote_protocol_P_packet_cmd (char *args, int from_tty, } static void -show_remote_protocol_P_packet_cmd (char *args, int from_tty) +show_remote_protocol_P_packet_cmd (char *args, int from_tty, + struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_P); } @@ -846,7 +845,8 @@ set_remote_protocol_Z_software_bp_packet_cmd (char *args, int from_tty, } static void -show_remote_protocol_Z_software_bp_packet_cmd (char *args, int from_tty) +show_remote_protocol_Z_software_bp_packet_cmd (char *args, int from_tty, + struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_SOFTWARE_BP]); } @@ -859,7 +859,8 @@ set_remote_protocol_Z_hardware_bp_packet_cmd (char *args, int from_tty, } static void -show_remote_protocol_Z_hardware_bp_packet_cmd (char *args, int from_tty) +show_remote_protocol_Z_hardware_bp_packet_cmd (char *args, int from_tty, + struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_HARDWARE_BP]); } @@ -872,7 +873,8 @@ set_remote_protocol_Z_write_wp_packet_cmd (char *args, int from_tty, } static void -show_remote_protocol_Z_write_wp_packet_cmd (char *args, int from_tty) +show_remote_protocol_Z_write_wp_packet_cmd (char *args, int from_tty, + struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_WRITE_WP]); } @@ -885,7 +887,8 @@ set_remote_protocol_Z_read_wp_packet_cmd (char *args, int from_tty, } static void -show_remote_protocol_Z_read_wp_packet_cmd (char *args, int from_tty) +show_remote_protocol_Z_read_wp_packet_cmd (char *args, int from_tty, + struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_READ_WP]); } @@ -898,7 +901,8 @@ set_remote_protocol_Z_access_wp_packet_cmd (char *args, int from_tty, } static void -show_remote_protocol_Z_access_wp_packet_cmd (char *args, int from_tty) +show_remote_protocol_Z_access_wp_packet_cmd (char *args, int from_tty, + struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_ACCESS_WP]); } @@ -921,7 +925,8 @@ set_remote_protocol_Z_packet_cmd (char *args, int from_tty, } static void -show_remote_protocol_Z_packet_cmd (char *args, int from_tty) +show_remote_protocol_Z_packet_cmd (char *args, int from_tty, + struct cmd_list_element *c) { int i; for (i = 0; i < NR_Z_PACKET_TYPES; i++) @@ -962,8 +967,8 @@ set_remote_protocol_binary_download_cmd (char *args, } static void -show_remote_protocol_binary_download_cmd (char *args, - int from_tty) +show_remote_protocol_binary_download_cmd (char *args, int from_tty, + struct cmd_list_element *c) { show_packet_config_cmd (&remote_protocol_binary_download); } @@ -5968,13 +5973,14 @@ set_remote_cmd (char *args, int from_tty) static void show_remote_cmd (char *args, int from_tty) { - - show_remote_protocol_Z_packet_cmd (args, from_tty); - show_remote_protocol_e_packet_cmd (args, from_tty); - show_remote_protocol_E_packet_cmd (args, from_tty); - show_remote_protocol_P_packet_cmd (args, from_tty); - show_remote_protocol_qSymbol_packet_cmd (args, from_tty); - show_remote_protocol_binary_download_cmd (args, 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 (args, from_tty, NULL); + show_remote_protocol_e_packet_cmd (args, from_tty, NULL); + show_remote_protocol_E_packet_cmd (args, from_tty, NULL); + show_remote_protocol_P_packet_cmd (args, from_tty, NULL); + show_remote_protocol_qSymbol_packet_cmd (args, from_tty, NULL); + show_remote_protocol_binary_download_cmd (args, from_tty, NULL); } static void @@ -6207,12 +6213,11 @@ in a memory packet.\n", 0); /* Keep the old ``set remote Z-packet ...'' working. */ - tmpcmd = add_set_auto_boolean_cmd ("Z-packet", class_obscure, - &remote_Z_packet_detect, - "\ -Set use of remote protocol `Z' packets", &remote_set_cmdlist); - set_cmd_sfunc (tmpcmd, set_remote_protocol_Z_packet_cmd); - add_cmd ("Z-packet", class_obscure, show_remote_protocol_Z_packet_cmd, - "Show use of remote protocol `Z' packets ", - &remote_show_cmdlist); + add_setshow_auto_boolean_cmd ("Z-packet", class_obscure, + &remote_Z_packet_detect, "\ +Set use of remote protocol `Z' packets", + "Show use of remote protocol `Z' packets ", + set_remote_protocol_Z_packet_cmd, + show_remote_protocol_Z_packet_cmd, + &remote_set_cmdlist, &remote_show_cmdlist); } -- 2.30.2