summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
diff options
context:
space:
mode:
authorEwan Crawford <ewan@codeplay.com>2015-12-09 16:01:58 +0000
committerEwan Crawford <ewan@codeplay.com>2015-12-09 16:01:58 +0000
commite69df38282957733ad88ff44089892013318f7b4 (patch)
tree4bf825cfecdf4c3fd4666d4f8b6f05c2f9f96e59 /lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
parentd91d635b36e88ace41794a14df48b3a3267fa5ff (diff)
downloadbcm5719-llvm-e69df38282957733ad88ff44089892013318f7b4.tar.gz
bcm5719-llvm-e69df38282957733ad88ff44089892013318f7b4.zip
[RenderScript] Add hook for destroyed allocations
New hook for rsdAllocationDestroy() which is called when allocations are deleted. LLDB should be aware of this so we can remove the allocation from our internal list. llvm-svn: 255121
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp')
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp46
1 files changed, 45 insertions, 1 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
index be839b9e576..6b8e64b9d7c 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -556,6 +556,14 @@ const RenderScriptRuntime::HookDefn RenderScriptRuntime::s_runtimeHookDefns[] =
RenderScriptRuntime::eModuleKindDriver, // type
nullptr // handler
},
+ {
+ "rsdAllocationDestroy", // name
+ "_Z20rsdAllocationDestroyPKN7android12renderscript7ContextEPNS0_10AllocationE", // symbol name 32bit
+ "_Z20rsdAllocationDestroyPKN7android12renderscript7ContextEPNS0_10AllocationE", // symbol name 64bit
+ 0, // version
+ RenderScriptRuntime::eModuleKindDriver, // type
+ &lldb_private::RenderScriptRuntime::CaptureAllocationDestroy // handler
+ },
};
const size_t RenderScriptRuntime::s_runtimeHookCount = sizeof(s_runtimeHookDefns)/sizeof(s_runtimeHookDefns[0]);
@@ -857,6 +865,43 @@ RenderScriptRuntime::CaptureAllocationInit1(RuntimeHook* hook_info, ExecutionCon
alloc->context = rs_context_u64;
}
+void
+RenderScriptRuntime::CaptureAllocationDestroy(RuntimeHook* hook_info, ExecutionContext& context)
+{
+ Log* log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
+
+ // Context, Alloc
+ uint64_t rs_context_u64 = 0U;
+ uint64_t rs_alloc_u64 = 0U;
+
+ bool success = GetArgSimple(context, 0, &rs_context_u64) && GetArgSimple(context, 1, &rs_alloc_u64);
+ if (!success) // error case
+ {
+ if (log)
+ log->Printf("RenderScriptRuntime::CaptureAllocationDestroy - Error while reading the function parameters");
+ return; // abort
+ }
+
+ if (log)
+ log->Printf("RenderScriptRuntime::CaptureAllocationDestroy - 0x%" PRIx64 ", 0x%" PRIx64 ".",
+ rs_context_u64, rs_alloc_u64);
+
+ for (auto iter = m_allocations.begin(); iter != m_allocations.end(); ++iter)
+ {
+ auto& allocation_ap = *iter; // get the unique pointer
+ if (allocation_ap->address.isValid() && *allocation_ap->address.get() == rs_alloc_u64)
+ {
+ m_allocations.erase(iter);
+ if (log)
+ log->Printf("RenderScriptRuntime::CaptureAllocationDestroy - Deleted allocation entry");
+ return;
+ }
+ }
+
+ if (log)
+ log->Printf("RenderScriptRuntime::CaptureAllocationDestroy - Couldn't find destroyed allocation");
+}
+
void
RenderScriptRuntime::CaptureScriptInit1(RuntimeHook* hook_info, ExecutionContext& context)
{
@@ -2304,7 +2349,6 @@ RenderScriptRuntime::Status(Stream &strm) const
strm.Indent(b.second->defn->name);
strm.EOL();
}
- strm.EOL();
}
else
{
OpenPOWER on IntegriCloud