Mul*_*hic 5 ssh gdb remote-debugging gdbserver
我想从我的主机盒调试远程盒子上运行的进程(我在主机上构建了代码).两者都有linux类型的操作系统.
我似乎只能通过ssh(我使用telnet测试)从主机盒与远程盒通信.
我已按照以下步骤进行设置:
在远程框上:
停止防火墙服务:
service firewall_service stop
将进程附加到gdbserver
--attach:remote_port process_id
在主机框上:
通过ssh设置端口转发
sudo ssh remote_username @ remote_ip -L host_port:localhost:remote_port -f sleep 60m
设置gdb以附加到远程进程:
gdb file.debug
(gdb)target remote remote_ip:remote_port
当我尝试通过在主机框上运行'target remote remote_ip:remote_port'来启动主机上的调试时,我收到"连接超时"错误.
你们可以看到我做错了什么,要检查什么或者通过ssh远程调试的替代方法我将不胜感激.谢谢
这个命令:
sudo ssh remote_username@remote_ip -L host_port:localhost:remote_port ...
Run Code Online (Sandbox Code Playgroud)
将本地 host_port 转发到localhost上的remote_port.它没用:你可以直接连接到localhost:remote_port.
这个命令:
(gdb) target remote remote_ip:remote_port
Run Code Online (Sandbox Code Playgroud)
要求GDB连接到remote_ip上的remote_port.但是你说你只能通过ssh到达remote_ip,所以GDB超时并不奇怪.
你想要什么:
ssh remote_username@remote_ip -L host_port:remote_ip:remote_port ...
(gdb) target remote :host_port
Run Code Online (Sandbox Code Playgroud)
换句话说,您连接到本地 host_port,并且ssh将该本地连接转发到remote_ip:remote_port,其中gdbserver正在侦听它.
| 归档时间: |
|
| 查看次数: |
9386 次 |
| 最近记录: |