Don't assume break/continue inside a TRY block works
In C++, this: try { break; } catch (..) {} is invalid. However, because our TRY/CATCH macros support it in C, the C++ version of those macros support it too. To catch such assumptions, this adds a (disabled) hack that maps TRY/CATCH to raw C++ try/catch. Then it goes through all instances that building on x86_64 GNU/Linux trips on, fixing them. This isn't strictly necessary yet, but I think it's nicer to try to keep the tree in a state where it's easier to eliminate the TRY/CATCH macros. gdb/ChangeLog: 2015-10-29 Pedro Alves <palves@redhat.com> * dwarf2-frame-tailcall.c (dwarf2_tailcall_sniffer_first): Don't assume that "break" breaks out of a TRY/CATCH. * python/py-framefilter.c (py_print_single_arg): Don't assume "continue" breaks out of a TRY/CATCH. * python/py-value.c (valpy_binop_throw): New function, factored out from ... (valpy_binop): ... this. (valpy_richcompare_throw): New function, factored out from ... (valpy_richcompare): ... this. * solib.c (solib_read_symbols): Don't assume "break" breaks out of a TRY/CATCH. * common/common-exceptions.h [USE_RAW_CXX_TRY] <TRY/CATCH/END_CATCH>: Define as 1-1 wrappers around try/catch.
This commit is contained in:
parent
f82aa1657b
commit
9c6595ab68
6 changed files with 269 additions and 202 deletions
|
@ -448,37 +448,39 @@ py_print_single_arg (struct ui_out *out,
|
|||
{
|
||||
retval = EXT_LANG_BT_ERROR;
|
||||
do_cleanups (cleanups);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (val != NULL)
|
||||
annotate_arg_value (value_type (val));
|
||||
|
||||
/* If the output is to the CLI, and the user option "set print
|
||||
frame-arguments" is set to none, just output "...". */
|
||||
if (! ui_out_is_mi_like_p (out) && args_type == NO_VALUES)
|
||||
ui_out_field_string (out, "value", "...");
|
||||
else
|
||||
if (retval != EXT_LANG_BT_ERROR)
|
||||
{
|
||||
/* Otherwise, print the value for both MI and the CLI, except
|
||||
for the case of MI_PRINT_NO_VALUES. */
|
||||
if (args_type != NO_VALUES)
|
||||
{
|
||||
if (val == NULL)
|
||||
{
|
||||
gdb_assert (fa != NULL && fa->error != NULL);
|
||||
ui_out_field_fmt (out, "value",
|
||||
_("<error reading variable: %s>"),
|
||||
fa->error);
|
||||
}
|
||||
else if (py_print_value (out, val, opts, 0, args_type, language)
|
||||
== EXT_LANG_BT_ERROR)
|
||||
retval = EXT_LANG_BT_ERROR;
|
||||
}
|
||||
}
|
||||
if (val != NULL)
|
||||
annotate_arg_value (value_type (val));
|
||||
|
||||
do_cleanups (cleanups);
|
||||
/* If the output is to the CLI, and the user option "set print
|
||||
frame-arguments" is set to none, just output "...". */
|
||||
if (! ui_out_is_mi_like_p (out) && args_type == NO_VALUES)
|
||||
ui_out_field_string (out, "value", "...");
|
||||
else
|
||||
{
|
||||
/* Otherwise, print the value for both MI and the CLI, except
|
||||
for the case of MI_PRINT_NO_VALUES. */
|
||||
if (args_type != NO_VALUES)
|
||||
{
|
||||
if (val == NULL)
|
||||
{
|
||||
gdb_assert (fa != NULL && fa->error != NULL);
|
||||
ui_out_field_fmt (out, "value",
|
||||
_("<error reading variable: %s>"),
|
||||
fa->error);
|
||||
}
|
||||
else if (py_print_value (out, val, opts, 0, args_type, language)
|
||||
== EXT_LANG_BT_ERROR)
|
||||
retval = EXT_LANG_BT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
do_cleanups (cleanups);
|
||||
}
|
||||
}
|
||||
CATCH (except, RETURN_MASK_ERROR)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue