summaryrefslogtreecommitdiffstats
path: root/runtime/jdwp
diff options
context:
space:
mode:
authorSebastien Hertz <shertz@google.com>2014-12-18 11:13:15 +0100
committerSebastien Hertz <shertz@google.com>2014-12-18 11:29:28 +0100
commit107e757bfd32cc27750955e6f392986414bebe75 (patch)
treee75824f21bbd9c75b865608ccfe1c09c70ea50a7 /runtime/jdwp
parentfcd3f33dde47ce13305a7dfb5a665bf832535ae4 (diff)
downloadart-107e757bfd32cc27750955e6f392986414bebe75.tar.gz
art-107e757bfd32cc27750955e6f392986414bebe75.tar.bz2
art-107e757bfd32cc27750955e6f392986414bebe75.zip
JDWP: do not report start/end events for thread without peer
To report start/end thread events, we need the JDWP id of the thread. To create a JDWP id, we need its java.lang.Thread peer. In the case there is no Java peer, we can't report the event. Follow-up https://android-review.googlesource.com/118548 where the runtime attaches the current thread without Java peer when shutting down. Change-Id: Icc2d50f3d2eedd1e0e3c5a21affd2261aaf7a862
Diffstat (limited to 'runtime/jdwp')
-rw-r--r--runtime/jdwp/jdwp_event.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/jdwp/jdwp_event.cc b/runtime/jdwp/jdwp_event.cc
index 1bf16b285c..cb28ff0647 100644
--- a/runtime/jdwp/jdwp_event.cc
+++ b/runtime/jdwp/jdwp_event.cc
@@ -1015,6 +1015,14 @@ void JdwpState::PostThreadChange(Thread* thread, bool start) {
return;
}
+ // We need the java.lang.Thread object associated to the starting/ending
+ // thread to get its JDWP id. Therefore we can't report event if there
+ // is no Java peer. This happens when the runtime shuts down and re-attaches
+ // the current thread without creating a Java peer.
+ if (thread->GetPeer() == nullptr) {
+ return;
+ }
+
ModBasket basket;
basket.thread = thread;