Log line-at-a-time to work around Android logging lossage.

Also deduplicate the two copies of gettid, and switch image_test over
to using SignalCatcher's SIGQUIT dumping rather than rolling its own
subset.

Change-Id: I8b70aaa3a3b9258c8258728c6a66e5dc4fa6399e
diff --git a/src/utils.cc b/src/utils.cc
index 3be3fa6..90dd842 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -1,11 +1,16 @@
 // Copyright 2011 Google Inc. All Rights Reserved.
 // Author: enh@google.com (Elliott Hughes)
 
+#include "utils.h"
+
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
 #include "UniquePtr.h"
 #include "file.h"
 #include "object.h"
 #include "os.h"
-#include "utils.h"
 
 namespace art {
 
@@ -209,3 +214,15 @@
 }
 
 }  // namespace art
+
+// Neither bionic nor glibc exposes gettid(2).
+#define __KERNEL__
+#include <linux/unistd.h>
+namespace art {
+#ifdef _syscall0
+_syscall0(pid_t, GetTid)
+#else
+pid_t GetTid() { return syscall(__NR_gettid); }
+#endif
+}  // namespace art
+#undef __KERNEL__