[llvm-dev] [X-ray] How to check successful instrumentation and generate call trace?

Dean Michael Berris via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 24 04:27:50 PST 2019



> On 24 Jan 2019, at 22:48, 张雨姗(ZHANG Yushan)-11310380 <zhangys3 at mail.sustc.edu.cn> wrote:
> 
> Hi Dean,
> 
> 
> Thanks for your last reply. 
> 
> I compiled "tmux" with `CC=clang CXX=clang++ CXXFLAGS=-fxray-instrument CFLAGS=-fxray-instrument`, and it succeeded.
> 
> I installed the binary with `make install` to a local folder, and run it with XRAY_OPTIONS="patch_premain=true:xray_mode=xray-basic:verbosity=1" tmux'. 
> 
> But after it exited normally, I have no trace generated or any error. And I also used `llvm extract -symbolize` to make sure the binary is instrumented.
> 
> What is the cause for it? Does it depend on functions called during the execution? 
> 
> What environment variables I should use to guarantee there is always a trace log?
> 

You already have the right environment variable configured (XRAY_OPTIONS) but I think what’s missing is the runtime library. You should use clang to link as well, adding the ‘-fxray-instrument’ flag to the linker options you pass with clang.

http://llvm.org/docs/XRayExample.html#building-with-xray

"Note that we need to link with Clang as well to get the XRay runtime linked in appropriately.”

> 
> Thank you,

No worries, I hope this helps!

Cheers

-- Dean



More information about the llvm-dev mailing list