SWDEV-229840 - Add Debug prints when the element is already present in MemObjMap_

Change-Id: I21129d087e73cc2a9e35f03e6a1a2dc527626f48


[ROCm/clr commit: 71c05075ba]
This commit is contained in:
kjayapra-amd
2020-06-09 20:10:18 -04:00
committed by Karthik Jayaprakash
parent a1974c06e9
commit 5a1e09a37d
+12 -2
View File
@@ -95,12 +95,22 @@ size_t MemObjMap::size() {
void MemObjMap::AddMemObj(const void* k, amd::Memory* v) {
amd::ScopedLock lock(AllocatedLock_);
MemObjMap_.insert({reinterpret_cast<uintptr_t>(k), v});
auto rval = MemObjMap_.insert({ reinterpret_cast<uintptr_t>(k), v });
if (!rval.second) {
DevLogPrintfError("Memobj map already has an entry for ptr: 0x%x",
reinterpret_cast<uintptr_t>(k));
guarantee(false);
}
}
void MemObjMap::RemoveMemObj(const void* k) {
amd::ScopedLock lock(AllocatedLock_);
MemObjMap_.erase(reinterpret_cast<uintptr_t>(k));
auto rval = MemObjMap_.erase(reinterpret_cast<uintptr_t>(k));
if (rval != 1) {
DevLogPrintfError("Memobj map does not have ptr: 0x%x",
reinterpret_cast<uintptr_t>(k));
guarantee(false);
}
}
amd::Memory* MemObjMap::FindMemObj(const void* k) {