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
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index ef1aa6a..1f60b54 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -3702,7 +3702,9 @@
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(),