Beispiel #1
0
        public ulong ReadMemory(ulong address, byte[] memory, ulong size, out SbError error)
        {
            ReadMemoryResponse response = null;

            if (connection.InvokeRpc(() =>
            {
                response = client.ReadMemory(
                    new ReadMemoryRequest
                {
                    Process = grpcSbProcess,
                    Address = address,
                    Size = size
                });
            }))
            {
                error = errorFactory.Create(response.Error);
                var responseArray = response.Memory.ToByteArray();
                int startingIndex = 0;
                if (responseArray.Length > memory.Length)
                {
                    Trace.WriteLine("Error: buffer is not large enough for the output.");
                    startingIndex = responseArray.Length - memory.Length;
                }
                response.Memory.ToByteArray().CopyTo(memory, startingIndex);
                return(response.Size);
            }
            var grpcError = new GrpcSbError
            {
                Success = false,
                Error   = "Rpc error while calling ReadMemory."
            };

            error = errorFactory.Create(grpcError);
            return(0);
        }
        public SbError ConnectRemote(SbPlatformConnectOptions connectOptions)
        {
            var grpcSbPlatformConnectOptions = new GrpcSbPlatformConnectOptions
            {
                Url = connectOptions.GetUrl()
            };
            var request = new ConnectRemoteRequest
            {
                ConnectOptions = grpcSbPlatformConnectOptions
            };
            ConnectRemoteResponse response = null;

            if (connection.InvokeRpc(() =>
            {
                response = client.ConnectRemote(request);
            }))
            {
                return(sbErrorFactory.Create(response.Error));
            }
            var grpcSbError = new GrpcSbError
            {
                Success = false,
                Error   = "Rpc error while calling ConnectRemote.  Inspect the logs for more " +
                          "information."
            };

            return(sbErrorFactory.Create(grpcSbError));
        }
Beispiel #3
0
        public SbError JumpToLine(string filePath, uint line)
        {
            JumpToLineResponse response = null;

            if (connection.InvokeRpc(() =>
            {
                response = client.JumpToLine(new JumpToLineRequest
                {
                    Thread = grpcSbThread,
                    FilePath = filePath,
                    Line = line,
                });
            }))
            {
                if (response.Error != null)
                {
                    return(errorFactory.Create(response.Error));
                }
            }
            return(errorFactory.Create(new GrpcSbError
            {
                Success = false,
                Error = "Rpc error while calling JumpToLine()."
            }));
        }
Beispiel #4
0
        public SbProcess AttachToProcessWithID(SbListener listener, ulong pid, out SbError error)
        {
            var request = new AttachToProcessWithIDRequest()
            {
                Target   = grpcSbTarget,
                Listener = new GrpcSbListener()
                {
                    Id = listener.GetId()
                },
                Pid = pid,
            };
            AttachToProcessWithIDResponse response = null;

            if (connection.InvokeRpc(() =>
            {
                response = client.AttachToProcessWithID(request);
            }))
            {
                error = errorFactory.Create(response.Error);
                if (response.Process == null)
                {
                    return(null);
                }
                return(processFactory.Create(connection, response.Process));
            }
            var grpcError = new GrpcSbError
            {
                Success = false,
                Error   = "Rpc error while calling AttachToProcessWithId."
            };

            error = errorFactory.Create(grpcError);
            return(null);
        }
Beispiel #5
0
 public SbError GetError()
 {
     return(errorFactory.Create(grpcSbValue.Error));
 }