Provide a convenience for logging types that don't have an operator<<.

Change-Id: I650b852ded67576dc5ec7c8e57732cfb49f1ecd6
diff --git a/src/thread.cc b/src/thread.cc
index 54d2e6c..841ea9b 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -344,9 +344,13 @@
   CHECK_PTHREAD_CALL(pthread_attr_destroy, (&attributes), __FUNCTION__);
 }
 
-void Thread::Dump(std::ostream& os) const {
+void Thread::Dump(std::ostream& os, bool dump_pending_exception) const {
   DumpState(os);
   DumpStack(os);
+  if (dump_pending_exception && IsExceptionPending()) {
+    os << "Pending " << PrettyTypeOf(GetException()) << " on thread:\n";
+    os << GetException()->Dump();
+  }
 }
 
 std::string GetSchedulerGroup(pid_t tid) {