+/* Dummy functions to keep add_prefix_cmd happy. */
+
+static void
+set_internal_problem_cmd (char *args, int from_tty)
+{
+}
+
+static void
+show_internal_problem_cmd (char *args, int from_tty)
+{
+}
+
+/* When GDB reports an internal problem (error or warning) it gives
+ the user the opportunity to quit GDB and/or create a core file of
+ the current debug session. This function registers a few commands
+ that make it possible to specify that GDB should always or never
+ quit or create a core file, without asking. The commands look
+ like:
+
+ maint set PROBLEM-NAME quit ask|yes|no
+ maint show PROBLEM-NAME quit
+ maint set PROBLEM-NAME corefile ask|yes|no
+ maint show PROBLEM-NAME corefile
+
+ Where PROBLEM-NAME is currently "internal-error" or
+ "internal-warning". */
+
+static void
+add_internal_problem_command (struct internal_problem *problem)
+{
+ struct cmd_list_element **set_cmd_list;
+ struct cmd_list_element **show_cmd_list;
+ char *set_doc;
+ char *show_doc;
+
+ set_cmd_list = xmalloc (sizeof (*set_cmd_list));
+ show_cmd_list = xmalloc (sizeof (*set_cmd_list));
+ *set_cmd_list = NULL;
+ *show_cmd_list = NULL;
+
+ set_doc = xstrprintf (_("Configure what GDB does when %s is detected."),
+ problem->name);
+
+ show_doc = xstrprintf (_("Show what GDB does when %s is detected."),
+ problem->name);
+
+ add_prefix_cmd ((char*) problem->name,
+ class_maintenance, set_internal_problem_cmd, set_doc,
+ set_cmd_list,
+ concat ("maintenance set ", problem->name, " ", NULL),
+ 0/*allow-unknown*/, &maintenance_set_cmdlist);
+
+ add_prefix_cmd ((char*) problem->name,
+ class_maintenance, show_internal_problem_cmd, show_doc,
+ show_cmd_list,
+ concat ("maintenance show ", problem->name, " ", NULL),
+ 0/*allow-unknown*/, &maintenance_show_cmdlist);
+
+ set_doc = xstrprintf (_("\
+Set whether GDB should quit when an %s is detected"),
+ problem->name);
+ show_doc = xstrprintf (_("\
+Show whether GDB will quit when an %s is detected"),
+ problem->name);
+ add_setshow_enum_cmd ("quit", class_maintenance,
+ internal_problem_modes,
+ &problem->should_quit,
+ set_doc,
+ show_doc,
+ NULL, /* help_doc */
+ NULL, /* setfunc */
+ NULL, /* showfunc */
+ set_cmd_list,
+ show_cmd_list);
+
+ set_doc = xstrprintf (_("\
+Set whether GDB should create a core file of GDB when %s is detected"),
+ problem->name);
+ show_doc = xstrprintf (_("\
+Show whether GDB will create a core file of GDB when %s is detected"),
+ problem->name);
+ add_setshow_enum_cmd ("corefile", class_maintenance,
+ internal_problem_modes,
+ &problem->should_dump_core,
+ set_doc,
+ show_doc,
+ NULL, /* help_doc */
+ NULL, /* setfunc */
+ NULL, /* showfunc */
+ set_cmd_list,
+ show_cmd_list);
+}
+