OSDN Git Service

merge in klp-release history after reset to klp-dev
[android-x86/dalvik.git] / vm / Misc.h
index 017548d..4c42576 100644 (file)
--- a/vm/Misc.h
+++ b/vm/Misc.h
@@ -17,8 +17,8 @@
 /*
  * Miscellaneous utility functions.
  */
-#ifndef _DALVIK_MISC
-#define _DALVIK_MISC
+#ifndef DALVIK_MISC_H_
+#define DALVIK_MISC_H_
 
 #include <string>
 
@@ -147,6 +147,27 @@ char* dvmDotToSlash(const char* str);
  */
 std::string dvmHumanReadableDescriptor(const char* descriptor);
 
+/**
+ * Returns a human-readable string form of the name of the class of
+ * the given object. So given a java.lang.String, the output would
+ * be "java.lang.String". Given an array of int, the output would be "int[]".
+ * Given String.class, the output would be "java.lang.Class<java.lang.String>".
+ */
+std::string dvmHumanReadableType(const Object* obj);
+
+/**
+ * Returns a human-readable string of the form "package.Class.fieldName".
+ */
+struct Field;
+std::string dvmHumanReadableField(const Field* field);
+
+/**
+ * Returns a human-readable string of the form "package.Class.methodName"
+ * or "package.Class.methodName(Ljava/lang/String;I)V".
+ */
+struct Method;
+std::string dvmHumanReadableMethod(const Method* method, bool withSignature);
+
 /*
  * Return a newly-allocated string for the "dot version" of the class
  * name for the given type descriptor. That is, The initial "L" and
@@ -279,6 +300,7 @@ void *dvmAllocRegion(size_t size, int prot, const char *name);
  * Get some per-thread stats from /proc/self/task/N/stat.
  */
 struct ProcStatData {
+    char state;             /* process state, e.g. 'R', 'S', 'D' */
     unsigned long utime;    /* number of jiffies scheduled in user mode */
     unsigned long stime;    /* number of jiffies scheduled in kernel mode */
     int processor;          /* number of CPU that last executed thread */
@@ -307,6 +329,18 @@ const char* dvmPathToAbsolutePortion(const char* path);
 /**
  * Returns a string corresponding to printf-like formatting of the arguments.
  */
-std::string dvmStringPrintf(const char* fmt, ...) __attribute__((__format__ (__printf__, 1, 2)));
+std::string StringPrintf(const char* fmt, ...)
+        __attribute__((__format__ (__printf__, 1, 2)));
+
+/**
+ * Appends a printf-like formatting of the arguments to 'dst'.
+ */
+void StringAppendF(std::string* dst, const char* fmt, ...)
+        __attribute__((__format__ (__printf__, 2, 3)));
+
+/**
+ * Appends a printf-like formatting of the arguments to 'dst'.
+ */
+void StringAppendV(std::string* dst, const char* format, va_list ap);
 
-#endif /*_DALVIK_MISC*/
+#endif  // DALVIK_MISC_H_