Try to show lock owner in MONITOR thread dump.

A thread in the MONITOR state is blocked waiting on a monitor.  This
raises two interesting questions: (1) what lock is it waiting on, and
(2) who holds that lock?  The answer to (1) can be determined easily by
looking at the source code, but (2) is a bit harder.

This change extracts the target object from the instruction stream and
prints some information about it, e.g.:

- waiting to lock <0x40028c68> (a java.lang.Object) held by threadid=1 (main)

Also: fiddled with "must [not] be locked" on a recently-added function.

(cherry-picked from dalvik-dev)

Change-Id: Ic16695741760d50be70e70fb7470972cef28bb09
diff --git a/vm/Sync.c b/vm/Sync.c
index e6de6c3..fae35de 100644
--- a/vm/Sync.c
+++ b/vm/Sync.c
@@ -258,6 +258,21 @@
 }
 
 /*
+ * Get the thread that holds the lock on the specified object.  The
+ * object may be unlocked, thin-locked, or fat-locked.
+ *
+ * The caller must lock the thread list before calling here.
+ */
+Thread* dvmGetObjectLockHolder(Object* obj)
+{
+    u4 threadId = lockOwner(obj);
+
+    if (threadId == 0)
+        return NULL;
+    return dvmGetThreadByThreadId(threadId);
+}
+
+/*
  * Checks whether the given thread holds the given
  * objects's lock.
  */