[clang] [compiler-rt] Reapply " [XRay] Add support for instrumentation of DSOs on x86_64 (#90959)" (PR #112930)
Jan Patrick Lehr via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 24 01:11:20 PDT 2024
================
@@ -150,21 +151,30 @@ class MProtectHelper {
namespace {
-bool patchSled(const XRaySledEntry &Sled, bool Enable,
- int32_t FuncId) XRAY_NEVER_INSTRUMENT {
+bool isObjectLoaded(int32_t ObjId) {
+ SpinMutexLock Guard(&XRayInstrMapMutex);
+ if (ObjId < 0 || static_cast<uint32_t>(ObjId) >=
+ atomic_load(&XRayNumObjects, memory_order_acquire)) {
+ return false;
+ }
+ return XRayInstrMaps[ObjId].Loaded;
+}
+
+bool patchSled(const XRaySledEntry &Sled, bool Enable, int32_t FuncId,
+ const XRayTrampolines &Trampolines) XRAY_NEVER_INSTRUMENT {
bool Success = false;
switch (Sled.Kind) {
case XRayEntryType::ENTRY:
- Success = patchFunctionEntry(Enable, FuncId, Sled, __xray_FunctionEntry);
+ Success = patchFunctionEntry(Enable, FuncId, Sled, Trampolines, false);
----------------
jplehr wrote:
```suggestion
Success = patchFunctionEntry(Enable, FuncId, Sled, Trampolines, /* LogArgs=*/false);
```
There is some syntax like that, that is understood by clang-format and that helps to know what this is actually doing.
https://github.com/llvm/llvm-project/pull/112930
More information about the cfe-commits
mailing list