Return values for locals, so "locals" can show them.

Also implement a couple of other JDWP commands so jdb can show the length
of arrays and the value of strings.

Change-Id: Ib2a4dc2ee784ee10bdb924e91b0150aa8a96845d
diff --git a/src/jdwp/jdwp_handler.cc b/src/jdwp/jdwp_handler.cc
index 3d00930..c0a44e0 100644
--- a/src/jdwp/jdwp_handler.cc
+++ b/src/jdwp/jdwp_handler.cc
@@ -157,9 +157,7 @@
     /* show detailed debug output */
     if (resultTag == JT_STRING && exceptObjId == 0) {
       if (resultValue != 0) {
-        char* str = Dbg::StringToUtf8(resultValue);
-        LOG(VERBOSE) << StringPrintf("      string '%s'", str);
-        free(str);
+        LOG(VERBOSE) << "      string '" << Dbg::StringToUtf8(resultValue) << "'";
       } else {
         LOG(VERBOSE) << "      string (null)";
       }
@@ -875,12 +873,11 @@
  */
 static JdwpError handleSR_Value(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
   ObjectId stringObject = ReadObjectId(&buf);
-  char* str = Dbg::StringToUtf8(stringObject);
+  std::string str(Dbg::StringToUtf8(stringObject));
 
-  LOG(VERBOSE) << StringPrintf("  Req for str %llx --> '%s'", stringObject, str);
+  LOG(VERBOSE) << StringPrintf("  Req for str %llx --> '%s'", stringObject, str.c_str());
 
-  expandBufAddUtf8String(pReply, str);
-  free(str);
+  expandBufAddUtf8String(pReply, str.c_str());
 
   return ERR_NONE;
 }