summaryrefslogtreecommitdiff
path: root/src/debugger.cc
diff options
context:
space:
mode:
author Elliott Hughes <enh@google.com> 2012-04-14 11:46:01 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2012-04-14 11:46:01 -0700
commit42f302c1da4cf1abf935d7aee29ece8d90441e0c (patch)
tree1313bbbf93b2983e4046c5eaf023c48377e7fb9a /src/debugger.cc
parent33687790adbb889abdd95bb22914acb57ce6e68c (diff)
parenta0e180632411f7fe0edf454e571c42209ee7b540 (diff)
Merge "Add a SafeMap equivalent to std::map but without the error-prone operator[]." into ics-mr1-plus-art
Diffstat (limited to 'src/debugger.cc')
-rw-r--r--src/debugger.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/debugger.cc b/src/debugger.cc
index 553bfc73bb..fe9bc491c1 100644
--- a/src/debugger.cc
+++ b/src/debugger.cc
@@ -25,9 +25,10 @@
#include "dex_verifier.h" // For Instruction.
#include "oat/runtime/context.h"
#include "object_utils.h"
+#include "safe_map.h"
+#include "scoped_thread_list_lock.h"
#include "ScopedLocalRef.h"
#include "ScopedPrimitiveArray.h"
-#include "scoped_thread_list_lock.h"
#include "space.h"
#include "stack_indirect_reference_table.h"
#include "thread_list.h"
@@ -58,7 +59,7 @@ class ObjectRegistry {
}
JDWP::ObjectId id = static_cast<JDWP::ObjectId>(reinterpret_cast<uintptr_t>(o));
MutexLock mu(lock_);
- map_[id] = o;
+ map_.Overwrite(id, o);
return id;
}
@@ -79,14 +80,14 @@ class ObjectRegistry {
}
MutexLock mu(lock_);
- typedef std::map<JDWP::ObjectId, Object*>::iterator It; // C++0x auto
+ typedef SafeMap<JDWP::ObjectId, Object*>::iterator It; // C++0x auto
It it = map_.find(id);
return (it != map_.end()) ? reinterpret_cast<T>(it->second) : reinterpret_cast<T>(kInvalidId);
}
void VisitRoots(Heap::RootVisitor* visitor, void* arg) {
MutexLock mu(lock_);
- typedef std::map<JDWP::ObjectId, Object*>::iterator It; // C++0x auto
+ typedef SafeMap<JDWP::ObjectId, Object*>::iterator It; // C++0x auto
for (It it = map_.begin(); it != map_.end(); ++it) {
visitor(it->second, arg);
}
@@ -94,7 +95,7 @@ class ObjectRegistry {
private:
Mutex lock_;
- std::map<JDWP::ObjectId, Object*> map_;
+ SafeMap<JDWP::ObjectId, Object*> map_;
};
struct AllocRecordStackTraceElement {