forked from Imagelibrary/binutils-gdb
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:
@@ -195,6 +195,14 @@ struct exception_try_scope
|
||||
void *saved_state;
|
||||
};
|
||||
|
||||
/* Define this to build with TRY/CATCH mapped directly to raw
|
||||
try/catch. GDB won't work correctly, but building that way catches
|
||||
code tryin to break/continue out of the try block, along with
|
||||
spurious code between the TRY and the CATCH block. */
|
||||
//#define USE_RAW_CXX_TRY
|
||||
|
||||
#ifndef USE_RAW_CXX_TRY
|
||||
|
||||
/* We still need to wrap TRY/CATCH in C++ so that cleanups and C++
|
||||
exceptions can coexist. The TRY blocked is wrapped in a
|
||||
do/while(0) so that break/continue within the block works the same
|
||||
@@ -216,6 +224,14 @@ struct exception_try_scope
|
||||
{ \
|
||||
exception_rethrow (); \
|
||||
}
|
||||
#else
|
||||
|
||||
#define TRY try
|
||||
#define CATCH(EXCEPTION, MASK) \
|
||||
catch (struct gdb_exception ## _ ## MASK &EXCEPTION)
|
||||
#define END_CATCH
|
||||
|
||||
#endif
|
||||
|
||||
/* The exception types client code may catch. They're just shims
|
||||
around gdb_exception that add nothing but type info. Which is used
|
||||
|
||||
Reference in New Issue
Block a user