Start implementing jdb "locals".
This lets us show the names and types of the locals, but all the values
will show up as 0/null. We're going to have to walk the whole stack and
take callee-save frames into account to do that right.
Change-Id: Ic6e115513b6e65ae7ed4b7274e70bc514e83190a
diff --git a/src/object.cc b/src/object.cc
index 49ba5a3..8cf79c2 100644
--- a/src/object.cc
+++ b/src/object.cc
@@ -24,6 +24,11 @@
namespace art {
+String* Object::AsString() {
+ DCHECK(GetClass()->IsStringClass());
+ return down_cast<String*>(this);
+}
+
Object* Object::Clone() {
Class* c = GetClass();
DCHECK(!c->IsClassClass());
@@ -54,11 +59,6 @@
return Monitor::GetThinLockId(monitor_);
}
-bool Object::IsString() const {
- // TODO use "klass_ == String::GetJavaLangString()" instead?
- return GetClass() == GetClass()->GetDescriptor()->GetClass();
-}
-
void Object::MonitorEnter(Thread* thread) {
Monitor::MonitorEnter(thread, this);
}
@@ -1014,6 +1014,16 @@
return IsInSamePackage(klass1->descriptor_, klass2->descriptor_);
}
+bool Class::IsClassClass() const {
+ Class* java_lang_Class = GetClass()->GetClass();
+ return this == java_lang_Class;
+}
+
+bool Class::IsStringClass() const {
+ // TODO use "this == String::GetJavaLangString()" instead? or do we need this too early?
+ return this == GetDescriptor()->GetClass();
+}
+
const ClassLoader* Class::GetClassLoader() const {
return GetFieldObject<const ClassLoader*>(OFFSET_OF_OBJECT_MEMBER(Class, class_loader_), false);
}