Hold heap bitmap lock in Heap::GetObjectsAllocated

Fixes a race condition where add and remove space could cause a crash
when we iterated over the spaces.

TODO: Add a spaces lock or something to guard against this.

(cherry picked from commit a395c0a492079d86b312c9edc796d63001576954)

Bug: 21031927

Change-Id: I7f0d558316f8e9d9f22ffd182e8666355bf50d47
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 811d15a..4bc9f98 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -2143,6 +2143,7 @@
     case kWaitingForDebuggerToAttach:
     case kWaitingForDeoptimization:
     case kWaitingForGcToComplete:
+    case kWaitingForGetObjectsAllocated:
     case kWaitingForJniOnLoad:
     case kWaitingForMethodTracingStart:
     case kWaitingForSignalCatcherOutput: