gdbserver静态编译

redhat9 编译gdb server(静态编译)
下载gdb-6.2a.tar:http://download.chinaunix.net/download.php?id=6680&ResourceID=3482
redhat9:http://archive.download.redhat.com/pub/redhat/linux/9/en/iso/i386/shrike-i386-disc3.iso
1.另外在vm8中安装,vmtools安装时一直提示gcc找不到,则采用ssh连上。
2.网络无法连接:Determining IP information for eth0... failed; no link present.
redhat9一个bug:修改ifcfg-eth0文件,加入check_link_down
http://blog.csdn.net/ybsun2010/article/details/10019353
3.redhat9默认开启22,ssh连接时始终‘connection was reset’,关闭防火墙:chkconfig iptables off,并重启。
4.编译gdb:./configure --prefix(安装目录),make,make install
注意事项:redhat要用root运行,否则ifconfig,gcc等都找不到。
5.生成成功后,file gdbserver:ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs),但是cat /proc/version:Linux version 2.4.20-8 (bhcompile@porky.devel.redhat.com) (gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)),可见并不与内核版本相同,而与/bin/kill相同。
4.编译成功后,可以用ssh sz命令下载下来。rz是上传文件。
ldd:用来打印目标程序(由命令行参数指定)所链接的所有动态库的信息的,如果目标程序没有链接动态库,则打印“not a dynamic executable”.
5.实际中gdb可以做到完全静态,但是gdbserver无法做到,但是可以在目标上运行就可以了。

原文地址:https://www.cnblogs.com/studyskill/p/6609737.html