我想分析我的程序的内存分配。所以我用
JEMALLOC_PROF=1
和 JEMALLOC_PROF_LIBUNWIND=1
编译,并用 export MALLOC_CONF="prof:true,prof_active:true,lg_prof_interval:25"
运行。
程序确实转储了一些堆文件。但是,我发现我无法使用 jeprof 来分析该文件。如果我使用以下命令运行,jeprof 会出现以下错误消息。
./jeprof --svg bin/tiflash/tiflash jeprof.910766.14.i14.heap > t.svg
Using local file bin/tiflash/tiflash.
Using local file jeprof.910766.14.i14.heap.
addr2line: DWARF error: could not find variable specification at offset 6cbe
addr2line: DWARF error: could not find variable specification at offset 3cec
addr2line: DWARF error: could not find variable specification at offset 1b26
addr2line: DWARF error: could not find variable specification at offset 372c
addr2line: DWARF error: could not find variable specification at offset 6fd6
addr2line: DWARF error: invalid or unhandled FORM value: 0x25
经过一番搜索,我发现
DWARF error: could not find variable specification at offset 6cbe
表示缺少某些符号,所以jeprof无法处理。然而,该程序与卡住无关。
从https://github.com/jemalloc/jemalloc/issues/2417,我知道
DWARF error: invalid or unhandled FORM value: 0x25
与某些DWARF问题有关。但没有更多提示。
我想知道如何解决这个问题,并让jeprof输出一个svg。
====编辑====
经过进一步调查,我发现 jeprof 所做的是调用命令
addr2line -f -C -e xxx -i </tmp/jeprof986545.sym
而且
addr2line
花了很多时间,并且输出了错误
addr2line -f -e xxx 000000000aa3b336
addr2line: DWARF error: invalid or unhandled FORM value: 0x25
_ZN5gimli4read5dwarf14Dwarf$LT$R$GT$4unit17h2c6ef33ecf31a970E
backtrace.e024eb3ce795f700-cgu.3:?
====编辑====
我已经切换到最新的 binutils 2.42,但 addr2line 仍然永远卡住。
我自己已经解决了这个问题。
addr2line: DWARF error: invalid or unhandled FORM value: 0x25
这是因为我的binutils
太旧了。我编译了最新的binutils
,可以处理0x25