forked from Imagelibrary/binutils-gdb
target_terminal::ours_for_output before printing signal received
A following patch will make GDB put spawned inferiors in their own terminal/session (on GNU/Linux). In that case, GDB is in control of when is the inferior's output flushed to the screen. A sync point is when target_terminal state goes from inferior -> ours/ours_for_output. The gdb.multi/multi-term-settings.exp testcase exposed a bug where an inferior output flush is missing, resulting in this regression: Good: (gdb) PASS: gdb.multi/multi-term-settings.exp: inf1_how=run-share: inf2_how=run-session: info inferiors continue Continuing. pid=1275538, count=0 pid=1276069, count=0 Thread 1.1 "multi-term-sett" received signal SIGTTOU, Stopped (tty output). [Switching to process 1275538] 0x00007ffff7ecda14 in __tcsetattr (fd=0, optional_actions=0, termios_p=0x7fffffffd450) at ../sysdeps/unix/sysv/linux/tcsetattr.c:83 83 ../sysdeps/unix/sysv/linux/tcsetattr.c: No such file or directory. (gdb) PASS: gdb.multi/multi-term-settings.exp: inf1_how=run-share: inf2_how=run-session: continue (expected SIGTTOU) Quit (gdb) PASS: gdb.multi/multi-term-settings.exp: inf1_how=run-share: inf2_how=run-session: stop with control-c (Quit) Bad: (gdb) PASS: gdb.multi/multi-term-settings.exp: inf1_how=run-share: inf2_how=run-session: info inferiors continue Continuing. pid=1287638, count=0 Thread 1.1 "multi-term-sett" received signal SIGTTOU, Stopped (tty output). pid=1287663, count=0 <<<<<< HERE [Switching to process 1287638] 0x00007ffff7ecda14 in __tcsetattr (fd=0, optional_actions=0, termios_p=0x7fffffffd450) at ../sysdeps/unix/sysv/linux/tcsetattr.c:83 83 ../sysdeps/unix/sysv/linux/tcsetattr.c: No such file or directory. (gdb) FAIL: gdb.multi/multi-term-settings.exp: inf1_how=run-share: inf2_how=run-session: continue Quit (gdb) PASS: gdb.multi/multi-term-settings.exp: inf1_how=run-share: inf2_how=run-session: stop with control-c (Quit) Notice the "<<<<<< HERE" line in the "Bad" output above -- that is inferior output being printed on the screen _after_ GDB says the thread stopped... That's obviously bogus, the output was printed by the inferior before it was stopped. The fix is to claim back the terminal for output before printing the "signal received SIGTTOU" message. gdb/ChangeLog: yyyy-mm-dd Pedro Alves <pedro@palves.net> * infrun.c (normal_stop): Call target_terminal::ours_for_output before calling signal_received observers. Change-Id: Iea106c33b4c585562fc3579ca85d43481fa214f0
This commit is contained in:
@@ -8537,7 +8537,10 @@ normal_stop (void)
|
|||||||
update_thread_list ();
|
update_thread_list ();
|
||||||
|
|
||||||
if (last.kind == TARGET_WAITKIND_STOPPED && stopped_by_random_signal)
|
if (last.kind == TARGET_WAITKIND_STOPPED && stopped_by_random_signal)
|
||||||
|
{
|
||||||
|
target_terminal::ours_for_output ();
|
||||||
gdb::observers::signal_received.notify (inferior_thread ()->suspend.stop_signal);
|
gdb::observers::signal_received.notify (inferior_thread ()->suspend.stop_signal);
|
||||||
|
}
|
||||||
|
|
||||||
/* As with the notification of thread events, we want to delay
|
/* As with the notification of thread events, we want to delay
|
||||||
notifying the user that we've switched thread context until
|
notifying the user that we've switched thread context until
|
||||||
|
|||||||
Reference in New Issue
Block a user