mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
allow to specify param no
This commit is contained in:
+22
-16
@@ -19,6 +19,7 @@ import com.intellij.debugger.engine.DebugProcessImpl;
|
||||
import com.intellij.debugger.engine.SuspendContextImpl;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.events.SuspendContextCommandImpl;
|
||||
import com.intellij.debugger.jdi.StackFrameProxyImpl;
|
||||
import com.intellij.debugger.memory.utils.StackFrameItem;
|
||||
import com.intellij.debugger.settings.DebuggerSettings;
|
||||
import com.intellij.openapi.util.Key;
|
||||
@@ -39,14 +40,16 @@ import java.util.Map;
|
||||
*/
|
||||
public class StackCapturingLineBreakpoint extends WildcardMethodBreakpoint {
|
||||
private final DebugProcessImpl myDebugProcess;
|
||||
private final int myParamNo;
|
||||
public static final Key<Map<ObjectReference, List<StackFrameItem>>> CAPTURED_STACKS = Key.create("CAPTURED_STACKS");
|
||||
private static final int MAX_STORED_STACKS = 1000;
|
||||
|
||||
private final JavaMethodBreakpointProperties myProperties = new JavaMethodBreakpointProperties();
|
||||
|
||||
public StackCapturingLineBreakpoint(DebugProcessImpl debugProcess, String className, String methodName) {
|
||||
public StackCapturingLineBreakpoint(DebugProcessImpl debugProcess, String className, String methodName, int paramNo) {
|
||||
super(debugProcess.getProject(), null);
|
||||
myDebugProcess = debugProcess;
|
||||
myParamNo = paramNo;
|
||||
myProperties.EMULATED = true;
|
||||
myProperties.WATCH_EXIT = false;
|
||||
myProperties.myClassPattern = className;
|
||||
@@ -69,19 +72,22 @@ public class StackCapturingLineBreakpoint extends WildcardMethodBreakpoint {
|
||||
try {
|
||||
SuspendContextImpl suspendContext = action.getSuspendContext();
|
||||
if (suspendContext != null) {
|
||||
Map<ObjectReference, List<StackFrameItem>> stacks = myDebugProcess.getUserData(CAPTURED_STACKS);
|
||||
if (stacks == null) {
|
||||
stacks = new LinkedHashMap<ObjectReference, List<StackFrameItem>>() {
|
||||
@Override
|
||||
protected boolean removeEldestEntry(Map.Entry eldest) {
|
||||
return size() > MAX_STORED_STACKS;
|
||||
}
|
||||
};
|
||||
myDebugProcess.putUserData(CAPTURED_STACKS, Collections.synchronizedMap(stacks));
|
||||
}
|
||||
Value key = ContainerUtil.getFirstItem(suspendContext.getFrameProxy().getArgumentValues());
|
||||
if (key instanceof ObjectReference) {
|
||||
stacks.put((ObjectReference)key, StackFrameItem.createFrames(suspendContext.getThread()));
|
||||
StackFrameProxyImpl frameProxy = suspendContext.getFrameProxy();
|
||||
if (frameProxy != null) {
|
||||
Map<ObjectReference, List<StackFrameItem>> stacks = myDebugProcess.getUserData(CAPTURED_STACKS);
|
||||
if (stacks == null) {
|
||||
stacks = new LinkedHashMap<ObjectReference, List<StackFrameItem>>() {
|
||||
@Override
|
||||
protected boolean removeEldestEntry(Map.Entry eldest) {
|
||||
return size() > MAX_STORED_STACKS;
|
||||
}
|
||||
};
|
||||
myDebugProcess.putUserData(CAPTURED_STACKS, Collections.synchronizedMap(stacks));
|
||||
}
|
||||
Value key = ContainerUtil.getOrElse(frameProxy.getArgumentValues(), myParamNo, null);
|
||||
if (key instanceof ObjectReference) {
|
||||
stacks.put((ObjectReference)key, StackFrameItem.createFrames(suspendContext.getThread()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,8 +96,8 @@ public class StackCapturingLineBreakpoint extends WildcardMethodBreakpoint {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void track(DebugProcessImpl debugProcess, String classFqn, String methodName) {
|
||||
StackCapturingLineBreakpoint breakpoint = new StackCapturingLineBreakpoint(debugProcess, classFqn, methodName);
|
||||
public static void track(DebugProcessImpl debugProcess, String classFqn, String methodName, int paramNo) {
|
||||
StackCapturingLineBreakpoint breakpoint = new StackCapturingLineBreakpoint(debugProcess, classFqn, methodName, paramNo);
|
||||
breakpoint.createRequest(debugProcess);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user