gdb工具的迁移



gdb工具的迁移
 
需求:想通过gdb来跟踪调试makefile项目。目标机上没有gdb工具。
环境:8.133上装了linux系统即服务器,smb成功设置;目标机上8.201
上没有gdb工具。  www.2cto.com  
问题:
问题一
1 在133上which gdb发现出来一下:
[root@localhost sysmgmtclu]# which gdb
/usr/bin/gdb
2 之后scp到201上:
scp /usr/bin/gdb root@192.168.8.201:/usr/bin/下面
3 在目标机 gdb excutablefile会发现找不到某个库文件什么的
问题二
1 在目标机
-bash-3.2# gdb /root/clu
开始这里会出现找不到一些库文件什么提示  www.2cto.com  
GNU gdb Fedora (6.8-27.el5)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...
(no debugging symbols found)
(gdb) b  clu.c:1504
No symbol table is loaded.  Use the "file" command.
(gdb)
解决步骤:  www.2cto.com  
问题一解决:在133上通过ldd命令能找到gdb所需要的库文件,ldd命令工具
本身是一个静态库不需要其他库的支持,把这些库scp到目标机上就ok了。
[root@localhost sysmgmtclu]# which gdb
/usr/bin/gdb
[root@localhost sysmgmtclu]# ldd /usr/bin/gdb
    libreadline.so.5 => /usr/lib64/libreadline.so.5 (0x00000033ffe00000)
    libncurses.so.5 => /usr/lib64/libncurses.so.5 (0x0000003412000000)
    libm.so.6 => /lib64/libm.so.6 (0x00000033ff200000)
    libexpat.so.0 => /lib64/libexpat.so.0 (0x0000003401600000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00000033ff600000)
    libc.so.6 => /lib64/libc.so.6 (0x00000033fee00000)
    /lib64/ld-linux-x86-64.so.2 (0x00000033fea00000)
 
问题二解决:那个找不到库的也是因为少库,可以在133上find  / -name "libname" 来查找库的
路径,之后把库完整的scp到目标机上相应的目录下就行了。
发现少库错误少了之后还是不行,那个提示网上查了下是因为项目makefile  -g
没起作用,把clu下面Makefile里面striped 的一些信息注释掉就行了。
 

相关内容

    暂无相关文章