From f8ab6be30ab62ecd408601b488ce8d32828ca333 Mon Sep 17 00:00:00 2001 From: Egor Ushakov Date: Fri, 29 Jun 2018 17:50:27 +0300 Subject: [PATCH] capture agent: avoid key evaluation on IDE side we could get the captured stack for the current place using only CURRENT_STACKS queue; also it allows to drop insertion points list in IDE (and matching), this will simplify handling of stand-alone agent in IDEA-194359 --- .../rt/debugger/agent/CaptureStorage.java | 11 ++- .../impl/intellij.java.debugger.impl.iml | 1 + .../debugger/engine/DebugProcessImpl.java | 12 --- .../debugger/engine/JavaExecutionStack.java | 86 +++++++++++-------- .../debugger/engine/JavaStackFrame.java | 17 ---- .../debugger/impl/DebuggerSession.java | 2 - .../debugger/memory/utils/StackFrameItem.java | 6 +- .../settings/CaptureSettingsProvider.java | 32 ------- .../StackCapturingLineBreakpoint.java | 55 ++++++------ 9 files changed, 92 insertions(+), 130 deletions(-) diff --git a/java/debugger/debugger-agent-storage/src/com/intellij/rt/debugger/agent/CaptureStorage.java b/java/debugger/debugger-agent-storage/src/com/intellij/rt/debugger/agent/CaptureStorage.java index 4e1ceaeb1284..69b9c7b1c1b5 100644 --- a/java/debugger/debugger-agent-storage/src/com/intellij/rt/debugger/agent/CaptureStorage.java +++ b/java/debugger/debugger-agent-storage/src/com/intellij/rt/debugger/agent/CaptureStorage.java @@ -214,11 +214,20 @@ public class CaptureStorage { } } + // to be run from the debugger + @SuppressWarnings("unused") + public static Object[][] getCurrentCapturedStack(int limit) { + return wrapInArray(CURRENT_STACKS.get().peekLast(), limit); + } + // to be run from the debugger @SuppressWarnings("unused") public static Object[][] getRelatedStack(Object key, int limit) { //noinspection SuspiciousMethodCalls - CapturedStack stack = STORAGE.get(new HardKey(key)); + return wrapInArray(STORAGE.get(new HardKey(key)), limit); + } + + private static Object[][] wrapInArray(CapturedStack stack, int limit) { if (stack == null) { return null; } diff --git a/java/debugger/impl/intellij.java.debugger.impl.iml b/java/debugger/impl/intellij.java.debugger.impl.iml index ab990d0aaefc..0ff8e3d8743b 100644 --- a/java/debugger/impl/intellij.java.debugger.impl.iml +++ b/java/debugger/impl/intellij.java.debugger.impl.iml @@ -22,6 +22,7 @@ + diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java index b7e4d61e1804..4d7a509342d3 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java @@ -17,7 +17,6 @@ import com.intellij.debugger.jdi.EmptyConnectorArgument; import com.intellij.debugger.jdi.StackFrameProxyImpl; import com.intellij.debugger.jdi.ThreadReferenceProxyImpl; import com.intellij.debugger.jdi.VirtualMachineProxyImpl; -import com.intellij.debugger.settings.CapturePoint; import com.intellij.debugger.settings.DebuggerSettings; import com.intellij.debugger.settings.NodeRendererSettings; import com.intellij.debugger.ui.breakpoints.BreakpointManager; @@ -133,8 +132,6 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb private final ThreadBlockedMonitor myThreadBlockedMonitor = new ThreadBlockedMonitor(this, myDisposable); - private List myAgentInsertPoints = Collections.emptyList(); - protected DebugProcessImpl(Project project) { myProject = project; myDebuggerManagerThread = new DebuggerManagerThreadImpl(myDisposable, myProject); @@ -2203,13 +2200,4 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb static boolean isResumeOnlyCurrentThread() { return DebuggerSettings.getInstance().RESUME_ONLY_CURRENT_THREAD; } - - @NotNull - public List getAgentInsertPoints() { - return myAgentInsertPoints; - } - - public void setAgentInsertPoints(@NotNull List agentInsertPoints) { - myAgentInsertPoints = agentInsertPoints; - } } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java index 98e5f0090878..959689b9d997 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java @@ -18,7 +18,6 @@ import com.intellij.icons.AllIcons; import com.intellij.openapi.diagnostic.Logger; import com.intellij.ui.ColoredTextContainer; import com.intellij.ui.SimpleTextAttributes; -import com.intellij.util.containers.ContainerUtil; import com.intellij.xdebugger.frame.XExecutionStack; import com.intellij.xdebugger.frame.XStackFrame; import com.intellij.xdebugger.impl.XDebugSessionImpl; @@ -142,7 +141,8 @@ public class JavaExecutionStack extends XExecutionStack { iterator.next(); added++; } - myDebugProcess.getManagerThread().schedule(new AppendFrameCommand(suspendContext, iterator, container, added, firstFrameIndex)); + myDebugProcess.getManagerThread().schedule( + new AppendFrameCommand(suspendContext, iterator, container, added, firstFrameIndex, null)); } catch (EvaluateException e) { container.errorOccurred(e.getMessage()); @@ -161,17 +161,20 @@ public class JavaExecutionStack extends XExecutionStack { private final XStackFrameContainer myContainer; private int myAdded; private final int mySkip; + private final List myAsyncStack; public AppendFrameCommand(SuspendContextImpl suspendContext, Iterator stackFramesIterator, XStackFrameContainer container, int added, - int skip) { + int skip, + List asyncStack) { super(suspendContext); myStackFramesIterator = stackFramesIterator; myContainer = container; myAdded = added; mySkip = skip; + myAsyncStack = asyncStack; } @Override @@ -209,49 +212,58 @@ public class JavaExecutionStack extends XExecutionStack { } // replace the rest with the related stack (if available) - if (frame instanceof JavaStackFrame - && AsyncStacksToggleAction.isAsyncStacksEnabled((XDebugSessionImpl)myDebugProcess.getXdebugProcess().getSession())) { - List relatedStack = StackCapturingLineBreakpoint.getRelatedStack(frameProxy, suspendContext, true); - if (!ContainerUtil.isEmpty(relatedStack)) { - int i = 0; - boolean separator = true; - for (StackFrameItem stackFrame : relatedStack) { - if (i > StackCapturingLineBreakpoint.getMaxStackLength()) { - addFrameIfNeeded(new XStackFrame() { - @Override - public void customizePresentation(@NotNull ColoredTextContainer component) { - component.append("Too many frames, the rest is truncated...", SimpleTextAttributes.REGULAR_ITALIC_ATTRIBUTES); - } - }, true); - return; - } - i++; - if (stackFrame == null) { - separator = true; - continue; - } - StackFrameItem.CapturedStackFrame newFrame = stackFrame.createFrame(myDebugProcess); - if (showFrame(newFrame)) { - newFrame.setWithSeparator(separator); - addFrameIfNeeded(newFrame, false); - separator = false; - } - } - myContainer.addStackFrames(Collections.emptyList(), true); + if (myAsyncStack != null) { + appendRelatedStack(myAsyncStack); + return; + } + + List relatedStack = null; + if (frame instanceof JavaStackFrame && + AsyncStacksToggleAction.isAsyncStacksEnabled((XDebugSessionImpl)myDebugProcess.getXdebugProcess().getSession())) { + relatedStack = StackCapturingLineBreakpoint.getRelatedStack(frameProxy, suspendContext); + if (relatedStack != null) { + appendRelatedStack(relatedStack); return; } - else { - ((JavaStackFrame)frame).setInsertCapturePoint(StackCapturingLineBreakpoint.getMatchingDisabledInsertionPoint(frameProxy)); - } + // append agent stack after the next frame + relatedStack = StackCapturingLineBreakpoint.getAgentRelatedStack((JavaStackFrame)frame, suspendContext); } myDebugProcess.getManagerThread().schedule( - new AppendFrameCommand(suspendContext, myStackFramesIterator, myContainer, myAdded, mySkip)); + new AppendFrameCommand(suspendContext, myStackFramesIterator, myContainer, myAdded, mySkip, relatedStack)); } else { - myContainer.addStackFrames(Collections.emptyList(), true); + myContainer.addStackFrames(Collections.emptyList(), true); } } + + void appendRelatedStack(@NotNull List asyncStack) { + int i = 0; + boolean separator = true; + for (StackFrameItem stackFrame : asyncStack) { + if (i > StackCapturingLineBreakpoint.getMaxStackLength()) { + addFrameIfNeeded(new XStackFrame() { + @Override + public void customizePresentation(@NotNull ColoredTextContainer component) { + component.append("Too many frames, the rest is truncated...", SimpleTextAttributes.REGULAR_ITALIC_ATTRIBUTES); + } + }, true); + return; + } + i++; + if (stackFrame == null) { + separator = true; + continue; + } + StackFrameItem.CapturedStackFrame newFrame = stackFrame.createFrame(myDebugProcess); + if (showFrame(newFrame)) { + newFrame.setWithSeparator(separator); + addFrameIfNeeded(newFrame, false); + separator = false; + } + } + myContainer.addStackFrames(Collections.emptyList(), true); + } } private static boolean showFrame(@NotNull XStackFrame frame) { diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java index 303e815c7d6b..754e1f3bbe49 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java @@ -12,8 +12,6 @@ import com.intellij.debugger.impl.DebuggerContextImpl; import com.intellij.debugger.impl.DebuggerSession; import com.intellij.debugger.impl.DebuggerUtilsEx; import com.intellij.debugger.jdi.*; -import com.intellij.debugger.memory.utils.StackFrameItem; -import com.intellij.debugger.settings.CapturePoint; import com.intellij.debugger.settings.DebuggerSettings; import com.intellij.debugger.settings.NodeRendererSettings; import com.intellij.debugger.ui.breakpoints.Breakpoint; @@ -35,7 +33,6 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.ui.ColoredTextContainer; -import com.intellij.ui.SimpleTextAttributes; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.text.CharArrayUtil; import com.intellij.xdebugger.XDebugSession; @@ -68,7 +65,6 @@ public class JavaStackFrame extends XStackFrame implements JVMStackFrameInfoProv @NotNull private final StackFrameDescriptorImpl myDescriptor; private JavaDebuggerEvaluator myEvaluator = null; private final String myEqualityObject; - private CapturePoint myInsertCapturePoint; public JavaStackFrame(@NotNull StackFrameDescriptorImpl descriptor, boolean update) { myDescriptor = descriptor; @@ -116,9 +112,6 @@ public class JavaStackFrame extends XStackFrame implements JVMStackFrameInfoProv } } JavaFramesListRenderer.customizePresentation(myDescriptor, component, selectedDescriptor); - if (myInsertCapturePoint != null) { - component.setIcon(XDebuggerUIConstants.INFORMATION_MESSAGE_ICON); - } } @Override @@ -133,12 +126,6 @@ public class JavaStackFrame extends XStackFrame implements JVMStackFrameInfoProv @Override public void threadAction(@NotNull SuspendContextImpl suspendContext) { if (node.isObsolete()) return; - if (myInsertCapturePoint != null) { - node.setMessage("Async stacktrace from " + - myInsertCapturePoint.myClassName + "." + myInsertCapturePoint.myMethodName + - " could be available here, enable in", XDebuggerUIConstants.INFORMATION_MESSAGE_ICON, - SimpleTextAttributes.REGULAR_ATTRIBUTES, StackFrameItem.CAPTURE_SETTINGS_OPENER); - } XValueChildrenList children = new XValueChildrenList(); buildVariablesThreadAction(getFrameDebuggerContext(getDebuggerContext()), children, node); node.addChildren(children, true); @@ -691,10 +678,6 @@ public class JavaStackFrame extends XStackFrame implements JVMStackFrameInfoProv return rangeRef.get(); } - public void setInsertCapturePoint(CapturePoint insertCapturePoint) { - myInsertCapturePoint = insertCapturePoint; - } - @Override public boolean isSynthetic() { return myDescriptor.isSynthetic(); diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java index e957ede04c78..1d96754cfaf5 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java @@ -10,7 +10,6 @@ import com.intellij.debugger.engine.jdi.StackFrameProxy; import com.intellij.debugger.engine.requests.RequestManagerImpl; import com.intellij.debugger.jdi.StackFrameProxyImpl; import com.intellij.debugger.jdi.ThreadReferenceProxyImpl; -import com.intellij.debugger.settings.CaptureSettingsProvider; import com.intellij.debugger.ui.breakpoints.Breakpoint; import com.intellij.debugger.ui.breakpoints.BreakpointWithHighlighter; import com.intellij.debugger.ui.breakpoints.LineBreakpoint; @@ -208,7 +207,6 @@ public class DebuggerSession implements AbstractDebuggerSession { myState = new DebuggerSessionState(State.STOPPED, null); myDebugProcess.addDebugProcessListener(new MyDebugProcessListener(debugProcess)); myDebugProcess.addEvaluationListener(new MyEvaluationListener()); - myDebugProcess.setAgentInsertPoints(CaptureSettingsProvider.getIdeInsertPoints()); ValueLookupManager.getInstance(getProject()).startListening(); mySearchScope = environment.getSearchScope(); myAlternativeJre = environment.getAlternativeJre(); diff --git a/java/debugger/impl/src/com/intellij/debugger/memory/utils/StackFrameItem.java b/java/debugger/impl/src/com/intellij/debugger/memory/utils/StackFrameItem.java index 2504cabcfdbe..eaba0af42dac 100644 --- a/java/debugger/impl/src/com/intellij/debugger/memory/utils/StackFrameItem.java +++ b/java/debugger/impl/src/com/intellij/debugger/memory/utils/StackFrameItem.java @@ -1,6 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.debugger.memory.utils; import com.intellij.debugger.DebuggerBundle; @@ -146,7 +144,7 @@ public class StackFrameItem { StackFrameItem frameItem = new StackFrameItem(location, vars); res.add(frameItem); - List relatedStack = StackCapturingLineBreakpoint.getRelatedStack(frame, suspendContext, false); + List relatedStack = StackCapturingLineBreakpoint.getRelatedStack(frame, suspendContext); if (!ContainerUtil.isEmpty(relatedStack)) { res.add(null); // separator res.addAll(relatedStack); diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/CaptureSettingsProvider.java b/java/debugger/impl/src/com/intellij/debugger/settings/CaptureSettingsProvider.java index e3c3c466fde4..e213c1db07ec 100644 --- a/java/debugger/impl/src/com/intellij/debugger/settings/CaptureSettingsProvider.java +++ b/java/debugger/impl/src/com/intellij/debugger/settings/CaptureSettingsProvider.java @@ -3,17 +3,14 @@ package com.intellij.debugger.settings; import com.intellij.debugger.engine.JVMNameUtil; import com.intellij.debugger.engine.evaluation.EvaluateException; -import com.intellij.debugger.jdi.DecompiledLocalVariable; import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.*; import com.intellij.util.containers.ContainerUtil; -import one.util.streamex.StreamEx; import java.util.ArrayList; -import java.util.Collections; import java.util.List; /** @@ -24,7 +21,6 @@ public class CaptureSettingsProvider { private static final List CAPTURE_POINTS = new ArrayList<>(); private static final List INSERT_POINTS = new ArrayList<>(); - private static final List IDE_INSERT_POINTS; private static final KeyProvider THIS_KEY = new StringKeyProvider("this"); private static final KeyProvider FIRST_PARAM = param(0); @@ -74,8 +70,6 @@ public class CaptureSettingsProvider { addCapture("com/sun/glass/ui/InvokeLaterDispatcher", "invokeLater", FIRST_PARAM); addInsert("com/sun/glass/ui/InvokeLaterDispatcher$Future", "run", new FieldKeyProvider("com/sun/glass/ui/InvokeLaterDispatcher$Future", "runnable")); - - IDE_INSERT_POINTS = StreamEx.of(INSERT_POINTS).map(p -> p.myInsertPoint).nonNull().toList(); } public static List getPoints() { @@ -86,15 +80,6 @@ public class CaptureSettingsProvider { return res; } - public static List getIdeInsertPoints() { - List res = Collections.unmodifiableList(IDE_INSERT_POINTS); - if (Registry.is("debugger.capture.points.agent.annotations")) { - res = ContainerUtil.concat( - res, StreamEx.of(getAnnotationPoints()).select(AgentInsertPoint.class).map(p -> p.myInsertPoint).nonNull().toList()); - } - return res; - } - private static List getAnnotationPoints() { return ReadAction.compute(() -> { List annotationPoints = new ArrayList<>(); @@ -178,25 +163,8 @@ public class CaptureSettingsProvider { } public static class AgentInsertPoint extends AgentPoint { - public final CapturePoint myInsertPoint; // for IDE - public AgentInsertPoint(String className, String methodName, String methodDesc, KeyProvider key) { super(className, methodName, methodDesc, key); - this.myInsertPoint = new CapturePoint(); - myInsertPoint.myInsertClassName = className.replaceAll("/", "."); - myInsertPoint.myInsertMethodName = methodName; - if (myKey instanceof FieldKeyProvider) { - myInsertPoint.myInsertKeyExpression = ((FieldKeyProvider)myKey).myFieldName; - } - else { - String keyStr = key.asString(); - try { - myInsertPoint.myInsertKeyExpression = DecompiledLocalVariable.PARAM_PREFIX + Integer.parseInt(keyStr); - } - catch (NumberFormatException ignored) { - myInsertPoint.myInsertKeyExpression = keyStr; - } - } } @Override diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/StackCapturingLineBreakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/StackCapturingLineBreakpoint.java index 9aaefb73a00b..090f5fb4300a 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/StackCapturingLineBreakpoint.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/StackCapturingLineBreakpoint.java @@ -10,6 +10,7 @@ import com.intellij.debugger.engine.evaluation.expression.EvaluatorBuilderImpl; import com.intellij.debugger.engine.evaluation.expression.ExpressionEvaluator; import com.intellij.debugger.engine.evaluation.expression.ExpressionEvaluatorImpl; import com.intellij.debugger.engine.events.SuspendContextCommandImpl; +import com.intellij.debugger.impl.DebuggerUtilsEx; import com.intellij.debugger.jdi.*; import com.intellij.debugger.memory.utils.StackFrameItem; import com.intellij.debugger.settings.CapturePoint; @@ -24,6 +25,7 @@ import com.intellij.openapi.util.ThrowableComputable; import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiElement; +import com.intellij.rt.debugger.agent.CaptureStorage; import com.intellij.ui.SimpleColoredComponent; import com.intellij.util.containers.ContainerUtil; import com.sun.jdi.*; @@ -143,11 +145,7 @@ public class StackCapturingLineBreakpoint extends WildcardMethodBreakpoint { public static void createAll(DebugProcessImpl debugProcess) { DebuggerManagerThreadImpl.assertIsManagerThread(); - StreamEx points = StreamEx.of(DebuggerSettings.getInstance().getCapturePoints()).filter(c -> c.myEnabled); - if (isAgentEnabled()) { - points = points.append(debugProcess.getAgentInsertPoints()); - } - points.forEach(c -> track(debugProcess, c)); + DebuggerSettings.getInstance().getCapturePoints().stream().filter(c -> c.myEnabled).forEach(c -> track(debugProcess, c)); } public static void clearCaches(DebugProcessImpl debugProcess) { @@ -228,12 +226,29 @@ public class StackCapturingLineBreakpoint extends WildcardMethodBreakpoint { } @Nullable - public static List getRelatedStack(@NotNull StackFrameProxyImpl frame, - @NotNull SuspendContextImpl suspendContext, - boolean checkInProcessData) { + public static List getAgentRelatedStack(JavaStackFrame frame, @NotNull SuspendContextImpl suspendContext) { + if (isAgentEnabled()) { + Location location = frame.getDescriptor().getLocation(); + if (location != null) { + Method method = DebuggerUtilsEx.getMethod(location); + if (method != null && method.name().endsWith(CaptureStorage.GENERATED_INSERT_METHOD_POSTFIX)) { + try { + return getProcessCapturedStack(new EvaluationContextImpl(suspendContext, frame.getStackFrameProxy())); + } + catch (EvaluateException e) { + LOG.error(e); + } + } + } + } + return null; + } + + @Nullable + public static List getRelatedStack(@NotNull StackFrameProxyImpl frame, @NotNull SuspendContextImpl suspendContext) { DebugProcessImpl debugProcess = suspendContext.getDebugProcess(); Map> capturedStacks = debugProcess.getUserData(CAPTURED_STACKS); - if (ContainerUtil.isEmpty(capturedStacks) && !isAgentEnabled()) { + if (ContainerUtil.isEmpty(capturedStacks)) { return null; } List captureBreakpoints = debugProcess.getUserData(CAPTURE_BREAKPOINTS); @@ -250,18 +265,8 @@ public class StackCapturingLineBreakpoint extends WildcardMethodBreakpoint { if ((StringUtil.isEmpty(insertClassName) || StringUtil.equals(insertClassName, className)) && StringUtil.equals(b.myCapturePoint.myInsertMethodName, methodName)) { try { - EvaluationContextImpl evaluationContext = new EvaluationContextImpl(suspendContext, frame); - Value key = b.myInsertEvaluator.evaluate(evaluationContext); - List items = null; - if (key instanceof ObjectReference) { - if (capturedStacks != null) { - items = capturedStacks.get(getKey((ObjectReference)key)); - } - if (items == null && checkInProcessData) { - items = getProcessCapturedStack(key, evaluationContext); - } - } - return items; + Value key = b.myInsertEvaluator.evaluate(new EvaluationContextImpl(suspendContext, frame)); + return key instanceof ObjectReference ? capturedStacks.get(getKey((ObjectReference)key)) : null; } catch (EvaluateException e) { LOG.debug(e); @@ -281,7 +286,7 @@ public class StackCapturingLineBreakpoint extends WildcardMethodBreakpoint { private static final Key> CAPTURE_STORAGE_METHOD = Key.create("CAPTURE_STORAGE_METHOD"); public static final Pair NO_CAPTURE_AGENT = Pair.empty(); - private static List getProcessCapturedStack(Value key, EvaluationContextImpl evalContext) + private static List getProcessCapturedStack(EvaluationContextImpl evalContext) throws EvaluateException { EvaluationContextImpl evaluationContext = evalContext.withAutoLoadClasses(false); @@ -290,13 +295,13 @@ public class StackCapturingLineBreakpoint extends WildcardMethodBreakpoint { if (methodPair == null) { try { - ClassType captureClass = (ClassType)process.findClass(evaluationContext, "com.intellij.rt.debugger.agent.CaptureStorage", null); + ClassType captureClass = (ClassType)process.findClass(evaluationContext, CaptureStorage.class.getName(), null); if (captureClass == null) { methodPair = NO_CAPTURE_AGENT; LOG.debug("Error loading debug agent", "agent class not found"); } else { - methodPair = Pair.create(captureClass, captureClass.methodsByName("getRelatedStack").get(0)); + methodPair = Pair.create(captureClass, captureClass.methodsByName("getCurrentCapturedStack").get(0)); } } catch (EvaluateException e) { @@ -311,7 +316,7 @@ public class StackCapturingLineBreakpoint extends WildcardMethodBreakpoint { } VirtualMachineProxyImpl virtualMachineProxy = process.getVirtualMachineProxy(); - List args = Arrays.asList(key, virtualMachineProxy.mirrorOf(getMaxStackLength())); + List args = Collections.singletonList(virtualMachineProxy.mirrorOf(getMaxStackLength())); Pair finalMethodPair = methodPair; Value resArray = evaluationContext.computeAndKeep( () -> process.invokeMethod(evaluationContext, finalMethodPair.first, finalMethodPair.second,