From 9c6595ab6873e15fe533b05bb7b98c11f17c5d57 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 29 Oct 2015 12:55:01 +0000 Subject: 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 * 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] : Define as 1-1 wrappers around try/catch. --- gdb/dwarf2-frame-tailcall.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'gdb/dwarf2-frame-tailcall.c') diff --git a/gdb/dwarf2-frame-tailcall.c b/gdb/dwarf2-frame-tailcall.c index 952bc14..613cc34 100644 --- a/gdb/dwarf2-frame-tailcall.c +++ b/gdb/dwarf2-frame-tailcall.c @@ -386,13 +386,15 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame, /* call_site_find_chain can throw an exception. */ chain = call_site_find_chain (prev_gdbarch, prev_pc, this_pc); - if (entry_cfa_sp_offsetp == NULL) - break; - sp_regnum = gdbarch_sp_regnum (prev_gdbarch); - if (sp_regnum == -1) - break; - prev_sp = frame_unwind_register_unsigned (this_frame, sp_regnum); - prev_sp_p = 1; + if (entry_cfa_sp_offsetp != NULL) + { + sp_regnum = gdbarch_sp_regnum (prev_gdbarch); + if (sp_regnum != -1) + { + prev_sp = frame_unwind_register_unsigned (this_frame, sp_regnum); + prev_sp_p = 1; + } + } } CATCH (except, RETURN_MASK_ERROR) { -- cgit v1.1