Skip to content

Commit 106ef2f

Browse files
[XRay] Small ObjID fix
1 parent 5143ef4 commit 106ef2f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler-rt/lib/xray/xray_init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ SpinMutex XRayInstrMapMutex;
5656
// Contains maps for the main executable as well as DSOs.
5757
// std::vector<XRaySledMap> XRayInstrMaps;
5858
XRaySledMap *XRayInstrMaps;
59-
atomic_uint32_t XRayNumObjects;
59+
atomic_uint32_t XRayNumObjects{0};
6060

6161
// Global flag to determine whether the flags have been initialized.
6262
atomic_uint8_t XRayFlagsInitialized{0};

compiler-rt/lib/xray/xray_interface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ size_t __xray_max_function_id() XRAY_NEVER_INSTRUMENT {
658658

659659
size_t __xray_max_function_id_in_object(int32_t ObjId) XRAY_NEVER_INSTRUMENT {
660660
SpinMutexLock Guard(&XRayInstrMapMutex);
661-
if (ObjId < 0 || ObjId > atomic_load(&XRayNumObjects, memory_order_acquire))
661+
if (ObjId < 0 || ObjId >= atomic_load(&XRayNumObjects, memory_order_acquire))
662662
return 0;
663663
return XRayInstrMaps[ObjId].Functions;
664664
}

0 commit comments

Comments
 (0)