Exemple #1
0
 public RemoteTargetProxy(GrpcConnection connection, GrpcSbTarget grpcSbTarget) : this(
         connection, grpcSbTarget,
         new RemoteTargetRpcService.RemoteTargetRpcServiceClient(connection.CallInvoker),
         new GrpcBreakpointFactory(), new GrpcErrorFactory(), new GrpcProcessFactory(),
         new GrpcModuleFactory(), new GrpcWatchpointFactory(), new GrpcAddressFactory())
 {
 }
        internal static RemoteTarget GetTarget(GrpcSbTarget grpcSbTarget,
                                               ConcurrentDictionary <long, RemoteTarget> targetStore)
        {
            RemoteTarget remoteTarget = null;

            if (!targetStore.TryGetValue(grpcSbTarget.Id, out remoteTarget))
            {
                ErrorUtils.ThrowError(StatusCode.Internal, "Could not find target by ID: "
                                      + grpcSbTarget.Id);
            }
            return(remoteTarget);
        }
        public override Task <GetTargetResponse> GetTarget(GetTargetRequest request,
                                                           ServerCallContext context)
        {
            SbProcess sbProcess    = GrpcLookupUtils.GetProcess(request.Process, processStore);
            var       target       = sbProcess.GetTarget();
            var       grpcSbThread = new GrpcSbTarget
            {
                Id = target.GetId()
            };

            return(Task.FromResult(new GetTargetResponse {
                Target = grpcSbThread
            }));
        }
Exemple #4
0
 public RemoteTargetProxy(GrpcConnection connection, GrpcSbTarget grpcSbTarget,
                          RemoteTargetRpcService.RemoteTargetRpcServiceClient client,
                          GrpcBreakpointFactory breakpointFactory, GrpcErrorFactory errorFactory,
                          GrpcProcessFactory processFactory, GrpcModuleFactory moduleFactory,
                          GrpcWatchpointFactory watchpointFactory, GrpcAddressFactory addressFactory)
 {
     this.connection        = connection;
     this.grpcSbTarget      = grpcSbTarget;
     this.client            = client;
     this.breakpointFactory = breakpointFactory;
     this.errorFactory      = errorFactory;
     this.processFactory    = processFactory;
     this.moduleFactory     = moduleFactory;
     this.watchpointFactory = watchpointFactory;
     this.addressFactory    = addressFactory;
 }
        /// <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));
        }
Exemple #6
0
 public virtual RemoteTarget Create(GrpcConnection connection, GrpcSbTarget grpcSbTarget)
 {
     return(new RemoteTargetProxy(connection, grpcSbTarget));
 }