summaryrefslogtreecommitdiffstats
path: root/runtime/debugger.cc
diff options
context:
space:
mode:
authorSebastien Hertz <shertz@google.com>2015-04-08 09:36:07 +0200
committerSebastien Hertz <shertz@google.com>2015-05-18 10:20:08 +0200
commit6650075fb831379d24cfafc3d56442e742418688 (patch)
treeb69ebc7f02846c8b664380a4979fa2053386e51e /runtime/debugger.cc
parentd8b19f1869f3cb1b7a6db3268ff2e2e6bbc6543b (diff)
downloadart-6650075fb831379d24cfafc3d56442e742418688.tar.gz
art-6650075fb831379d24cfafc3d56442e742418688.tar.bz2
art-6650075fb831379d24cfafc3d56442e742418688.zip
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.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 4bc9f98dfe..852ba49cd2 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();