Bug 17224

Summary: segv from "set interactive-mode on" plus feeding script to stdin
Product: gdb Reporter: dje
Component: gdbAssignee: Not yet assigned to anyone <unassigned>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: HEAD   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description dje 2014-08-01 19:13:48 UTC
testcase: forever-threads from pr 17147

@ruffy:gdb$ cat foo.gdb
set trace-commands on
show interactive-mode
set interactive-mode on
#set non-stop on
file ~/src/play/forever-threads.x64
run &
shell sleep 3
info threads
@ruffy:gdb$ ./gdb -D ./data-directory < foo.gdb
GNU gdb (GDB) 7.8.50.20140731-cvs
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) (gdb) +show interactive-mode
Debugger's interactive mode is auto (currently off).
(gdb) +set interactive-mode on
(gdb) (gdb) +file ~/src/play/forever-threads.x64
Reading symbols from ~/src/play/forever-threads.x64...done.
(gdb) +run &
Starting program: /home/dje/src/play/forever-threads.x64
Segmentation fault

Backtrace:

(top-gdb) bt
#0  0x00000000004bfc4c in hardwire_copy_tty_state (scb=0xecabe0, ttystate=0x0) at ../../experiment/gdb/ser-unix.c:200
#1  0x0000000000729401 in serial_copy_tty_state (scb=0xecabe0, ttystate=0x0) at ../../experiment/gdb/serial.c:491
#2  0x000000000077dc26 in child_terminal_init_with_pgrp (pgrp=21249) at ../../experiment/gdb/inflow.c:231
#3  0x000000000077dcb1 in child_terminal_init (self=0xd65100) at ../../experiment/gdb/inflow.c:265
#4  0x0000000000651daa in delegate_terminal_init (self=0xd65100) at ../../experiment/gdb/target-delegates.c:731
#5  0x00000000004c2fc3 in startup_inferior (ntraps=1) at ../../experiment/gdb/fork-child.c:512
#6  0x00000000004c13f4 in inf_ptrace_create_inferior (ops=0xd65100, exec_file=0x1022840 "/home/dje/src/play/forever-threads.x64", allargs=0x1052620 "", env=0xec\
76a0, from_tty=1) at ../../experiment/gdb/inf-ptrace.c:140
#7  0x00000000004c7ff9 in linux_nat_create_inferior (ops=0xd65100, exec_file=0x1022840 "/home/dje/src/play/forever-threads.x64", allargs=0x1052620 "", env=0xec7\
6a0, from_tty=1) at ../../experiment/gdb/linux-nat.c:1318
#8  0x0000000000601a89 in run_command_1 (args=0x0, from_tty=1, tbreak_at_main=0) at ../../experiment/gdb/infcmd.c:605
#9  0x0000000000601b8e in run_command (args=0xcdcdb4 "&", from_tty=1) at ../../experiment/gdb/infcmd.c:640
#10 0x000000000050c526 in do_cfunc (c=0xd9a180, args=0xcdcdb4 "&", from_tty=1) at ../../experiment/gdb/cli/cli-decode.c:107
#11 0x000000000050f613 in cmd_func (cmd=0xd9a180, args=0xcdcdb4 "&", from_tty=1) at ../../experiment/gdb/cli/cli-decode.c:1885
#12 0x00000000007354a2 in execute_command (p=0xcdcdb4 "&", from_tty=1) at ../../experiment/gdb/top.c:462
#13 0x000000000062d325 in command_handler (command=0xcdcdb0 "") at ../../experiment/gdb/event-top.c:433
#14 0x000000000062d8de in command_line_handler (rl=0x1054f20 "") at ../../experiment/gdb/event-top.c:630
#15 0x000000000062da65 in gdb_readline2 (client_data=0x0) at ../../experiment/gdb/event-top.c:711
#16 0x000000000062d237 in stdin_event_handler (error=0, client_data=0x0) at ../../experiment/gdb/event-top.c:373
#17 0x000000000062be2c in handle_file_event (data=...) at ../../experiment/gdb/event-loop.c:766
#18 0x000000000062b313 in process_event () at ../../experiment/gdb/event-loop.c:343
#19 0x000000000062b3b5 in gdb_do_one_event () at ../../experiment/gdb/event-loop.c:395
#20 0x000000000062b42a in start_event_loop () at ../../experiment/gdb/event-loop.c:432
#21 0x000000000062ce93 in cli_command_loop (data=0x0) at ../../experiment/gdb/event-top.c:182
#22 0x0000000000623853 in current_interp_command_loop () at ../../experiment/gdb/interps.c:328
#23 0x000000000062438d in captured_command_loop (data=0x0) at ../../experiment/gdb/main.c:324
#24 0x00000000006206e1 in catch_errors (func=0x624372 <captured_command_loop>, func_args=0x0, errstring=0x9feb4d "", mask=RETURN_MASK_ALL) at ../../experiment/g\
db/exceptions.c:516
#25 0x00000000006258dc in captured_main (data=0x7fffffffe680) at ../../experiment/gdb/main.c:1180
#26 0x00000000006206e1 in catch_errors (func=0x624769 <captured_main>, func_args=0x7fffffffe680, errstring=0x9feb4d "", mask=RETURN_MASK_ALL) at ../../experimen\
t/gdb/exceptions.c:516
#27 0x0000000000625905 in gdb_main (args=0x7fffffffe680) at ../../experiment/gdb/main.c:1188
#28 0x00000000004737b7 in main (argc=3, argv=0x7fffffffe788) at ../../experiment/gdb/gdb.c:33