Include the crashing thread's name in crash dumps.

Change-Id: I7fd821e3f390fde3a7280689292373d413218893
diff --git a/src/utils.cc b/src/utils.cc
index 084456d..d45568e 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -69,6 +69,16 @@
 #endif
 }
 
+std::string GetThreadName(pid_t tid) {
+  std::string result;
+  if (ReadFileToString(StringPrintf("/proc/self/task/%d/comm", tid), &result)) {
+    result.resize(result.size() - 1); // Lose the trailing '\n'.
+  } else {
+    result = "<unknown>";
+  }
+  return result;
+}
+
 void GetThreadStack(void*& stack_base, size_t& stack_size) {
 #if defined(__APPLE__)
   stack_size = pthread_get_stacksize_np(pthread_self());