public override Task <ReadInstructionInfosResponse> ReadInstructionInfos(
            ReadInstructionInfosRequest request, ServerCallContext context)
        {
            RemoteTarget           target       = GrpcLookupUtils.GetTarget(request.Target, _targetStore);
            SbAddress              address      = _addressStore.GetObject(request.Address.Id);
            var                    response     = new ReadInstructionInfosResponse();
            List <InstructionInfo> instructions =
                target.ReadInstructionInfos(address, request.Count, request.Flavor);

            if (instructions != null)
            {
                foreach (InstructionInfo instruction in instructions)
                {
                    var instructionInfo = new GrpcInstructionInfo {
                        Address    = instruction.Address, Operands = instruction.Operands ?? "",
                        Comment    = instruction.Comment ?? "", Mnemonic = instruction.Mnemonic ?? "",
                        SymbolName = instruction.SymbolName ?? ""
                    };
                    if (instruction.LineEntry != null)
                    {
                        instructionInfo.LineEntry = new GrpcLineEntryInfo {
                            FileName  = instruction.LineEntry.FileName ?? "",
                            Directory = instruction.LineEntry.Directory ?? "",
                            Line      = instruction.LineEntry.Line, Column = instruction.LineEntry.Column
                        };
                    }
                    response.Instructions.Add(instructionInfo);
                }
            }
            return(Task.FromResult(response));
        }
Esempio n. 2
0
        public List <InstructionInfo> ReadInstructionInfos(SbAddress address,
                                                           uint count, string flavor)
        {
            ReadInstructionInfosResponse response = null;

            if (connection.InvokeRpc(() =>
            {
                response = client.ReadInstructionInfos(
                    new ReadInstructionInfosRequest
                {
                    Target = grpcSbTarget,
                    Address = new GrpcSbAddress {
                        Id = address.GetId()
                    },
                    Count = count,
                    Flavor = flavor,
                });
            }))
            {
                var instructions = new List <InstructionInfo>();
                foreach (var instruction in response.Instructions)
                {
                    instructions.Add(new InstructionInfo(
                                         instruction.Address,
                                         instruction.Operands,
                                         instruction.Comment,
                                         instruction.Mnemonic,
                                         instruction.SymbolName,
                                         FrameInfoUtils.CreateLineEntryInfo(instruction.LineEntry)));
                }
                return(instructions);
            }
            return(new List <InstructionInfo>());
        }