diff options
author | Sebastien Hertz <shertz@google.com> | 2015-05-28 11:00:57 +0200 |
---|---|---|
committer | Sebastien Hertz <shertz@google.com> | 2015-05-28 13:34:22 +0200 |
commit | 1309ba27dd02e0e4dea0e45f8b5500080cbbd703 (patch) | |
tree | cca1b449afd96fdf044a45bd39e8cf2a9721e468 | |
parent | df6ba9a06ac9f4d45f49a1efc14b0d2393003317 (diff) | |
download | art-1309ba27dd02e0e4dea0e45f8b5500080cbbd703.tar.gz art-1309ba27dd02e0e4dea0e45f8b5500080cbbd703.tar.bz2 art-1309ba27dd02e0e4dea0e45f8b5500080cbbd703.zip |
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
(cherry picked from commit 52f5f93873ec244320e05b033243c5c7a3ae40e2)
Change-Id: I961108071dd58a23f6327370b00c35a4cabe0aa7
-rw-r--r-- | runtime/debugger.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc index 0752c59a9..728e8e3cc 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -3703,7 +3703,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(), |