diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2015-02-26 10:56:09 +0000 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2015-03-03 17:50:49 +0000 |
commit | 7642cfc90fc9c3ebfd8e3b5041915705c93b5cf0 (patch) | |
tree | 807b3c797483310ac23954c5eddb7441b91749c5 /runtime/thread.cc | |
parent | dc47e986941b1a3754447fabea272485f3f0f382 (diff) | |
download | art-7642cfc90fc9c3ebfd8e3b5041915705c93b5cf0.tar.gz art-7642cfc90fc9c3ebfd8e3b5041915705c93b5cf0.tar.bz2 art-7642cfc90fc9c3ebfd8e3b5041915705c93b5cf0.zip |
Change how we report exceptions to the debugger.
This is only a refactoring/cleanup. Bug fixes with respect
to catch location, and more cleanups will follow.
Change-Id: I30d3c6260b0c8f8115a811621397225b88f2063a
Diffstat (limited to 'runtime/thread.cc')
-rw-r--r-- | runtime/thread.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/runtime/thread.cc b/runtime/thread.cc index 79d0066ee..fdb1f9dd4 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(); |