From 6963e44331258b131bcc0599b868ba15902d6d22 Mon Sep 17 00:00:00 2001 From: Sebastien Hertz Date: Wed, 26 Nov 2014 22:11:27 +0100 Subject: JDWP: fix breakpoint for method in the image When we set a breakpoint in a compiled method, we deoptimize it by changing its entrypoint so it is executed with the interpreter. However, methods in the image can be called with their direct code pointer, ignoring the updated entrypoint. In that case, the method is not executed with the interpreter and we miss the breakpoint. This CL avoids that situation by forcing a full deoptimization so everything runs with the interpreter. However, if the image has been compiled in PIC mode, we keep using selective deoptimization because direct code pointer is not used in this mode. Bug: 17965285 Change-Id: Icaf8cbb7fe9ad01d36f7378c59d50d9ce42ae57f --- runtime/class_linker_test.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'runtime/class_linker_test.cc') diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc index 99d0746962..c22c51e525 100644 --- a/runtime/class_linker_test.cc +++ b/runtime/class_linker_test.cc @@ -1141,4 +1141,24 @@ TEST_F(ClassLinkerTest, Preverified_App) { CheckPreverified(statics.Get(), true); } +TEST_F(ClassLinkerTest, IsBootStrapClassLoaded) { + ScopedObjectAccess soa(Thread::Current()); + + StackHandleScope<3> hs(soa.Self()); + Handle class_loader( + hs.NewHandle(soa.Decode(LoadDex("Statics")))); + + // java.lang.Object is a bootstrap class. + Handle jlo_class( + hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "Ljava/lang/Object;"))); + ASSERT_TRUE(jlo_class.Get() != nullptr); + EXPECT_TRUE(jlo_class.Get()->IsBootStrapClassLoaded()); + + // Statics is not a bootstrap class. + Handle statics( + hs.NewHandle(class_linker_->FindClass(soa.Self(), "LStatics;", class_loader))); + ASSERT_TRUE(statics.Get() != nullptr); + EXPECT_FALSE(statics.Get()->IsBootStrapClassLoaded()); +} + } // namespace art -- cgit v1.2.3-59-g8ed1b