Implement ThreadReference.OwnedMonitors.

Fix the method verifier so it can cope with not being able to resolve
types in the application class loader, so we can find monitors held in
application code (this will improve SIGQUIT too).

Also remove the sort|uniq of dex pcs by just recording the last work
line we see.

Change-Id: I86ff27b42800a858489d112931c9aed2fb85ebdc
diff --git a/src/thread.cc b/src/thread.cc
index 5acc611..f7c568f 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -85,7 +85,6 @@
 }
 
 void Thread::SetDebuggerUpdatesEnabled(bool enabled) {
-  LOG(INFO) << "Turning debugger updates " << (enabled ? "on" : "off") << " for " << *this;
 #if !defined(ART_USE_LLVM_COMPILER)
   ChangeDebuggerEntryPoint(&entrypoints_, enabled);
 #else
@@ -887,13 +886,20 @@
         Monitor::DescribeWait(os, thread);
       }
       if (can_allocate) {
-        Monitor::DescribeLocks(os, this);
+        Monitor::VisitLocks(this, DumpLockedObject, &os);
       }
     }
 
     ++frame_count;
     return true;
   }
+
+  static void DumpLockedObject(Object* o, void* context)
+      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+    std::ostream& os = *reinterpret_cast<std::ostream*>(context);
+    os << "  - locked <" << o << "> (a " << PrettyTypeOf(o) << ")\n";
+  }
+
   std::ostream& os;
   const Thread* thread;
   bool can_allocate;