Various bits of cleanup.
Most notable: PrettyField now includes the type (but, like PrettyMethod,
lets you turn this off), and there's a new PrettyClass, and PrettyType
has been renamed to PrettyTypeOf.
I've also moved the dalvik "sync" stuff into files named "monitor", and
made some of the implementation details private.
Change-Id: I39ea79b45e173f9ebbf9878bcead207766a5653f
diff --git a/src/utils.cc b/src/utils.cc
index d146166..08ab705 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -97,11 +97,16 @@
return result;
}
-std::string PrettyField(const Field* f) {
+std::string PrettyField(const Field* f, bool with_type) {
if (f == NULL) {
return "null";
}
- std::string result(PrettyDescriptor(f->GetDeclaringClass()->GetDescriptor()));
+ std::string result;
+ if (with_type) {
+ result += PrettyDescriptor(f->GetType()->GetDescriptor());
+ result += ' ';
+ }
+ result += PrettyDescriptor(f->GetDeclaringClass()->GetDescriptor());
result += '.';
result += f->GetName()->ToModifiedUtf8();
return result;
@@ -123,7 +128,7 @@
return result;
}
-std::string PrettyType(const Object* obj) {
+std::string PrettyTypeOf(const Object* obj) {
if (obj == NULL) {
return "null";
}
@@ -137,6 +142,17 @@
return result;
}
+std::string PrettyClass(const Class* c) {
+ if (c == NULL) {
+ return "null";
+ }
+ std::string result;
+ result += "java.lang.Class<";
+ result += PrettyDescriptor(c->GetDescriptor());
+ result += ">";
+ return result;
+}
+
std::string MangleForJni(const std::string& s) {
std::string result;
size_t char_count = CountModifiedUtf8Chars(s.c_str());