This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt][XRay] Implement __xray_unpatch() and __xray_remove_handler()
ClosedPublic

Authored by dberris on Aug 4 2016, 12:42 AM.

Details

Summary

We also add one test (and the XRay testing infrastructure) to exercise
the patching and unpatching code. This uses the XRay API exported
through the headers as well, installing a custom log handler.

Depends on D23101 for the updated emitted code alignment for the
return/entry sleds.

Diff Detail

Event Timeline

dberris updated this revision to Diff 66767.Aug 4 2016, 12:42 AM
dberris retitled this revision from to [compiler-rt][XRay] Implement __xray_unpatch().
dberris updated this object.
dberris added reviewers: rSerge, echristo, rnk.
dberris added a subscriber: llvm-commits.
rSerge edited edge metadata.Aug 4 2016, 4:55 AM

As I understood, __xray_remove_handler() is not yet implemented (just declared). Shouldn't it go to this fix too? I think it's about a line of somewhat related code.

Good point. I'll add it in the next update, it should be easy to do.

dberris updated this revision to Diff 66797.Aug 4 2016, 6:28 AM
dberris edited edge metadata.
  • Implement __xray_remove_handler() and test it too
dberris retitled this revision from [compiler-rt][XRay] Implement __xray_unpatch() to [compiler-rt][XRay] Implement __xray_unpatch() and __xray_remove_handler().Aug 4 2016, 6:29 AM
rSerge added inline comments.Aug 4 2016, 9:18 AM
lib/xray/xray_interface.cc
107

It may need a comment on what it does and what the parameter means. Or better, to make the code self-explaining, can it be renamed to e.g. ControlPatching or ControlTracing with a parameter like "bool Enabled"?

dberris updated this revision to Diff 66898.Aug 4 2016, 6:51 PM
dberris marked an inline comment as done.
  • Rename PatchCommon to ControlPatching
  • Add comment to ControlPatching
lib/xray/xray_interface.cc
107

Thanks, did both -- added a comment and renamed as you suggested.

rSerge accepted this revision.Aug 5 2016, 6:52 AM
rSerge edited edge metadata.

Looks good.

This revision is now accepted and ready to land.Aug 5 2016, 6:52 AM
This revision was automatically updated to reflect the committed changes.