Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/27.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 gdb远程调试c++;通过ssh启动的进程:如何重定向stdin_Linux_Ssh_Gdbserver - Fatal编程技术网

Linux gdb远程调试c++;通过ssh启动的进程:如何重定向stdin

Linux gdb远程调试c++;通过ssh启动的进程:如何重定向stdin,linux,ssh,gdbserver,Linux,Ssh,Gdbserver,首先是一些背景。我通过使用ssh在远程\u主机上启动进程来运行程序: ssh -T remote_host "cd ~/mydir && ~/myprogram" < input.txt 但是,在上面的示例中,我不知道如何将myprogram的stdin附加到input.txt 有什么东西能起作用吗 gdbserver不从stdin读取数据,因此它调用的程序可以不受限制地访问stdin。您应该能够做到这一点: ssh -T remote_host "cd ~/mydir

首先是一些背景。我通过使用
ssh
远程\u主机上启动进程来运行程序:

ssh -T remote_host "cd ~/mydir && ~/myprogram" < input.txt
但是,在上面的示例中,我不知道如何将
myprogram
的stdin附加到
input.txt


有什么东西能起作用吗

gdbserver
不从stdin读取数据,因此它调用的程序可以不受限制地访问stdin。您应该能够做到这一点:

ssh -T remote_host "cd ~/mydir && gdbserver :1234 ~/myprogram" < input.txt
这样做的一个缺点是,
gdb-gdbserver
TCP连接不会被加密

ssh -T remote_host "cd ~/mydir && gdbserver :1234 ~/myprogram" < input.txt
(gdb) target remote remote_host:1234