Skip to content

Commit

Permalink
Fix stdin ending up not registered after a Quit
Browse files Browse the repository at this point in the history
If you press Ctrl-C while GDB is processing breakpoint commands the
TRY/CATCH in inferior_event_handler catches the Quit exception and
prints it, and then if the interpreter was running a foreground
execution command, nothing re-adds stdin back in the event loop,
meaning the debug session ends up busted, because the user can't type
anything...

This was exposed by the new gdb.base/bp-cmds-continue-ctrl-c.exp
testcase added later in the series.

gdb/ChangeLog:
2017-11-16  Pedro Alves  <[email protected]>

	* inf-loop.c (inferior_event_handler): Don't swallow the exception
	if the prompt is blocked.
  • Loading branch information
palves committed Nov 16, 2017
1 parent 688fca4 commit 38dc285
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions gdb/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2017-11-16 Pedro Alves <[email protected]>

* inf-loop.c (inferior_event_handler): Don't swallow the exception
if the prompt is blocked.

2017-11-16 Pedro Alves <[email protected]>

* breakpoint.c (insert_bp_location): Replace bp_err and
Expand Down
10 changes: 9 additions & 1 deletion gdb/inf-loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 38dc285

Please sign in to comment.