summaryrefslogtreecommitdiff
path: root/runtime/thread.cc
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2015-03-04 11:13:16 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2015-03-04 11:13:17 +0000
commit3d7d2af4c6502b771b032ee9bf3ab30e78f9c60d (patch)
treecc15416fa8208661fe98a19055fa4c98010a0e53 /runtime/thread.cc
parent87896b3a1f97c815fe02c7490c1f27951c58bbbf (diff)
parent7642cfc90fc9c3ebfd8e3b5041915705c93b5cf0 (diff)
Merge "Change how we report exceptions to the debugger."
Diffstat (limited to 'runtime/thread.cc')
-rw-r--r--runtime/thread.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 79d0066eef..fdb1f9dd4c 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -1626,6 +1626,12 @@ template jobject Thread::CreateInternalStackTrace<false>(
template jobject Thread::CreateInternalStackTrace<true>(
const ScopedObjectAccessAlreadyRunnable& soa) const;
+bool Thread::IsExceptionThrownByCurrentMethod(mirror::Throwable* exception) const {
+ CountStackDepthVisitor count_visitor(const_cast<Thread*>(this));
+ count_visitor.WalkStack();
+ return count_visitor.GetDepth() == exception->GetStackDepth();
+}
+
jobjectArray Thread::InternalStackTraceToStackTraceElementArray(
const ScopedObjectAccessAlreadyRunnable& soa, jobject internal, jobjectArray output_array,
int* stack_depth) {
@@ -1745,7 +1751,6 @@ void Thread::ThrowNewWrappedException(const ThrowLocation& throw_location,
Handle<mirror::ArtMethod> saved_throw_method(hs.NewHandle(throw_location.GetMethod()));
// Ignore the cause throw location. TODO: should we report this as a re-throw?
ScopedLocalRef<jobject> cause(GetJniEnv(), soa.AddLocalReference<jobject>(GetException(nullptr)));
- bool is_exception_reported = IsExceptionReportedToInstrumentation();
ClearException();
Runtime* runtime = Runtime::Current();
@@ -1777,7 +1782,6 @@ void Thread::ThrowNewWrappedException(const ThrowLocation& throw_location,
ThrowLocation gc_safe_throw_location(saved_throw_this.Get(), saved_throw_method.Get(),
throw_location.GetDexPc());
SetException(gc_safe_throw_location, Runtime::Current()->GetPreAllocatedOutOfMemoryError());
- SetExceptionReportedToInstrumentation(is_exception_reported);
return;
}
@@ -1830,7 +1834,6 @@ void Thread::ThrowNewWrappedException(const ThrowLocation& throw_location,
ThrowLocation gc_safe_throw_location(saved_throw_this.Get(), saved_throw_method.Get(),
throw_location.GetDexPc());
SetException(gc_safe_throw_location, exception.Get());
- SetExceptionReportedToInstrumentation(is_exception_reported);
} else {
jvalue jv_args[2];
size_t i = 0;
@@ -1848,7 +1851,6 @@ void Thread::ThrowNewWrappedException(const ThrowLocation& throw_location,
ThrowLocation gc_safe_throw_location(saved_throw_this.Get(), saved_throw_method.Get(),
throw_location.GetDexPc());
SetException(gc_safe_throw_location, exception.Get());
- SetExceptionReportedToInstrumentation(is_exception_reported);
}
}
}
@@ -2033,14 +2035,13 @@ void Thread::QuickDeliverException() {
CHECK(exception != nullptr);
// Don't leave exception visible while we try to find the handler, which may cause class
// resolution.
- bool is_exception_reported = IsExceptionReportedToInstrumentation();
ClearException();
bool is_deoptimization = (exception == GetDeoptimizationException());
QuickExceptionHandler exception_handler(this, is_deoptimization);
if (is_deoptimization) {
exception_handler.DeoptimizeStack();
} else {
- exception_handler.FindCatch(throw_location, exception, is_exception_reported);
+ exception_handler.FindCatch(throw_location, exception);
}
exception_handler.UpdateInstrumentationStack();
exception_handler.DoLongJump();