diff mbox

[V2,PR,gdb/8527] Fix interrupt (^C) in Solaris

Message ID CAEJ-0i_o+UXieWiVMG4ajMtMZteVzLCw9kHz6gY9sw7mLWQsWA@mail.gmail.com
State New
Headers show

Commit Message

Brian Vandenberg Jan. 5, 2016, 7:43 p.m. UTC
This patch addresses an issue in Solaris, bug 8527.

This is my second submission for this issue with
changes recommended by Joel Brobecker:

* changelog formatting
* comments explaining reason for the change

The problem:

If gdb attaches to a process that either has no controlling
terminal, or the controlling terminal differs from the one
gdb is running under, hitting ^C doesn't interrupt the
debugged process.

The change makes it possible to interrupt/resume
without any apparent problems, but I don't know the
ramifications of these changes.  I ran across this
issue and a fix that was proposed 12 years ago.

Joel indicates this change has been in the Adacore
GDB branch for quite a long time.

Lastly:

* I don't have DejaGNU and I cannot get it built/installed
in a short time frame.  Suffice it to say this isn't a near-term
option.  I'm sorry, I would have ran the tests if I could.
* I'm working on an airgapped machine.  These changes
were hand-copied.  I won't be able to push these changes
myself.

-brian
gdb/Changelog:
2016-01-05  Brian Vandenberg  <phantall@gmail.com>

	PR gdb/8527
	* procfs.c (proc_wait_for_stop): calls to set_sigint_trap and
	clear_sigint_trap.
diff mbox

Patch

diff --git a/gdb/procfs.c b/gdb/procfs.c
index 7b7ff45..7cd870c 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -1487,7 +1487,12 @@  proc_wait_for_stop (procinfo *pi)
   {
     procfs_ctl_t cmd = PCWSTOP;

+    /* PR gdb/8527
+     * Was not correctly interrupting the inferior process
+     * when ^C was pressed in the debug terminal.
+     */
+    set_sigint_trap();
+
     win = (write (pi->ctl_fd, (char *) &cmd, sizeof (cmd)) == sizeof (cmd));
+
+    /* PR gdb/8527 */
+    clear_sigint_trap();
+
     /* We been runnin' and we stopped -- need to update status.  */
     pi->status_valid = 0;
   }