1 | /* Copyright JS Foundation and other contributors, http://js.foundation |
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 | |
16 | #ifndef JERRYSCRIPT_DEBUGGER_H |
17 | #define JERRYSCRIPT_DEBUGGER_H |
18 | |
19 | #include "jerryscript-core.h" |
20 | #include "jerryscript-port.h" |
21 | |
22 | #ifdef __cplusplus |
23 | extern "C" |
24 | { |
25 | #endif /* __cplusplus */ |
26 | |
27 | /** \addtogroup jerry-debugger Jerry engine interface - Debugger feature |
28 | * @{ |
29 | */ |
30 | |
31 | /** |
32 | * JerryScript debugger protocol version. |
33 | */ |
34 | #define JERRY_DEBUGGER_VERSION (9) |
35 | |
36 | /** |
37 | * Types for the client source wait and run method. |
38 | */ |
39 | typedef enum |
40 | { |
41 | JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED = 0, /**< source is not received */ |
42 | JERRY_DEBUGGER_SOURCE_RECEIVED = 1, /**< a source has been received */ |
43 | JERRY_DEBUGGER_SOURCE_END = 2, /**< the end of the sources signal received */ |
44 | JERRY_DEBUGGER_CONTEXT_RESET_RECEIVED, /**< the context reset request has been received */ |
45 | } jerry_debugger_wait_for_source_status_t; |
46 | |
47 | /** |
48 | * Callback for jerry_debugger_wait_and_run_client_source |
49 | * |
50 | * The callback receives the resource name, source code and a user pointer. |
51 | * |
52 | * @return this value is passed back by jerry_debugger_wait_and_run_client_source |
53 | */ |
54 | typedef jerry_value_t (*jerry_debugger_wait_for_source_callback_t) (const jerry_char_t *resource_name_p, |
55 | size_t resource_name_size, |
56 | const jerry_char_t *source_p, |
57 | size_t source_size, void *user_p); |
58 | |
59 | /** |
60 | * Engine debugger functions. |
61 | */ |
62 | bool jerry_debugger_is_connected (void); |
63 | void jerry_debugger_stop (void); |
64 | void jerry_debugger_continue (void); |
65 | void jerry_debugger_stop_at_breakpoint (bool enable_stop_at_breakpoint); |
66 | jerry_debugger_wait_for_source_status_t |
67 | jerry_debugger_wait_for_client_source (jerry_debugger_wait_for_source_callback_t callback_p, |
68 | void *user_p, jerry_value_t *return_value); |
69 | void jerry_debugger_send_output (const jerry_char_t *buffer, jerry_size_t str_size); |
70 | void jerry_debugger_send_log (jerry_log_level_t level, const jerry_char_t *buffer, jerry_size_t str_size); |
71 | |
72 | /** |
73 | * @} |
74 | */ |
75 | |
76 | #ifdef __cplusplus |
77 | } |
78 | #endif /* __cplusplus */ |
79 | #endif /* !JERRYSCRIPT_DEBUGGER_H */ |
80 | |