summaryrefslogtreecommitdiff
path: root/compiler-rt/lib/xray/xray_interface_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/lib/xray/xray_interface_internal.h')
-rw-r--r--compiler-rt/lib/xray/xray_interface_internal.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/compiler-rt/lib/xray/xray_interface_internal.h b/compiler-rt/lib/xray/xray_interface_internal.h
index 0fea6377648d..390f389b1dca 100644
--- a/compiler-rt/lib/xray/xray_interface_internal.h
+++ b/compiler-rt/lib/xray/xray_interface_internal.h
@@ -29,6 +29,18 @@ struct XRaySledEntry {
unsigned char AlwaysInstrument;
unsigned char Version;
unsigned char Padding[13]; // Need 32 bytes
+ uint64_t function() const {
+ if (Version < 2)
+ return Function;
+ // The target address is relative to the location of the Function variable.
+ return reinterpret_cast<uint64_t>(&Function) + Function;
+ }
+ uint64_t address() const {
+ if (Version < 2)
+ return Address;
+ // The target address is relative to the location of the Address variable.
+ return reinterpret_cast<uint64_t>(&Address) + Address;
+ }
#elif SANITIZER_WORDSIZE == 32
uint32_t Address;
uint32_t Function;
@@ -36,6 +48,18 @@ struct XRaySledEntry {
unsigned char AlwaysInstrument;
unsigned char Version;
unsigned char Padding[5]; // Need 16 bytes
+ uint32_t function() const {
+ if (Version < 2)
+ return Function;
+ // The target address is relative to the location of the Function variable.
+ return reinterpret_cast<uint32_t>(&Function) + Function;
+ }
+ uint32_t address() const {
+ if (Version < 2)
+ return Address;
+ // The target address is relative to the location of the Address variable.
+ return reinterpret_cast<uint32_t>(&Address) + Address;
+ }
#else
#error "Unsupported word size."
#endif