diff options
author | Sebastien Hertz <shertz@google.com> | 2015-04-08 09:36:07 +0200 |
---|---|---|
committer | Sebastien Hertz <shertz@google.com> | 2015-05-18 10:20:08 +0200 |
commit | 6650075fb831379d24cfafc3d56442e742418688 (patch) | |
tree | b69ebc7f02846c8b664380a4979fa2053386e51e /runtime/debugger.cc | |
parent | d8b19f1869f3cb1b7a6db3268ff2e2e6bbc6543b (diff) | |
download | art-6650075fb831379d24cfafc3d56442e742418688.zip art-6650075fb831379d24cfafc3d56442e742418688.tar.gz art-6650075fb831379d24cfafc3d56442e742418688.tar.bz2 |
JDWP: more GC safety
Ensures GC safety when keeping references that may be moved by GC:
- SingleStepControl: stores ArtMethod* in a GcRoot
- ModBasket: stores references in a StackHandleScope
Bug: 18166750
(cherry picked from commit 261bc044a3575512869586593e99e97cd8b1c321)
Change-Id: I35971a901537956739d1f089d61cb4ea9dc6c93d
Diffstat (limited to 'runtime/debugger.cc')
-rw-r--r-- | runtime/debugger.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc index 4bc9f98..852ba49 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -411,7 +411,7 @@ void DebugInvokeReq::VisitRoots(RootVisitor* visitor, const RootInfo& root_info) } void SingleStepControl::VisitRoots(RootVisitor* visitor, const RootInfo& root_info) { - visitor->VisitRootIfNonNull(reinterpret_cast<mirror::Object**>(&method_), root_info); + method_.VisitRootIfNonNull(visitor, root_info); } void SingleStepControl::AddDexPc(uint32_t dex_pc) { @@ -2929,10 +2929,11 @@ void Dbg::PostException(mirror::Throwable* exception_object) { if (!IsDebuggerActive()) { return; } - StackHandleScope<1> handle_scope(Thread::Current()); + Thread* const self = Thread::Current(); + StackHandleScope<1> handle_scope(self); Handle<mirror::Throwable> h_exception(handle_scope.NewHandle(exception_object)); std::unique_ptr<Context> context(Context::Create()); - CatchLocationFinder clf(Thread::Current(), h_exception, context.get()); + CatchLocationFinder clf(self, h_exception, context.get()); clf.WalkStack(/* include_transitions */ false); JDWP::EventLocation exception_throw_location; SetEventLocation(&exception_throw_location, clf.GetThrowMethod(), clf.GetThrowDexPc()); @@ -3981,7 +3982,7 @@ void Dbg::ExecuteMethod(DebugInvokeReq* pReq) { Handle<mirror::Object> object_result = hs.NewHandle(is_object_result ? result.GetL() : nullptr); Handle<mirror::Throwable> exception = hs.NewHandle(soa.Self()->GetException()); soa.Self()->ClearException(); - pReq->exception = gRegistry->Add(exception.Get()); + pReq->exception = gRegistry->Add(exception); if (pReq->exception != 0) { VLOG(jdwp) << " JDWP invocation returning with exception=" << exception.Get() << " " << exception->Dump(); |