public override Task <LoadCoreResponse> LoadCore(LoadCoreRequest request,
                                                         ServerCallContext context)
        {
            RemoteTarget target   = GrpcLookupUtils.GetTarget(request.Target, _targetStore);
            SbProcess    process  = target.LoadCore(request.CorePath);
            var          response = new LoadCoreResponse();

            if (process != null)
            {
                if (!_processStore.TryAdd(process.GetUniqueId(), process))
                {
                    ErrorUtils.ThrowError(StatusCode.Internal, "Could not add process to store: " +
                                          process.GetUniqueId());
                }
                response.Process = new GrpcSbProcess {
                    Id = process.GetUniqueId()
                };
            }
            return(Task.FromResult(response));
        }
        public override Task <AttachToProcessWithIDResponse> AttachToProcessWithID(
            AttachToProcessWithIDRequest request, ServerCallContext context)
        {
            if (!_targetStore.TryGetValue(request.Target.Id, out RemoteTarget target))
            {
                ErrorUtils.ThrowError(StatusCode.Internal,
                                      "Could not find target in store: " + request.Target.Id);
            }

            if (!_listenerStore.TryGetValue(request.Listener.Id, out SbListener listener))
            {
                ErrorUtils.ThrowError(StatusCode.Internal,
                                      "Could not find listener in store: " + request.Listener.Id);
            }

            SbProcess process =
                target.AttachToProcessWithID(listener, request.Pid, out SbError error);

            var response =
                new AttachToProcessWithIDResponse {
                Error = new GrpcSbError {
                    Success = error.Success(),
                    Error   = error.GetCString(),
                }
            };

            if (process != null)
            {
                if (!_processStore.TryAdd(process.GetUniqueId(), process))
                {
                    ErrorUtils.ThrowError(StatusCode.Internal, "Could not add process to store: " +
                                          process.GetUniqueId());
                }
                response.Process = new GrpcSbProcess {
                    Id = process.GetUniqueId()
                };
            }
            return(Task.FromResult(response));
        }