[llvm-dev] [llvm-xray] llvm-xray cannot log every functions

Dean Michael Berris via llvm-dev llvm-dev at lists.llvm.org
Fri Feb 1 20:02:31 PST 2019

> On 2 Feb 2019, at 12:01, Shang, Zitong <zus223 at psu.edu> wrote:
> Dear Dean,
> Thank you very much for the quick reply, but I still cannot get the trace log work correctly. I used the command
> $XRAY_BASIC_OPTIONS='func_duration_threshold=0' XRAY_OPTIONS='patch_premain=true xray_mode=xray-basic verbosity=1' ./matrix
> to generate log.
> And used the command
> $llvm-xray convert -f yaml -symbolize -instr_map=./matrix xray-log.matrix.EVdnlj
> to let the log become readable. However, it still does not show up the multiply function that I defined in the program. Is there anything else that I did wrongly?

Are you sure the function isn’t being in-lined into the main function?

You can take some steps to move the definition of the function to a different translation unit (a different .c and which compiles into a different .o) to potentially inhibit the in-lining of the function you want instrumented. As I noted in my previous reply:

"The other potential explanation here is function inlining — if it just so happens that the function is inlined, it could still be marked "instrumented” in the instrumentation map, but only because there could be a “comdat” version of the function just-in-case the address of the function gets taken. Instrumented functions that are inlined don’t get the instrumentation, because the inlining happens at the LLVM IR level rather than the machine code level (where XRay instrumentation gets added).”

Hope that helps.

-- Dean

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190202/f4d57ca3/attachment.sig>

More information about the llvm-dev mailing list