Fix abort regression.

Change https://googleplex-android-review.googlesource.com/#/c/249463/ set a
boolean prior to testing it meaning that all aborts were seen as recursive and
no meaningful log information was given.

Also a fix related to https://googleplex-android-review.googlesource.com/293665
where we were attempting to dump other threads stacks during aborting even
though those threads weren't suspended.

Change-Id: I1f848512c5e380529579db3d16bb8f5ddda36ad3
diff --git a/src/thread.cc b/src/thread.cc
index 2c955b1..74d58e3 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -859,14 +859,18 @@
 }
 
 void Thread::DumpStack(std::ostream& os) const {
-  // If we're currently in native code, dump that stack before dumping the managed stack.
-  if (ShouldShowNativeStack(this)) {
-    DumpKernelStack(os, GetTid(), "  kernel: ", false);
-    DumpNativeStack(os, GetTid(), "  native: ", false);
+  if (this == Thread::Current() || IsSuspended()) {
+    // If we're currently in native code, dump that stack before dumping the managed stack.
+    if (ShouldShowNativeStack(this)) {
+      DumpKernelStack(os, GetTid(), "  kernel: ", false);
+      DumpNativeStack(os, GetTid(), "  native: ", false);
+    }
+    UniquePtr<Context> context(Context::Create());
+    StackDumpVisitor dumper(os, const_cast<Thread*>(this), context.get(), !throwing_OutOfMemoryError_);
+    dumper.WalkStack();
+  } else {
+    os << "Not able to dump stack of thread that isn't suspended";
   }
-  UniquePtr<Context> context(Context::Create());
-  StackDumpVisitor dumper(os, const_cast<Thread*>(this), context.get(), !throwing_OutOfMemoryError_);
-  dumper.WalkStack();
 }
 
 void Thread::ThreadExitCallback(void* arg) {