summaryrefslogtreecommitdiffstats
path: root/runtime/debugger.cc
diff options
context:
space:
mode:
authorSebastien Hertz <shertz@google.com>2014-11-26 22:11:27 +0100
committerSebastien Hertz <shertz@google.com>2014-12-04 10:20:24 +0100
commit6963e44331258b131bcc0599b868ba15902d6d22 (patch)
tree24ef16e739e99d3e9d980f2acde8dd301c236c37 /runtime/debugger.cc
parent220526b05d4365a1820a694c98527eda2d3dc980 (diff)
downloadart-6963e44331258b131bcc0599b868ba15902d6d22.zip
art-6963e44331258b131bcc0599b868ba15902d6d22.tar.gz
art-6963e44331258b131bcc0599b868ba15902d6d22.tar.bz2
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
Diffstat (limited to 'runtime/debugger.cc')
-rw-r--r--runtime/debugger.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 49b132d..86d027b 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -3266,8 +3266,16 @@ static DeoptimizationRequest::Kind GetRequiredDeoptimizationKind(Thread* self,
ClassLinker* const class_linker = Runtime::Current()->GetClassLinker();
const bool is_compiled = class_linker->GetOatMethodQuickCodeFor(m) != nullptr;
if (is_compiled) {
- VLOG(jdwp) << "Need selective deoptimization for compiled method " << PrettyMethod(m);
- return DeoptimizationRequest::kSelectiveDeoptimization;
+ // If the method may be called through its direct code pointer (without loading
+ // its updated entrypoint), we need full deoptimization to not miss the breakpoint.
+ if (class_linker->MayBeCalledWithDirectCodePointer(m)) {
+ VLOG(jdwp) << "Need full deoptimization because of possible direct code call "
+ << "into image for compiled method " << PrettyMethod(m);
+ return DeoptimizationRequest::kFullDeoptimization;
+ } else {
+ VLOG(jdwp) << "Need selective deoptimization for compiled method " << PrettyMethod(m);
+ return DeoptimizationRequest::kSelectiveDeoptimization;
+ }
} else {
// Method is not compiled: we don't need to deoptimize.
VLOG(jdwp) << "No need for deoptimization for non-compiled method " << PrettyMethod(m);