From a1f0fee7e5f515927ffba7355dc764f5e50c8eec Mon Sep 17 00:00:00 2001 From: Egor Ushakov Date: Fri, 19 Jan 2018 12:41:25 +0300 Subject: [PATCH] capture agent: remember insert points at the porcess start --- .../debugger/engine/DebugProcessImpl.java | 16 +++++++++++++--- .../intellij/debugger/impl/DebuggerSession.java | 4 +++- .../StackCapturingLineBreakpoint.java | 7 ++----- 3 files changed, 18 insertions(+), 9 deletions(-) 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 ed68c1be9e7b..0bd8067cfcfe 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java @@ -1,6 +1,4 @@ -/* - * 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. - */ +// 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.engine; import com.intellij.Patches; @@ -19,6 +17,7 @@ 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; @@ -136,6 +135,8 @@ 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); @@ -2214,4 +2215,13 @@ 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/impl/DebuggerSession.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java index 6f1541792bf6..773332609923 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java @@ -1,4 +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.impl; import com.intellij.debugger.*; @@ -10,6 +10,7 @@ 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,6 +209,7 @@ 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/ui/breakpoints/StackCapturingLineBreakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/StackCapturingLineBreakpoint.java index 1a822b11252c..993841c96e0e 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 @@ -1,6 +1,4 @@ -/* - * 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. - */ +// 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.ui.breakpoints; import com.intellij.debugger.DebuggerBundle; @@ -16,7 +14,6 @@ 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.CaptureSettingsProvider; import com.intellij.debugger.settings.DebuggerSettings; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; @@ -149,7 +146,7 @@ public class StackCapturingLineBreakpoint extends WildcardMethodBreakpoint { DebuggerManagerThreadImpl.assertIsManagerThread(); StreamEx points = StreamEx.of(DebuggerSettings.getInstance().getCapturePoints()).filter(c -> c.myEnabled); if (isAgentEnabled()) { - points = points.append(CaptureSettingsProvider.getIdeInsertPoints()); + points = points.append(debugProcess.getAgentInsertPoints()); } points.forEach(c -> track(debugProcess, c)); }