[debugger] Fix reattach case when using breakpoint instrumentation

IDEA-370744

GitOrigin-RevId: 9eb09b3d48244e4c34fe6b28850b4f0cd2ed86f3
This commit is contained in:
Alexey.Merkulov
2026-02-16 19:06:26 +00:00
committed by intellij-monorepo-bot
parent ff1952e7e0
commit 244465a9e8
2 changed files with 9 additions and 5 deletions
@@ -62,6 +62,7 @@ import com.sun.jdi.ClassType;
import com.sun.jdi.IncompatibleThreadStateException;
import com.sun.jdi.InternalException;
import com.sun.jdi.Location;
import com.sun.jdi.Method;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.ThreadReference;
import com.sun.jdi.VMDisconnectedException;
@@ -692,13 +693,14 @@ public class DebugProcessEvents extends DebugProcessImpl {
final LocatableEventRequestor requestor = (LocatableEventRequestor)RequestManagerImpl.findRequestor(event.request());
if (myIsUnderBreakpointCheckFn != null && shouldCheckForSkipBreakpoint(event)) {
Method isUnderBreakpointCheckFn = myIsUnderBreakpointCheckFnMap.get(suspendContext.getVirtualMachineProxy());
if (isUnderBreakpointCheckFn != null && shouldCheckForSkipBreakpoint(event)) {
EvaluationContextImpl evaluationContext = new EvaluationContextImpl(suspendContext, null);
try {
Value value = invokeMethod(
evaluationContext,
(ClassType)myIsUnderBreakpointCheckFn.declaringType(),
myIsUnderBreakpointCheckFn,
(ClassType)isUnderBreakpointCheckFn.declaringType(),
isUnderBreakpointCheckFn,
Collections.emptyList()
);
if (value instanceof BooleanValue booleanValue) {
@@ -103,6 +103,7 @@ import com.intellij.util.EventDispatcher;
import com.intellij.util.ObjectUtils;
import com.intellij.util.concurrency.EdtScheduler;
import com.intellij.util.concurrency.Semaphore;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.DisposableWrapperList;
import com.intellij.util.lang.JavaVersion;
@@ -213,7 +214,8 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb
private final List<ProcessListener> myProcessListeners = ContainerUtil.createLockFreeCopyOnWriteList();
private final StringBuilder myTextBeforeStart = new StringBuilder();
protected @Nullable Method myIsUnderBreakpointCheckFn;
protected Map<VirtualMachineProxyImpl, Method> myIsUnderBreakpointCheckFnMap = CollectionFactory.createWeakMap();
protected enum State {INITIAL, ATTACHED, DETACHING, DETACHED}
@@ -3098,7 +3100,7 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb
@ApiStatus.Internal
public void setIsUnderBreakpointCheckFn(@NotNull Method isUnderBreakpointCheckFn) {
this.myIsUnderBreakpointCheckFn = isUnderBreakpointCheckFn;
myIsUnderBreakpointCheckFnMap.put(VirtualMachineProxyImpl.getCurrent(), isUnderBreakpointCheckFn);
}
@ApiStatus.Internal