diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 23403b6cfe..766d1531de 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2017-11-16 Pedro Alves + + * inf-loop.c (inferior_event_handler): Don't swallow the exception + if the prompt is blocked. + 2017-11-16 Pedro Alves * breakpoint.c (insert_bp_location): Replace bp_err and diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c index bb9fa011ee..1d573b947d 100644 --- a/gdb/inf-loop.c +++ b/gdb/inf-loop.c @@ -73,7 +73,15 @@ inferior_event_handler (enum inferior_event_type event_type, } CATCH (e, RETURN_MASK_ALL) { - exception_print (gdb_stderr, e); + /* If the user was running a foreground execution + command, then propagate the error so that the prompt + can be reenabled. Otherwise, the user already has + the prompt and is typing some unrelated command, so + just inform the user and swallow the exception. */ + if (current_ui->prompt_state == PROMPT_BLOCKED) + throw_exception (e); + else + exception_print (gdb_stderr, e); } END_CATCH }