IDEA-134483 Support kotlin inline functions debugging
authorMikhael Bogdanov <mikhael.bogdanov@jetbrains.com>
Tue, 23 Dec 2014 10:14:35 +0000 (13:14 +0300)
committerEgor.Ushakov <egor.ushakov@jetbrains.com>
Tue, 23 Dec 2014 10:15:21 +0000 (13:15 +0300)
java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java
java/debugger/impl/src/com/intellij/debugger/engine/requests/RequestManagerImpl.java
java/debugger/openapi/src/com/intellij/debugger/MultiRequestPositionManager.java [new file with mode: 0644]

index d43a1bb0b6ee54ef12e09be3979f296db2aa8f85..aabdc0fcb17555455e92875dd96d23e7421c1799 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.intellij.debugger.engine;
 
+import com.intellij.debugger.MultiRequestPositionManager;
 import com.intellij.debugger.NoDataException;
 import com.intellij.debugger.PositionManager;
 import com.intellij.debugger.SourcePosition;
@@ -38,7 +39,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
-public class CompoundPositionManager extends PositionManagerEx {
+public class CompoundPositionManager extends PositionManagerEx implements MultiRequestPositionManager{
   private static final Logger LOG = Logger.getInstance(CompoundPositionManager.class);
 
   private final ArrayList<PositionManager> myPositionManagers = new ArrayList<PositionManager>();
@@ -168,6 +169,38 @@ public class CompoundPositionManager extends PositionManagerEx {
     return null;
   }
 
+  @NotNull
+  @Override
+  public List<ClassPrepareRequest> createPrepareRequests(@NotNull ClassPrepareRequestor requestor, @NotNull SourcePosition position) {
+    for (PositionManager positionManager : myPositionManagers) {
+      try {
+        if (positionManager instanceof MultiRequestPositionManager) {
+          return ((MultiRequestPositionManager)positionManager).createPrepareRequests(requestor, position);
+        }
+        else {
+          ClassPrepareRequest prepareRequest = positionManager.createPrepareRequest(requestor, position);
+          if (prepareRequest == null) {
+            return Collections.emptyList();
+          }
+          return Collections.singletonList(prepareRequest);
+        }
+      }
+      catch (NoDataException ignored) {
+      }
+      catch (VMDisconnectedException e) {
+        throw e;
+      }
+      catch (Exception e) {
+        LOG.error(e);
+      }
+      catch (AssertionError e) {
+        LOG.error(e);
+      }
+    }
+
+    return Collections.emptyList();
+  }
+
   @Nullable
   @Override
   public XStackFrame createStackFrame(@NotNull StackFrameProxyImpl frame, @NotNull DebugProcessImpl debugProcess, @NotNull Location location) {
index c4e08c03d931b335dfc9fde4eb2d52447c18d59a..9ef6ab90be05dc805372b81a0b164c7f6058d0de 100644 (file)
@@ -38,10 +38,7 @@ import com.sun.jdi.event.ClassPrepareEvent;
 import com.sun.jdi.request.*;
 import org.jetbrains.annotations.Nullable;
 
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 /**
  * @author lex
@@ -307,15 +304,17 @@ public class RequestManagerImpl extends DebugProcessAdapterImpl implements Reque
 
   public void callbackOnPrepareClasses(final ClassPrepareRequestor requestor, final SourcePosition classPosition) {
     DebuggerManagerThreadImpl.assertIsManagerThread();
-    ClassPrepareRequest prepareRequest = myDebugProcess.getPositionManager().createPrepareRequest(requestor, classPosition);
 
-    if(prepareRequest == null) {
+    List<ClassPrepareRequest> prepareRequests = myDebugProcess.getPositionManager().createPrepareRequests(requestor, classPosition);
+    if(prepareRequests.isEmpty()) {
       setInvalid(requestor, DebuggerBundle.message("status.invalid.breakpoint.out.of.class"));
       return;
     }
 
-    registerRequest(requestor, prepareRequest);
-    prepareRequest.enable();
+    for (ClassPrepareRequest prepareRequest : prepareRequests) {
+      registerRequest(requestor, prepareRequest);
+      prepareRequest.enable();
+    }
   }
 
   public void callbackOnPrepareClasses(ClassPrepareRequestor requestor, String classOrPatternToBeLoaded) {
diff --git a/java/debugger/openapi/src/com/intellij/debugger/MultiRequestPositionManager.java b/java/debugger/openapi/src/com/intellij/debugger/MultiRequestPositionManager.java
new file mode 100644 (file)
index 0000000..0052a77
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.debugger;
+
+import com.intellij.debugger.requests.ClassPrepareRequestor;
+import com.sun.jdi.request.ClassPrepareRequest;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+public interface MultiRequestPositionManager extends PositionManager {
+
+  /**
+   * @see PositionManager#createPrepareRequest
+   */
+  @NotNull
+  List<ClassPrepareRequest> createPrepareRequests(@NotNull ClassPrepareRequestor requestor, @NotNull SourcePosition position)
+    throws NoDataException;
+}