标签: sprof

gprof:如何为链接到主程序的共享库中的函数生成调用图

我正在研究Linux环境.我有两个'C'源包train和test_train.

  1. 编译时训练包生成libtrain.so
  2. test_train链接到libtrain.so并生成可执行的train-test

现在我想用gprof生成一个调用图,它显示了主程序中函数的调用顺序以及libtrain.so中的函数调用顺序.

我正在使用-pg选项编译和链接两个包,调试级别为o0.在我执行./train-test之后,生成gmon.out.然后我做:

$ gprof -q ./train-test gmon.out
Run Code Online (Sandbox Code Playgroud)

这里,输出显示列车测试中的函数调用图,但不显示libtrain.so中的调用图

可能是什么问题呢 ?

c debugging profiling gprof sprof

23
推荐指数
1
解决办法
2万
查看次数

What is causing sprof to complain about "inconsistency detected by ld.so"?

I'm trying to use sprof to profile some software (ossim) where almost all the code is in a shared library. I've generated a profiling file, but when I run sprof, I get the following error:

> sprof /home/eca7215/usr/lib/libossim.so.1 libossim.so.1.profile -p > log
Inconsistency detected by ld.so: dl-open.c: 612: _dl_open: Assertion `_dl_debug_initialize (0, args.nsid)->r_state == RT_CONSISTENT' failed!
Run Code Online (Sandbox Code Playgroud)

The instructions I was following said that I needed libc version at least 2.5-34, I have libc version 2.12.2 (Gentoo, kernel 2.6.36-r5).

I can't …

shared-libraries libc ld dlopen sprof

16
推荐指数
1
解决办法
4413
查看次数

7
推荐指数
1
解决办法
1万
查看次数

使用LD_PROFILE分析预加载的共享库

我目前正在尝试使用LD_PROFILE环境变量来分析预加载的共享库.

我使用"-g"标志编译库并导出LD_PROFILE_OUTPUT以及LD_PROFILE,然后运行带有预加载库的应用程序(在我的情况下为ncat).所以,更准确地说,我做的是以下内容:

  1. 使用"-g"标志编译共享库libexample.so.
  2. export LD_PROFILE_OUTPUT=`pwd`
  3. export LD_PROFILE=libexample.so
  4. LD_PRELOAD=`pwd`/libexample.so ncat ...

预加载本身确实有效,我的库也被使用,但是没有创建libexample.so.profile文件.如果我使用export LD_PROFILE=libc.so.6,则按预期存在libc.so.6.profile文件.

这是组合LD_PRELOAD和LD_PROFILE的问题还是我可能做错了什么?

如果有任何相关性,我在CentOS 6.4上使用glibc v2.12.

非常感谢!

linux ld sprof

5
推荐指数
1
解决办法
1415
查看次数

标签 统计

sprof ×4

ld ×2

linux ×2

c ×1

debugging ×1

dlopen ×1

gprof ×1

libc ×1

profiling ×1

shared-libraries ×1