in src/main/java/com/intellij/rt/debugger/agent/CaptureStorage.java [167:194]
public static Object coroutineOwner(final Object key) {
if (!ENABLED) {
return key;
}
return withoutThrowableCapture(new Callable<Object>() {
@Override
public Object call() {
try {
Method getCallerFrameMethod = getGetCallerFrameMethod(key);
Object res = key;
while (true) {
//TODO: slow implementation for now, need to put the code directly into the insert point
Object caller = getCallerFrameMethod.invoke(res);
if (caller == null) {
return res;
}
if ("kotlinx.coroutines.debug.internal.DebugProbesImpl$CoroutineOwner".equals(caller.getClass().getName())) {
return caller;
}
res = caller;
}
} catch (Exception e) {
handleException(e);
}
return key;
}
});
}