summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-02-25 20:29:47 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-02-25 20:29:48 +0000
commit678d6f42c4805d4989063a00c26776a494a80175 (patch)
tree0f7488219a03f7ead38e6c374446c7afde06e3c4 /runtime
parentb55c898c6e3a1569a03cedbfc6dbf93d8d8ff3dd (diff)
parent8d7672e476a526aa6205a008b5a06c8216342ac6 (diff)
downloadart-678d6f42c4805d4989063a00c26776a494a80175.zip
art-678d6f42c4805d4989063a00c26776a494a80175.tar.gz
art-678d6f42c4805d4989063a00c26776a494a80175.tar.bz2
Merge "Print message when throwing new exception with pending exception."
Diffstat (limited to 'runtime')
-rw-r--r--runtime/thread.cc12
-rw-r--r--runtime/thread.h1
2 files changed, 12 insertions, 1 deletions
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 8b93b91..4fe9169 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -1005,6 +1005,15 @@ void Thread::AssertNoPendingException() const {
}
}
+void Thread::AssertNoPendingExceptionForNewException(const char* msg) const {
+ if (UNLIKELY(IsExceptionPending())) {
+ ScopedObjectAccess soa(Thread::Current());
+ mirror::Throwable* exception = GetException(nullptr);
+ LOG(FATAL) << "Throwing new exception " << msg << " with unexpected pending exception: "
+ << exception->Dump();
+ }
+}
+
static void MonitorExitVisitor(mirror::Object** object, void* arg, uint32_t /*thread_id*/,
RootType /*root_type*/)
NO_THREAD_SAFETY_ANALYSIS {
@@ -1507,7 +1516,8 @@ void Thread::ThrowNewExceptionV(const ThrowLocation& throw_location,
void Thread::ThrowNewException(const ThrowLocation& throw_location, const char* exception_class_descriptor,
const char* msg) {
- AssertNoPendingException(); // Callers should either clear or call ThrowNewWrappedException.
+ // Callers should either clear or call ThrowNewWrappedException.
+ AssertNoPendingExceptionForNewException(msg);
ThrowNewWrappedException(throw_location, exception_class_descriptor, msg);
}
diff --git a/runtime/thread.h b/runtime/thread.h
index 9813130..f9d31af 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -285,6 +285,7 @@ class PACKED(4) Thread {
}
void AssertNoPendingException() const;
+ void AssertNoPendingExceptionForNewException(const char* msg) const;
void SetException(const ThrowLocation& throw_location, mirror::Throwable* new_exception)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {