[debugger] Exclude technical threads from debugger model check

EA-1315500 EA-1329448

GitOrigin-RevId: 708894508fc5c3c967e1fc049462b11d8d963122
This commit is contained in:
Alexey Merkulov
2024-07-11 12:38:05 +02:00
committed by intellij-monorepo-bot
parent d13b703502
commit 94e3c00eaa
3 changed files with 21 additions and 2 deletions

View File

@@ -61,6 +61,9 @@ object DebuggerDiagnosticsUtil {
val problems = mutableListOf<String>()
for (threadProxy in allThreads) {
if (threadProxy.isIgnoreModelSuspendCount) {
continue
}
val suspendingContexts = SuspendManagerUtil.getSuspendingContexts(suspendManager, threadProxy)
val resumedByWatching = if (invocationWatching != null && suspendingContexts.contains(invocationWatching.mySuspendAllContext)) 1
else 0

View File

@@ -98,7 +98,10 @@ class ReloadClassesWorker {
virtualMachineProxy.allThreads().stream()
.filter(ThreadReferenceProxyImpl::isResumeOnHotSwap)
.filter(ThreadReferenceProxyImpl::isSuspended)
.forEach(t -> IntStream.range(0, t.getSuspendCount()).forEach(i -> t.resume()));
.forEach(t -> IntStream.range(0, t.getSuspendCount()).forEach(i -> {
t.setIgnoreModelSuspendCount(true);
t.resume();
}));
}
try {

View File

@@ -48,7 +48,10 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp
private volatile boolean myIsEvaluating = false;
// This counter can go negative value if the engine stops the whole JVM, but resumed this particular thread
public int myModelSuspendCount = 0;
private int myModelSuspendCount = 0;
// This counter can go negative value if the engine stops the whole JVM, but resumed this particular thread
private boolean myIsIgnoreModelSuspendCount = false;
public static final Comparator<ThreadReferenceProxyImpl> ourComparator = (th1, th2) -> {
int res = Boolean.compare(th2.isSuspended(), th1.isSuspended());
@@ -508,6 +511,16 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp
}
}
@ApiStatus.Internal
public boolean isIgnoreModelSuspendCount() {
return myIsIgnoreModelSuspendCount;
}
@ApiStatus.Internal
public void setIgnoreModelSuspendCount(boolean ignoreModelSuspendCount) {
myIsIgnoreModelSuspendCount = ignoreModelSuspendCount;
}
public interface ThreadListener extends EventListener{
default void threadSuspended() {
}