blob: ab2823cc460417fc50ffa1ea078d779c653035e1 [file] [log] [blame]
Googler29eafdf2018-05-23 12:32:07 -07001// Copyright 2018 The Bazel Authors. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package com.google.devtools.build.lib.syntax;
16
Googler5e893622018-06-07 14:07:17 -070017import java.util.function.Function;
18
Googler29eafdf2018-05-23 12:32:07 -070019/** A debug server interface, called from core skylark code. */
20public interface DebugServer {
21
22 /**
brendandouglas6dfafd22018-06-08 15:50:25 -070023 * Shuts down the debug server, closing any open sockets, etc. This can be safely called multiple
24 * times.
25 */
Googler5e893622018-06-07 14:07:17 -070026 void close();
27
28 /**
29 * Returns a custom {@link Eval} supplier used to intercept statement execution to check for
30 * breakpoints.
31 */
32 Function<Environment, Eval> evalOverride();
33
Googler29eafdf2018-05-23 12:32:07 -070034 /** Represents an invocation that will be tracked as a thread by the Skylark debug server. */
35 interface DebugCallable<T> {
36
37 /**
38 * The invocation that will be tracked.
39 *
40 * @return the result
41 */
42 T call() throws EvalException, InterruptedException;
43 }
44}