使用带有perf的调试符号

时间:2017-11-16 13:14:02

标签: symbols perf dwarf

我监控PowerPC系统上的进程以提取性能信息。 我如何加载此过程的调试符号? 我使用以下命令

perf record -g dwarf -p 4591

我发现错误“无法找到矮人(没有这样的文件或目录)” 能否请您提示如何加载有关生成报告时调用的函数的调试信息?

2 个答案:

答案 0 :(得分:1)

perf record -g dwarf -p 4591

这些天选择方法的正确选项是--call-graph,而-g只是一个标志,可以使用默认方法fp启用调用堆栈。

来自man perf-record

-g
    Enables call-graph (stack chain/backtrace) recording.

--call-graph
    Setup and enable call-graph (stack chain/backtrace) recording,
    implies -g.  Default is "fp".

    Allows specifying "fp" (frame pointer) or "dwarf"
    (DWARF's CFI - Call Frame Information) or "lbr"
    (Hardware Last Branch Record facility) as the method to collect
    the information used to show the call graphs.

    In some systems, where binaries are build with gcc
    --fomit-frame-pointer, using the "fp" method will produce bogus
    call graphs, using "dwarf", if available (perf tools linked to
    the libunwind or libdw library) should be used instead.
    Using the "lbr" method doesn't require any compiler options. It
    will produce call graphs from the hardware LBR registers. The
    main limitation is that it is only available on new Intel
    platforms, such as Haswell. It can only get user call chain. It
    doesn't work with branch stack sampling at the same time.

    When "dwarf" recording is used, perf also records (user) stack dump
    when sampled.  Default size of the stack dump is 8192 (bytes).
    User can change the size by passing the size after comma like
    "--call-graph dwarf,4096".

顺便说一下,首先尝试fp - 它效率更高,但对优化的二进制文件(例如--fomit-frame-pointer)效果不佳。此外,这与调试信息几乎没有关系。如果您不需要知道堆栈跟踪,则无需添加-g

答案 1 :(得分:1)

您使用的old version of perf不支持-g dwarf但只支持-g(不带参数),即它不支持DWARF展开。