/// <summary>
        /// Create a new LLDB SBTarget locally, and return a GrpcSbTarget object to the client.
        /// Locally we then map GrpcSbTarget objects to RemoteTarget objects.
        /// </summary>
        public override Task <CreateTargetResponse> CreateTarget(CreateTargetRequest request,
                                                                 ServerCallContext context)
        {
            SbDebuggerPreconditionCheck();
            SbTarget sbTarget = sbDebugger.CreateTarget(request.Filename);

            if (sbTarget == null)
            {
                ErrorUtils.ThrowError(StatusCode.Internal, "Could not create SBTarget.");
            }
            if (!targetStore.TryAdd(sbTarget.GetId(), remoteTargetFactory.Create(sbTarget)))
            {
                ErrorUtils.ThrowError(
                    StatusCode.Internal, "Could not add target to store: " + sbTarget.GetId());
            }
            var grpcSbTarget = new GrpcSbTarget {
                Id = sbTarget.GetId()
            };
            var response = new CreateTargetResponse {
                GrpcSbTarget = grpcSbTarget
            };

            return(Task.FromResult(response));
        }
예제 #2
0
 public long GetId() => _sbTarget.GetId();