Googler | 29eafdf | 2018-05-23 12:32:07 -0700 | [diff] [blame] | 1 | // 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 | |
| 15 | package com.google.devtools.build.lib.syntax; |
| 16 | |
Googler | 5e89362 | 2018-06-07 14:07:17 -0700 | [diff] [blame] | 17 | import java.util.function.Function; |
| 18 | |
Googler | 29eafdf | 2018-05-23 12:32:07 -0700 | [diff] [blame] | 19 | /** A debug server interface, called from core skylark code. */ |
| 20 | public interface DebugServer { |
| 21 | |
| 22 | /** |
brendandouglas | 6dfafd2 | 2018-06-08 15:50:25 -0700 | [diff] [blame] | 23 | * Shuts down the debug server, closing any open sockets, etc. This can be safely called multiple |
| 24 | * times. |
| 25 | */ |
Googler | 5e89362 | 2018-06-07 14:07:17 -0700 | [diff] [blame] | 26 | 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 | |
Googler | 29eafdf | 2018-05-23 12:32:07 -0700 | [diff] [blame] | 34 | /** 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 | } |