void _initialize_cli_logging (void) { static struct cmd_list_element *set_logging_cmdlist, *show_logging_cmdlist; add_prefix_cmd ("logging", class_support, set_logging_command, "Set logging options", &set_logging_cmdlist, "set logging ", 0, &setlist); add_prefix_cmd ("logging", class_support, show_logging_command, "Show logging options", &show_logging_cmdlist, "show logging ", 0, &showlist); add_setshow_boolean_cmd ("overwrite", class_support, &logging_overwrite, "Set whether logging overwrites or appends " "to the log file.\n", "Show whether logging overwrites or appends " "to the log file.\n", NULL, NULL, &set_logging_cmdlist, &show_logging_cmdlist); add_setshow_boolean_cmd ("redirect", class_support, &logging_redirect, "Set the logging output mode.\n" "If redirect is off, output will go to both the " "screen and the log file.\n" "If redirect is on, output will go only to the log " "file.", "Show the logging output mode.\n" "If redirect is off, output will go to both the " "screen and the log file.\n" "If redirect is on, output will go only to the log " "file.", NULL, NULL, &set_logging_cmdlist, &show_logging_cmdlist); add_setshow_cmd ("file", class_support, var_filename, &logging_filename, "Set the current logfile.", "Show the current logfile.", NULL, NULL, &set_logging_cmdlist, &show_logging_cmdlist); add_cmd ("on", class_support, set_logging_on, "Enable logging.", &set_logging_cmdlist); add_cmd ("off", class_support, set_logging_off, "Disable logging.", &set_logging_cmdlist); logging_filename = xstrdup ("gdb.txt"); }
static void add_setshow_generic (enum var_types param_type, enum command_class cmd_class, char *cmd_name, param_smob *self, char *set_doc, char *show_doc, char *help_doc, cmd_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list, struct cmd_list_element **set_cmd, struct cmd_list_element **show_cmd) { struct cmd_list_element *param = NULL; const char *tmp_name = NULL; switch (param_type) { case var_boolean: add_setshow_boolean_cmd (cmd_name, cmd_class, &self->value.intval, set_doc, show_doc, help_doc, set_func, show_func, set_list, show_list); break; case var_auto_boolean: add_setshow_auto_boolean_cmd (cmd_name, cmd_class, &self->value.autoboolval, set_doc, show_doc, help_doc, set_func, show_func, set_list, show_list); break; case var_uinteger: add_setshow_uinteger_cmd (cmd_name, cmd_class, &self->value.uintval, set_doc, show_doc, help_doc, set_func, show_func, set_list, show_list); break; case var_zinteger: add_setshow_zinteger_cmd (cmd_name, cmd_class, &self->value.intval, set_doc, show_doc, help_doc, set_func, show_func, set_list, show_list); break; case var_zuinteger: add_setshow_zuinteger_cmd (cmd_name, cmd_class, &self->value.uintval, set_doc, show_doc, help_doc, set_func, show_func, set_list, show_list); break; case var_zuinteger_unlimited: add_setshow_zuinteger_unlimited_cmd (cmd_name, cmd_class, &self->value.intval, set_doc, show_doc, help_doc, set_func, show_func, set_list, show_list); break; case var_string: add_setshow_string_cmd (cmd_name, cmd_class, &self->value.stringval, set_doc, show_doc, help_doc, set_func, show_func, set_list, show_list); break; case var_string_noescape: add_setshow_string_noescape_cmd (cmd_name, cmd_class, &self->value.stringval, set_doc, show_doc, help_doc, set_func, show_func, set_list, show_list); break; case var_optional_filename: add_setshow_optional_filename_cmd (cmd_name, cmd_class, &self->value.stringval, set_doc, show_doc, help_doc, set_func, show_func, set_list, show_list); break; case var_filename: add_setshow_filename_cmd (cmd_name, cmd_class, &self->value.stringval, set_doc, show_doc, help_doc, set_func, show_func, set_list, show_list); break; case var_enum: add_setshow_enum_cmd (cmd_name, cmd_class, self->enumeration, &self->value.cstringval, set_doc, show_doc, help_doc, set_func, show_func, set_list, show_list); /* Initialize the value, just in case. */ self->value.cstringval = self->enumeration[0]; break; default: gdb_assert_not_reached ("bad param_type value"); } /* Lookup created parameter, and register Scheme object against the parameter context. Perform this task against both lists. */ tmp_name = cmd_name; param = lookup_cmd (&tmp_name, *show_list, "", 0, 1); gdb_assert (param != NULL); set_cmd_context (param, self); *set_cmd = param; tmp_name = cmd_name; param = lookup_cmd (&tmp_name, *set_list, "", 0, 1); gdb_assert (param != NULL); set_cmd_context (param, self); *show_cmd = param; }