Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 在bash进程的输入完成后,如何继续发送到stdin?_Linux_Bash_Gdb_Pipe_Stdin - Fatal编程技术网

Linux 在bash进程的输入完成后,如何继续发送到stdin?

Linux 在bash进程的输入完成后,如何继续发送到stdin?,linux,bash,gdb,pipe,stdin,Linux,Bash,Gdb,Pipe,Stdin,我使用的是gdb 我运行如下命令,通过向stdin发送输入来设置程序: r

我使用的是
gdb

我运行如下命令,通过向stdin发送输入来设置程序:


r<这听起来像是你的工作

给定

以下是会议:

$ ./t.exp
spawn gdb -q ./a.out
run
1
2
3
Reading symbols from ./a.out...done.
(gdb) run
Starting program: /tmp/a.out
got: 1
got: 2
got: 3
现在脚本正在等待我的输入。我提供一些:

foo bar baz
got: foo bar baz
我还可以与GDB交互:

^C
Program received signal SIGINT, Interrupt.
0x00007ffff7b006b0 in __read_nocancel () at ../sysdeps/unix/syscall-template.S:81
81  ../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb) bt
#0  0x00007ffff7b006b0 in __read_nocancel () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007ffff7a8f5a0 in _IO_new_file_underflow (fp=0x7ffff7dd4640 <_IO_2_1_stdin_>) at fileops.c:613
#2  0x00007ffff7a840d5 in _IO_getdelim (lineptr=0x7fffffffdda0, n=0x7fffffffdda8, delimiter=10, fp=0x7ffff7dd4640 <_IO_2_1_stdin_>) at iogetdelim.c:77
#3  0x000000000040064e in main () at t.c:9
^C
程序收到信号SIGINT,中断。
0x00007FF7B006B0位于../sysdeps/unix/syscall template.S:81处的uu read_nocancel()中
81../sysdeps/unix/syscall template.S:没有这样的文件或目录。
(gdb)英国电信
#0 0x00007FF7B006B0在../sysdeps/unix/syscall template.S:81处的uu read_nocancel()中
#1 0x00007FF7A8F5A0,位于fileops.c:613处的新文件下溢(fp=0x7ffff7dd4640)
#iogetdelim处的2个0x00007ffff7a840d5 in_IO_getdelim(lineptr=0x7fffffffdda0,n=0x7fffffffdda8,分隔符=10,fp=0x7ffff7dd4640)。c:77
#t.c:9处的3 0x0000000000040064E主管道()中

我喜欢这个答案,尽管我仍然希望从gdb内部得到一个简单的答案。
foo bar baz
got: foo bar baz
^C
Program received signal SIGINT, Interrupt.
0x00007ffff7b006b0 in __read_nocancel () at ../sysdeps/unix/syscall-template.S:81
81  ../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb) bt
#0  0x00007ffff7b006b0 in __read_nocancel () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007ffff7a8f5a0 in _IO_new_file_underflow (fp=0x7ffff7dd4640 <_IO_2_1_stdin_>) at fileops.c:613
#2  0x00007ffff7a840d5 in _IO_getdelim (lineptr=0x7fffffffdda0, n=0x7fffffffdda8, delimiter=10, fp=0x7ffff7dd4640 <_IO_2_1_stdin_>) at iogetdelim.c:77
#3  0x000000000040064e in main () at t.c:9