示例#1
0
        public BreakpointErrorPair CreateFunctionOffsetBreakpoint(string symbolName, uint offset)
        {
            var request = new CreateFunctionOffsetBreakpointRequest()
            {
                Target     = grpcSbTarget,
                SymbolName = symbolName,
                Offset     = offset
            };
            CreateFunctionOffsetBreakpointResponse response = null;

            if (connection.InvokeRpc(() =>
            {
                response = client.CreateFunctionOffsetBreakpoint(request);
            }))
            {
                if (response.Breakpoint != null && response.Breakpoint.Id != 0)
                {
                    return(new BreakpointErrorPair(
                               breakpointFactory.Create(connection, response.Breakpoint),
                               EnumUtil.ConvertTo <DebuggerApi.BreakpointError>(response.Error)));
                }
            }
            return(new BreakpointErrorPair(null,
                                           EnumUtil.ConvertTo <DebuggerApi.BreakpointError>(response.Error)));
        }
        public override Task <CreateFunctionOffsetBreakpointResponse> CreateFunctionOffsetBreakpoint(
            CreateFunctionOffsetBreakpointRequest 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);
            }

            var response = new CreateFunctionOffsetBreakpointResponse();
            BreakpointErrorPair breakpointErrorPair =
                target.CreateFunctionOffsetBreakpoint(request.SymbolName, request.Offset);

            if (breakpointErrorPair.breakpoint != null)
            {
                response.Breakpoint = new GrpcSbBreakpoint {
                    Target = request.Target,
                    Id     = breakpointErrorPair.breakpoint.GetId(),
                };
            }
            response.Error = (Debugger.Common.BreakpointError)breakpointErrorPair.error;
            return(Task.FromResult(response));
        }