mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-28 07:08:01 +08:00
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:
@ -1,3 +1,20 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2014-06-18 Tom Tromey <tromey@redhat.com>
|
2014-06-18 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* f-valprint.c (info_common_command_for_block): Update.
|
* f-valprint.c (info_common_command_for_block): Update.
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2014-06-09 Siva Chandra Reddy <sivachandra@google.com>
|
2014-06-09 Siva Chandra Reddy <sivachandra@google.com>
|
||||||
|
|
||||||
* python.texi (Xmethod API): Add space before the opening
|
* python.texi (Xmethod API): Add space before the opening
|
||||||
|
@ -33268,13 +33268,18 @@ with the @code{SIGQUIT} signal.
|
|||||||
|
|
||||||
@kindex maint internal-error
|
@kindex maint internal-error
|
||||||
@kindex maint internal-warning
|
@kindex maint internal-warning
|
||||||
|
@kindex maint demangler-warning
|
||||||
|
@cindex demangler crashes
|
||||||
@item maint internal-error @r{[}@var{message-text}@r{]}
|
@item maint internal-error @r{[}@var{message-text}@r{]}
|
||||||
@itemx maint internal-warning @r{[}@var{message-text}@r{]}
|
@itemx maint internal-warning @r{[}@var{message-text}@r{]}
|
||||||
Cause @value{GDBN} to call the internal function @code{internal_error}
|
@itemx maint demangler-warning @r{[}@var{message-text}@r{]}
|
||||||
or @code{internal_warning} and hence behave as though an internal error
|
|
||||||
or internal warning has been detected. In addition to reporting the
|
Cause @value{GDBN} to call the internal function @code{internal_error},
|
||||||
internal problem, these functions give the user the opportunity to
|
@code{internal_warning} or @code{demangler_warning} and hence behave
|
||||||
either quit @value{GDBN} or create a core file of the current
|
as though an internal problam has been detected. In addition to
|
||||||
|
reporting the internal problem, these functions give the user the
|
||||||
|
opportunity to either quit @value{GDBN} or (for @code{internal_error}
|
||||||
|
and @code{internal_warning}) create a core file of the current
|
||||||
@value{GDBN} session.
|
@value{GDBN} session.
|
||||||
|
|
||||||
These commands take an optional parameter @var{message-text} that is
|
These commands take an optional parameter @var{message-text} that is
|
||||||
@ -33294,15 +33299,20 @@ Create a core file? (y or n) @kbd{n}
|
|||||||
|
|
||||||
@cindex @value{GDBN} internal error
|
@cindex @value{GDBN} internal error
|
||||||
@cindex internal errors, control of @value{GDBN} behavior
|
@cindex internal errors, control of @value{GDBN} behavior
|
||||||
|
@cindex demangler crashes
|
||||||
|
|
||||||
@kindex maint set internal-error
|
@kindex maint set internal-error
|
||||||
@kindex maint show internal-error
|
@kindex maint show internal-error
|
||||||
@kindex maint set internal-warning
|
@kindex maint set internal-warning
|
||||||
@kindex maint show internal-warning
|
@kindex maint show internal-warning
|
||||||
|
@kindex maint set demangler-warning
|
||||||
|
@kindex maint show demangler-warning
|
||||||
@item maint set internal-error @var{action} [ask|yes|no]
|
@item maint set internal-error @var{action} [ask|yes|no]
|
||||||
@itemx maint show internal-error @var{action}
|
@itemx maint show internal-error @var{action}
|
||||||
@itemx maint set internal-warning @var{action} [ask|yes|no]
|
@itemx maint set internal-warning @var{action} [ask|yes|no]
|
||||||
@itemx maint show internal-warning @var{action}
|
@itemx maint show internal-warning @var{action}
|
||||||
|
@itemx maint set demangler-warning @var{action} [ask|yes|no]
|
||||||
|
@itemx maint show demangler-warning @var{action}
|
||||||
When @value{GDBN} reports an internal problem (error or warning) it
|
When @value{GDBN} reports an internal problem (error or warning) it
|
||||||
gives the user the opportunity to both quit @value{GDBN} and create a
|
gives the user the opportunity to both quit @value{GDBN} and create a
|
||||||
core file of the current @value{GDBN} session. These commands let you
|
core file of the current @value{GDBN} session. These commands let you
|
||||||
@ -33316,7 +33326,10 @@ quit. The default is to ask the user what to do.
|
|||||||
|
|
||||||
@item corefile
|
@item corefile
|
||||||
You can specify that @value{GDBN} should always (yes) or never (no)
|
You can specify that @value{GDBN} should always (yes) or never (no)
|
||||||
create a core file. The default is to ask the user what to do.
|
create a core file. The default is to ask the user what to do. Note
|
||||||
|
that there is no @code{corefile} option for @code{demangler-warning}:
|
||||||
|
demangler warnings always create a core file and this cannot be
|
||||||
|
disabled.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@kindex maint packet
|
@kindex maint packet
|
||||||
|
15
gdb/maint.c
15
gdb/maint.c
@ -131,6 +131,15 @@ maintenance_internal_warning (char *args, int from_tty)
|
|||||||
internal_warning (__FILE__, __LINE__, "%s", (args == NULL ? "" : args));
|
internal_warning (__FILE__, __LINE__, "%s", (args == NULL ? "" : args));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Stimulate the internal error mechanism that GDB uses when an
|
||||||
|
demangler problem is detected. Allows testing of the mechanism. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
maintenance_demangler_warning (char *args, int from_tty)
|
||||||
|
{
|
||||||
|
demangler_warning (__FILE__, __LINE__, "%s", (args == NULL ? "" : args));
|
||||||
|
}
|
||||||
|
|
||||||
/* Someday we should allow demangling for things other than just
|
/* Someday we should allow demangling for things other than just
|
||||||
explicit strings. For example, we might want to be able to specify
|
explicit strings. For example, we might want to be able to specify
|
||||||
the address of a string in either GDB's process space or the
|
the address of a string in either GDB's process space or the
|
||||||
@ -1055,6 +1064,12 @@ Give GDB an internal warning.\n\
|
|||||||
Cause GDB to behave as if an internal warning was reported."),
|
Cause GDB to behave as if an internal warning was reported."),
|
||||||
&maintenancelist);
|
&maintenancelist);
|
||||||
|
|
||||||
|
add_cmd ("demangler-warning", class_maintenance,
|
||||||
|
maintenance_demangler_warning, _("\
|
||||||
|
Give GDB a demangler warning.\n\
|
||||||
|
Cause GDB to behave as if a demangler warning was reported."),
|
||||||
|
&maintenancelist);
|
||||||
|
|
||||||
add_cmd ("demangle", class_maintenance, maintenance_demangle, _("\
|
add_cmd ("demangle", class_maintenance, maintenance_demangle, _("\
|
||||||
Demangle a C++/ObjC mangled name.\n\
|
Demangle a C++/ObjC mangled name.\n\
|
||||||
Call internal GDB demangler routine to demangle a C++ link name\n\
|
Call internal GDB demangler routine to demangle a C++ link name\n\
|
||||||
|
105
gdb/utils.c
105
gdb/utils.c
@ -659,7 +659,9 @@ static const char *const internal_problem_modes[] =
|
|||||||
struct internal_problem
|
struct internal_problem
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
|
int user_settable_should_quit;
|
||||||
const char *should_quit;
|
const char *should_quit;
|
||||||
|
int user_settable_should_dump_core;
|
||||||
const char *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 = {
|
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
|
void
|
||||||
@ -815,7 +817,7 @@ internal_error (const char *file, int line, const char *string, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct internal_problem internal_warning_problem = {
|
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
|
void
|
||||||
@ -834,6 +836,26 @@ internal_warning (const char *file, int line, const char *string, ...)
|
|||||||
va_end (ap);
|
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. */
|
/* Dummy functions to keep add_prefix_cmd happy. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -894,45 +916,51 @@ add_internal_problem_command (struct internal_problem *problem)
|
|||||||
(char *) NULL),
|
(char *) NULL),
|
||||||
0/*allow-unknown*/, &maintenance_show_cmdlist);
|
0/*allow-unknown*/, &maintenance_show_cmdlist);
|
||||||
|
|
||||||
set_doc = xstrprintf (_("Set whether GDB should quit "
|
if (problem->user_settable_should_quit)
|
||||||
"when an %s is detected"),
|
{
|
||||||
problem->name);
|
set_doc = xstrprintf (_("Set whether GDB should quit "
|
||||||
show_doc = xstrprintf (_("Show whether GDB will quit "
|
"when an %s is detected"),
|
||||||
"when an %s is detected"),
|
problem->name);
|
||||||
problem->name);
|
show_doc = xstrprintf (_("Show whether GDB will quit "
|
||||||
add_setshow_enum_cmd ("quit", class_maintenance,
|
"when an %s is detected"),
|
||||||
internal_problem_modes,
|
problem->name);
|
||||||
&problem->should_quit,
|
add_setshow_enum_cmd ("quit", class_maintenance,
|
||||||
set_doc,
|
internal_problem_modes,
|
||||||
show_doc,
|
&problem->should_quit,
|
||||||
NULL, /* help_doc */
|
set_doc,
|
||||||
NULL, /* setfunc */
|
show_doc,
|
||||||
NULL, /* showfunc */
|
NULL, /* help_doc */
|
||||||
set_cmd_list,
|
NULL, /* setfunc */
|
||||||
show_cmd_list);
|
NULL, /* showfunc */
|
||||||
|
set_cmd_list,
|
||||||
|
show_cmd_list);
|
||||||
|
|
||||||
xfree (set_doc);
|
xfree (set_doc);
|
||||||
xfree (show_doc);
|
xfree (show_doc);
|
||||||
|
}
|
||||||
|
|
||||||
set_doc = xstrprintf (_("Set whether GDB should create a core "
|
if (problem->user_settable_should_dump_core)
|
||||||
"file of GDB when %s is detected"),
|
{
|
||||||
problem->name);
|
set_doc = xstrprintf (_("Set whether GDB should create a core "
|
||||||
show_doc = xstrprintf (_("Show whether GDB will create a core "
|
"file of GDB when %s is detected"),
|
||||||
"file of GDB when %s is detected"),
|
problem->name);
|
||||||
problem->name);
|
show_doc = xstrprintf (_("Show whether GDB will create a core "
|
||||||
add_setshow_enum_cmd ("corefile", class_maintenance,
|
"file of GDB when %s is detected"),
|
||||||
internal_problem_modes,
|
problem->name);
|
||||||
&problem->should_dump_core,
|
add_setshow_enum_cmd ("corefile", class_maintenance,
|
||||||
set_doc,
|
internal_problem_modes,
|
||||||
show_doc,
|
&problem->should_dump_core,
|
||||||
NULL, /* help_doc */
|
set_doc,
|
||||||
NULL, /* setfunc */
|
show_doc,
|
||||||
NULL, /* showfunc */
|
NULL, /* help_doc */
|
||||||
set_cmd_list,
|
NULL, /* setfunc */
|
||||||
show_cmd_list);
|
NULL, /* showfunc */
|
||||||
|
set_cmd_list,
|
||||||
|
show_cmd_list);
|
||||||
|
|
||||||
xfree (set_doc);
|
xfree (set_doc);
|
||||||
xfree (show_doc);
|
xfree (show_doc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a newly allocated string, containing the PREFIX followed
|
/* 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_error_problem);
|
||||||
add_internal_problem_command (&internal_warning_problem);
|
add_internal_problem_command (&internal_warning_problem);
|
||||||
|
add_internal_problem_command (&demangler_warning_problem);
|
||||||
}
|
}
|
||||||
|
@ -311,6 +311,14 @@ extern void internal_warning (const char *file, int line,
|
|||||||
extern void warning (const char *, ...) ATTRIBUTE_PRINTF (1, 2);
|
extern void warning (const char *, ...) ATTRIBUTE_PRINTF (1, 2);
|
||||||
|
|
||||||
extern void vwarning (const char *, va_list args) ATTRIBUTE_PRINTF (1, 0);
|
extern void vwarning (const char *, va_list args) ATTRIBUTE_PRINTF (1, 0);
|
||||||
|
|
||||||
|
extern void demangler_vwarning (const char *file, int line,
|
||||||
|
const char *, va_list ap)
|
||||||
|
ATTRIBUTE_PRINTF (3, 0);
|
||||||
|
|
||||||
|
extern void demangler_warning (const char *file, int line,
|
||||||
|
const char *, ...) ATTRIBUTE_PRINTF (3, 4);
|
||||||
|
|
||||||
|
|
||||||
/* Misc. utilities. */
|
/* Misc. utilities. */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user