contrib/gdb-7/gdb/utils.c
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, " ",
			  (char *) 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, " ",
			  (char *) 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);

  xfree (set_doc);
  xfree (show_doc);

  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);

  xfree (set_doc);
  xfree (show_doc);
}
/* 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".  */
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


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
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, " ",
			  (char *) NULL),
		  0, &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, " ",
			  (char *) NULL),
		  0, &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, 
			NULL, 
			NULL, 
			set_cmd_list,
			show_cmd_list);
  xfree (set_doc);
  xfree (show_doc);
  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, 
			NULL, 
			NULL, 
			set_cmd_list,
			show_cmd_list);
  xfree (set_doc);
  xfree (show_doc);
}
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 ( _ ( " " ) , problem -> name ) ; show_doc = xstrprintf ( _ ( " " ) , problem -> name ) ; add_prefix_cmd ( ( char * ) problem -> name , class_maintenance , set_internal_problem_cmd , set_doc , set_cmd_list , concat ( " " , problem -> name , " " , ( char * ) NULL ) , 0 , & maintenance_set_cmdlist ) ; add_prefix_cmd ( ( char * ) problem -> name , class_maintenance , show_internal_problem_cmd , show_doc , show_cmd_list , concat ( " " , problem -> name , " " , ( char * ) NULL ) , 0 , & maintenance_show_cmdlist ) ; set_doc = xstrprintf ( _ ( " " " " ) , problem -> name ) ; show_doc = xstrprintf ( _ ( " " " " ) , problem -> name ) ; add_setshow_enum_cmd ( " " , class_maintenance , internal_problem_modes , & problem -> should_quit , set_doc , show_doc , NULL , NULL , NULL , set_cmd_list , show_cmd_list ) ; xfree ( set_doc ) ; xfree ( show_doc ) ; set_doc = xstrprintf ( _ ( " " " " ) , problem -> name ) ; show_doc = xstrprintf ( _ ( " " " " ) , problem -> name ) ; add_setshow_enum_cmd ( " " , class_maintenance , internal_problem_modes , & problem -> should_dump_core , set_doc , show_doc , NULL , NULL , NULL , set_cmd_list , show_cmd_list ) ; xfree ( set_doc ) ; xfree ( show_doc ) ; }
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.
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 .
/*allow-unknown*/ /*allow-unknown*/ /* help_doc */ /* setfunc */ /* showfunc */ /* help_doc */ /* setfunc */ /* showfunc */