summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Sebastien Hertz <shertz@google.com> 2015-05-28 11:00:57 +0200
committer Sebastien Hertz <shertz@google.com> 2015-05-28 11:35:01 +0200
commit52f5f93873ec244320e05b033243c5c7a3ae40e2 (patch)
treebbd55d9daa0ef2584d958dee376561426f335463
parent03b5a398a96ea29c39ddfe3d810245b868d2871f (diff)
Fix single-step in native thread
If we attempt to single-step in a thread that is not running Java code, there is no current method on the stack. So we need to check for null before trying to decode debug info. Bug: 21320157 Change-Id: Idef9954d14e1eb7185f25d2a6e238135ac52d35f
-rw-r--r--runtime/debugger.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index ef1aa6a98c..1f60b5492e 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -3702,7 +3702,9 @@ JDWP::JdwpError Dbg::ConfigureStep(JDWP::ObjectId thread_id, JDWP::JdwpStepSize
mirror::ArtMethod* m = single_step_control->GetMethod();
const int32_t line_number = visitor.line_number;
- if (!m->IsNative()) {
+ // Note: if the thread is not running Java code (pure native thread), there is no "current"
+ // method on the stack (and no line number either).
+ if (m != nullptr && !m->IsNative()) {
const DexFile::CodeItem* const code_item = m->GetCodeItem();
DebugCallbackContext context(single_step_control, line_number, code_item);
m->GetDexFile()->DecodeDebugInfo(code_item, m->IsStatic(), m->GetDexMethodIndex(),