Discussion:
[Bug gdb/23020] New: GDB gets stopped by SIGTTOU when breakpoint insertion in fork child fails
simon.marchi at ericsson dot com
2018-03-30 14:53:28 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23020

Bug ID: 23020
Summary: GDB gets stopped by SIGTTOU when breakpoint insertion
in fork child fails
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: simon.marchi at ericsson dot com
Target Milestone: ---

This bug started with commit e671cd59d74c ("Per-inferior target_terminal state,
fix PR gdb/13211, more"). Here's how I can reproduce:

$ cat test.c
#include <unistd.h>

static void
break_here ()
{
}

int
main (int argc, char *argv[])
{
fork ();

break_here();

return 0;
}
$ gcc test.c -g3 -O0 -o test -pie
$ ./gdb -nx -q --data-directory=data-directory test -ex "set detach-on-fork
off" -ex "b break_here" -ex "set non-stop on"
Reading symbols from test...done.
Breakpoint 1 at 0x64e: file test.c, line 6.
(gdb) r
Starting program: /home/simark/build/binutils-gdb-one-target/gdb/test
[New process 1465]
Reading symbols from
/home/simark/build/binutils-gdb-one-target/gdb/test...done.
[2] + 1451 suspended (tty output) ./gdb -nx -q
--data-directory=data-directory test -ex "set detach-on-fork off
$ fg
[2] - 1451 continued ./gdb -nx -q --data-directory=data-directory test -ex
"set detach-on-fork off
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x64a

(gdb)


To be clear, the bug here is that GDB gets stopped by SIGTTOU. The fact that
the breakpoint fails to be inserted is another bug that should get looked at
separately. It just happens to trigger the terminal output bug.

I suspect that GDB tries to do some output while the terminal is owned by the
inferior.
--
You are receiving this mail because:
You are on the CC list for the bug.
b7.10110111 at gmail dot com
2018-05-23 09:49:04 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23020

Ruslan <b7.10110111 at gmail dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |b7.10110111 at gmail dot com
--
You are receiving this mail because:
You are on the CC list for the bug.
vries at gcc dot gnu.org
2018-07-20 08:58:07 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23020

Tom de Vries <vries at gcc dot gnu.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |vries at gcc dot gnu.org

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
*** Bug 23368 has been marked as a duplicate of this bug. ***
--
You are receiving this mail because:
You are on the CC list for the bug.
simon.marchi at ericsson dot com
2018-07-23 14:10:01 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23020

--- Comment #2 from Simon Marchi <simon.marchi at ericsson dot com> ---
I'm not entirely sure that this bug and 23368 share the same root cause. The
symptom is the same, we try to write or change terminal settings while the
terminal is "owned" by the inferior, which leads to SIGTTOU. However, the root
cause for why we ended up doing that can be quite different. I'm currently
debugging the "set follow-exec-mode new" case of 23368 and have the feeling
it's not related to this one, so I will re-open 23368.
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...