Add BCC support for rs_object_slots metadata.
This is added to support proper cleanup of RS resources. We were leaking some
global resources because there was no way to tell which slots to clear.
Change-Id: I3e01ff4f7105444b7610d514f10dd56cb1b359b8
b: 3381615
diff --git a/lib/bcc/ScriptCompiled.cpp b/lib/bcc/ScriptCompiled.cpp
index 052d2a7..5fd45b6 100644
--- a/lib/bcc/ScriptCompiled.cpp
+++ b/lib/bcc/ScriptCompiled.cpp
@@ -117,5 +117,22 @@
}
}
+void ScriptCompiled::getObjectSlotList(size_t objectSlotListSize,
+ uint32_t *objectSlotList) {
+ if (objectSlotList) {
+ size_t objectSlotCount = getObjectSlotCount();
+
+ if (objectSlotCount > objectSlotListSize) {
+ objectSlotCount = objectSlotListSize;
+ }
+
+ for (ObjectSlotList::const_iterator
+ I = mObjectSlots.begin(), E = mObjectSlots.end();
+ I != E && objectSlotCount > 0; ++I, --objectSlotCount) {
+ *objectSlotList++ = *I;
+ }
+ }
+
+}
} // namespace bcc