OSDN Git Service

Only watch location for BREAKPOINT event
authorSebastien Hertz <shertz@google.com>
Wed, 8 Oct 2014 11:54:55 +0000 (13:54 +0200)
committerSebastien Hertz <shertz@google.com>
Thu, 9 Oct 2014 16:32:50 +0000 (18:32 +0200)
This CL ensures we watch a location for BREAKPOINT event only. Other
events (single-step, method entry/exit, ...) are handled differently
and LocationOnly modifier is used as an event filter in this case.

This prevents from failing a check when we need to deoptimize for
non-breakpoint event.

Bug: 17908144
Change-Id: Ib413d62fa31480fec8d750543c0605ba52188350

runtime/jdwp/jdwp_event.cc

index 7c8c63c..d1229b2 100644 (file)
@@ -181,8 +181,14 @@ JdwpError JdwpState::RegisterEvent(JdwpEvent* pEvent) {
     for (int i = 0; i < pEvent->modCount; i++) {
       const JdwpEventMod* pMod = &pEvent->mods[i];
       if (pMod->modKind == MK_LOCATION_ONLY) {
-        /* should only be for Breakpoint, Step, and Exception */
-        Dbg::WatchLocation(&pMod->locationOnly.loc, &req);
+        // Should only concern breakpoint, field access, field modification, step, and exception
+        // events.
+        // However breakpoint requires specific handling. Field access, field modification and step
+        // events need full deoptimization to be reported while exception event is reported during
+        // exception handling.
+        if (pEvent->eventKind == EK_BREAKPOINT) {
+          Dbg::WatchLocation(&pMod->locationOnly.loc, &req);
+        }
       } else if (pMod->modKind == MK_STEP) {
         /* should only be for EK_SINGLE_STEP; should only be one */
         JdwpStepSize size = static_cast<JdwpStepSize>(pMod->step.size);
@@ -258,8 +264,10 @@ void JdwpState::UnregisterEvent(JdwpEvent* pEvent) {
     for (int i = 0; i < pEvent->modCount; i++) {
       JdwpEventMod* pMod = &pEvent->mods[i];
       if (pMod->modKind == MK_LOCATION_ONLY) {
-        /* should only be for Breakpoint, Step, and Exception */
-        Dbg::UnwatchLocation(&pMod->locationOnly.loc, &req);
+        // Like in RegisterEvent, we need specific handling for breakpoint only.
+        if (pEvent->eventKind == EK_BREAKPOINT) {
+          Dbg::UnwatchLocation(&pMod->locationOnly.loc, &req);
+        }
       }
       if (pMod->modKind == MK_STEP) {
         /* should only be for EK_SINGLE_STEP; should only be one */