LD_DEBUG的使用

1. LD_DBUG环境变量的使用可以查看可执行文件在启动时的动态加载共享库的过程

LD_DEBUG 自带命令帮助,方法是 LD_DEBUG=help xxx (任意可执行命令程序),例如 'LD_DEBUG=help ls’ 就可以输入环境便令LD_DEBUG的使用帮助

#查看LD_DEBUG环境变量的使用帮助

LD_DEBUG=help ls

帮助信息

root@xx:/home # LD_DEBUG=help ls
Valid options for the LD_DEBUG environment variable are:
 
  libs        display library search paths
  reloc       display relocation processing
  files       display progress for input file
  symbols     display symbol table processing
  bindings    display information about symbol binding
  versions    display version dependencies
  scopes      display scope information
  all         all previous options combined
  statistics  display relocation statistics
  unused      determined unused DSOs
  help        display this help message and exit
 
To direct the debugging output into a file instead of standard output
a filename can be specified using the LD_DEBUG_OUTPUT environment variable.
root@xx:/home #

2. 查看链接的文件

查看LD_DEBUG=files 

查看程序执行需要的文件和链接库

root@xx:/home # LD_DEBUG=files ls
     20397:    
     20397:     file=libmdm.so [0];  needed by ls [0]
     20397:     file=libmdm.so [0];  generating link map
     20397:       dynamic: 0x0000007f8e331d40  base: 0x0000007f8e2d1000   size: 0x000000000009b000
     20397:         entry: 0x0000007f8e2dbaa0  phdr: 0x0000007f8e2d1040  phnum:                  6
     20397:

3. 查看链接libs

查看LD_DEBUG=libs

查看程序执行需要链接库

root@xx/home # LD_DEBUG=libs ls
     20717:     find library=libmdm.so [0]; searching
     20717:      search cache=/etc/ld.so.cache
     20717:      search path=/lib64/tls/aarch64:/lib64/tls:/lib64/aarch64:/lib64:/usr/lib64/tls/aarch64:/usr/lib64/tls:/usr/lib64/aarch64:/usr/lib64            (system search path)
     20717:       trying file=/lib64/tls/aarch64/libmdm.so
     20717:       trying file=/lib64/tls/libmdm.so
     20717:       trying file=/lib64/aarch64/libmdm.so
     20717:       trying file=/lib64/libmdm.so

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值