Add new internal problem for demangler warnings

This commit adds a new category of internal problem for demangler
warnings.  Demangler warnings behave in much the same way as internal
warnings except that they do not create core files and no option to
change this is presented to the user.

gdb/
2014-06-19  Gary Benson  <gbenson@redhat.com>

	* utils.h (demangler_vwarning): New declaration.
	(demangler_warning): Likewise.
	* utils.c (struct internal_problem)
	<user_settable_should_quit>: New field.
	<user_settable_should_dump_core>: Likewise
	(internal_error_problem): Add values for above new fields.
	(internal_warning_problem): Likewise.
	(demangler_warning_problem): New static global.
	(demangler_vwarning): New function.
	(demangler_warning): Likewise.
	(add_internal_problem_command): Selectively add commands.
	(_initialize_utils): New internal problem command.
	* maint.c (maintenance_demangler_warning): New function.
	(_initialize_maint_cmds): New command.

gdb/doc/
2014-06-19  Gary Benson  <gbenson@redhat.com>

	* gdb.texinfo (Maintenance Commands): Document new
	"maint demangler-warning" command and new
	"maint set/show demangler-warning" option.
This commit is contained in:
Gary Benson 2014-06-19 09:10:44 +01:00
parent 45371d0cee
commit 57fcfb1b20
6 changed files with 132 additions and 44 deletions

View file

@ -659,7 +659,9 @@ static const char *const internal_problem_modes[] =
struct internal_problem
{
const char *name;
int user_settable_should_quit;
const char *should_quit;
int user_settable_should_dump_core;
const char *should_dump_core;
};
@ -794,7 +796,7 @@ internal_vproblem (struct internal_problem *problem,
}
static struct internal_problem internal_error_problem = {
"internal-error", internal_problem_ask, internal_problem_ask
"internal-error", 1, internal_problem_ask, 1, internal_problem_ask
};
void
@ -815,7 +817,7 @@ internal_error (const char *file, int line, const char *string, ...)
}
static struct internal_problem internal_warning_problem = {
"internal-warning", internal_problem_ask, internal_problem_ask
"internal-warning", 1, internal_problem_ask, 1, internal_problem_ask
};
void
@ -834,6 +836,26 @@ internal_warning (const char *file, int line, const char *string, ...)
va_end (ap);
}
static struct internal_problem demangler_warning_problem = {
"demangler-warning", 1, internal_problem_ask, 0, internal_problem_no
};
void
demangler_vwarning (const char *file, int line, const char *fmt, va_list ap)
{
internal_vproblem (&demangler_warning_problem, file, line, fmt, ap);
}
void
demangler_warning (const char *file, int line, const char *string, ...)
{
va_list ap;
va_start (ap, string);
demangler_vwarning (file, line, string, ap);
va_end (ap);
}
/* Dummy functions to keep add_prefix_cmd happy. */
static void
@ -894,45 +916,51 @@ add_internal_problem_command (struct internal_problem *problem)
(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);
if (problem->user_settable_should_quit)
{
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);
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);
if (problem->user_settable_should_dump_core)
{
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);
xfree (set_doc);
xfree (show_doc);
}
}
/* Return a newly allocated string, containing the PREFIX followed
@ -3529,4 +3557,5 @@ _initialize_utils (void)
{
add_internal_problem_command (&internal_error_problem);
add_internal_problem_command (&internal_warning_problem);
add_internal_problem_command (&demangler_warning_problem);
}