文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>glibc的另类帮助: LD_DEBUG=xxx

glibc的另类帮助: LD_DEBUG=xxx

时间:2010-06-23  来源:slimzhao

在碰到一个 LD_PRELOAD指定的so不能被正确载入时,额外的信息很难获取, 比如, 不能用gdb调试, 不能用strace跟踪, so不能正确载入并不会阻止程序的执行.

在man ld.so时, 看到了LD_DEBUG 环境变量, 于是指定了
LD_DEBUG=1 LD_PRELOAD=my_preload.so test

程序输出:
warning: debug option `1' unknown, try LD_DEBUG=help

这段warning信息应是由ld.so 输出的, 用help替换了上面的1之后, 程序没被执行, 代之以输出了如下的帮助信息:

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
  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.

这种形式的帮助还真是头一回见. 试了all之后, 程序输出了大量的信息(送到stderr), 估计日后再碰到动态库加载失败的情况时, 这些信息能有所帮助.
相关阅读 更多 +
排行榜 更多 +
翌日波奇狗的历险记手机版下载

翌日波奇狗的历险记手机版下载

休闲益智 下载
怪兽远征安卓版下载

怪兽远征安卓版下载

角色扮演 下载
谷歌卫星地图免费版下载

谷歌卫星地图免费版下载

生活实用 下载