private void collectAndRegisterOtherDebuggersThreads(List<PyThreadInfo> threads) {
   for (RemoteDebugger d : getOtherDebuggers()) {
     threads.addAll(d.getThreads());
     for (PyThreadInfo t : d.getThreads()) {
       myThreadRegistry.register(t.getId(), d);
     }
   }
 }
 @NotNull
 private ProcessDebugger debugger(@NotNull String threadId) {
   ProcessDebugger debugger = myThreadRegistry.getDebugger(threadId);
   if (debugger != null) {
     return debugger;
   } else {
     return myMainDebugger;
   }
 }
 private static List<PyThreadInfo> addProcessIdToThreadName(
     List<PyThreadInfo> threads, List<PyThreadInfo> result) {
   for (PyThreadInfo t : threads) {
     String threadName = ThreadRegistry.threadName(t.getName(), t.getId());
     PyThreadInfo newThread =
         new PyThreadInfo(t.getId(), threadName, t.getFrames(), t.getStopReason(), t.getMessage());
     newThread.updateState(t.getState(), t.getFrames());
     result.add(newThread);
   }
   threads = result;
   return threads;
 }
  private List<PyThreadInfo> collectAllThreads() {
    List<PyThreadInfo> result = Lists.newArrayList();

    result.addAll(myMainDebugger.getThreads());

    // collect threads and add them to registry to faster access
    // we don't register mainDebugger as it is default if there is no mapping
    for (RemoteDebugger d : myOtherDebuggers) {
      result.addAll(d.getThreads());
      for (PyThreadInfo t : d.getThreads()) {
        myThreadRegistry.register(t.getId(), d);
      }
    }

    return result;
  }
  @NotNull
  private ProcessDebugger debugger(@NotNull String threadId) {
    ProcessDebugger debugger = myThreadRegistry.getDebugger(threadId);
    if (debugger != null) {
      return debugger;
    } else {
      // thread is not found in registry - lets search for it in attached debuggers

      for (ProcessDebugger d : myOtherDebuggers) {
        for (PyThreadInfo thread : d.getThreads()) {
          if (threadId.equals(thread.getId())) {
            return d;
          }
        }
      }

      // if not found then return main debugger
      return myMainDebugger;
    }
  }