capture agent: remember insert points at the porcess start

This commit is contained in:
Egor Ushakov
2018-01-19 12:53:34 +03:00
parent 6c13416fea
commit a1f0fee7e5
3 changed files with 18 additions and 9 deletions
@@ -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<CapturePoint> 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<CapturePoint> getAgentInsertPoints() {
return myAgentInsertPoints;
}
public void setAgentInsertPoints(@NotNull List<CapturePoint> agentInsertPoints) {
myAgentInsertPoints = agentInsertPoints;
}
}
@@ -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();
@@ -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<CapturePoint> 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));
}