This is an archive of the discontinued LLVM Phabricator instance.

[XRay] Define the InstrumentationMap type
ClosedPublic

Authored by dberris on Jan 31 2017, 1:23 AM.

Details

Summary

This change implements the instrumentation map loading library which can
understand both YAML-defined instrumentation maps, and ELF 64-bit object
files that have the XRay instrumentation map section. We break it out
into a library on its own to allow for other applications to deal with
the XRay instrumentation map defined in XRay-instrumented binaries.

This type provides both raw access to the logical representation of the
instrumentation map entries as well as higher level functions for
converting a function ID into a function address.

At this point we only support ELF64 binaries and YAML-defined XRay
instrumentation maps. Future changes should extend this to support
32-bit ELF binaries, as well as other binary formats (like MachO).

As part of this change we also migrate all uses of the extraction logic
that used to be defined in tools/llvm-xray/ to use this new type and
interface for loading from files. We also remove the flag from the
llvm-xray tool that required users to specify the type of the
instrumentation map file being provided to instead make the library
auto-detect the file type.

Diff Detail

Repository
rL LLVM

Event Timeline

dberris created this revision.Jan 31 2017, 1:23 AM
dblaikie accepted this revision.Jan 31 2017, 9:40 AM
dblaikie added inline comments.
include/llvm/XRay/InstrumentationMap.h
98–99 ↗(On Diff #86394)

You can skip teh iterator_range and return a reference to the container here, I think?

lib/XRay/InstrumentationMap.cpp
44 ↗(On Diff #86394)

Probably simplify/refactor this function so it's short and calls two other functions that do the bulk of the work in the two sides of the if/else. Imagine that'd make it a bit easier to read.

This revision is now accepted and ready to land.Jan 31 2017, 9:40 AM
dberris updated this revision to Diff 86515.Jan 31 2017, 3:48 PM
dberris marked 2 inline comments as done.
  • Address review comments
This revision was automatically updated to reflect the committed changes.
llvm/trunk/tools/llvm-xray/xray-graph.cc