gdbserver

  • GDB Server的远程调试功能 alt text
  • 利用gdbserver
apt-get install openssh-server
apt-get install gdb
apt-get install gdbserver
apt install net-tools
apt install iptables

在docker中gdbserver docker_ip:6666 file_addr args
然后在虚拟机中gdb,再target remote docker_ip:6666就行了,注意args要在gdbserver中设置,发现gdb远程连接后设置不了
  • docker中进行gdb调试 参考博客
  • 这个操作虽然关闭了防火墙可以Ping通,但是与外界的网络通信都是被隔断的,慎用
iptables -L
iptables -F
如果不小心用了,用如下操作进行恢复
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
systemctl restart networking
systemctl restart NetworkManager

alt text