diff options
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/tui/tui.c | 27 |
2 files changed, 26 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6767931..88c18e0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2014-10-29 Pedro Alves <palves@redhat.com> + + * tui/tui.c (tui_rl_switch_mode): Wrap tui_enable/tui_disable in + TRY_CATCH. + 2014-10-29 Joel Brobecker <brobecker@adacore.com> * arm-tdep.c (arm_skip_stack_protector): Return early if diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index ca66ccd..cb85fb0 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -90,15 +90,30 @@ static Keymap tui_readline_standard_keymap; static int tui_rl_switch_mode (int notused1, int notused2) { - if (tui_active) + volatile struct gdb_exception ex; + + /* Don't let exceptions escape. We're in the middle of a readline + callback that isn't prepared for that. */ + TRY_CATCH (ex, RETURN_MASK_ALL) { - tui_disable (); - rl_prep_terminal (0); + if (tui_active) + { + tui_disable (); + rl_prep_terminal (0); + } + else + { + /* If tui_enable throws, we'll re-prep below. */ + rl_deprep_terminal (); + tui_enable (); + } } - else + if (ex.reason < 0) { - rl_deprep_terminal (); - tui_enable (); + exception_print (gdb_stderr, ex); + + if (!tui_active) + rl_prep_terminal (0); } /* Clear the readline in case switching occurred in middle of |