Skip to content

Commit 38dc285

Browse files
committed
Fix stdin ending up not registered after a Quit
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 <palves@redhat.com> * inf-loop.c (inferior_event_handler): Don't swallow the exception if the prompt is blocked.
1 parent 688fca4 commit 38dc285

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

gdb/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2017-11-16 Pedro Alves <palves@redhat.com>
2+
3+
* inf-loop.c (inferior_event_handler): Don't swallow the exception
4+
if the prompt is blocked.
5+
16
2017-11-16 Pedro Alves <palves@redhat.com>
27

38
* breakpoint.c (insert_bp_location): Replace bp_err and

gdb/inf-loop.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,15 @@ inferior_event_handler (enum inferior_event_type event_type,
7373
}
7474
CATCH (e, RETURN_MASK_ALL)
7575
{
76-
exception_print (gdb_stderr, e);
76+
/* If the user was running a foreground execution
77+
command, then propagate the error so that the prompt
78+
can be reenabled. Otherwise, the user already has
79+
the prompt and is typing some unrelated command, so
80+
just inform the user and swallow the exception. */
81+
if (current_ui->prompt_state == PROMPT_BLOCKED)
82+
throw_exception (e);
83+
else
84+
exception_print (gdb_stderr, e);
7785
}
7886
END_CATCH
7987
}

0 commit comments

Comments
 (0)