如何创建luajit编译代码的符号表

我想使用linux-perf工具记录lua堆栈,但不想产生/tmp/per-{pid}.map文件。

我从源代码构建了luajit库,并在/root/luajit-2.0/src/lj_trace.c中定义了宏"LUAJIT_USE_PERFTOOLS"。我参考了这个文件并使用perf record lua程序,但没有创建符号表。

luajit-2.0/src/lj_trace.c参考。

#ifdef LUAJIT_USE_PERFTOOLS
/*
** Create symbol table of JIT-compiled code. For use with Linux perf tools.
** Example usage:
**   perf record -F 99 -e cycles luajit test.lua
**   perf report -s symbol
**   rm perf.data /tmp/perf-*.map
*/
#include <stdio.h>

My test.lua code.
function testlua()
    print("hello world!")
end

while(true)
do
   testlua()
end
点赞