5
5
* You may obtain a copy of the License at
6
6
*
7
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.
8
14
*/
9
15
10
16
#ifndef JERRY_DEBUGGER_H
11
17
#define JERRY_DEBUGGER_H
12
18
13
- #include "jmem-allocator.h"
14
- #include <stdint.h>
15
-
16
19
#define MAX_BUFFER_SIZE 128
17
20
18
- static uint8_t jerry_debugger_buffer [MAX_MESSAGE_SIZE ];
21
+ static uint8_t jerry_debugger_buffer [MAX_BUFFER_SIZE ];
19
22
20
23
extern bool jerry_debugger_socket_init (void );
21
24
extern void jerry_debugger_connection_end (void );
22
25
extern bool jerry_debugger_send (size_t data_len );
23
26
24
- /**
25
- * Limited resources available for the engine, so it is important to
26
- * check the maximum buffer size. It need to be between 64 and 256.
27
- */
28
- #if MAX_BUFFER_SIZE < 64 || MAX_BUFFER_SIZE > 256
29
- #error "Please define the MAX_BUFFER_SIZE between 64 and 256."
30
- #endif /* MAX_BUFFER_SIZE < 64 || MAX_BUFFER_SIZE > 256 */
31
-
32
- /**
33
- * Calculate how many soruce file name, function name and breakpoint
34
- * can send in one buffer without overflow.
35
- */
36
- #define JERRY_DEBUGGER_MAX_SIZE (type ) \
37
- ((MAX_BUFFER_SIZE - sizeof (jerry_debugger_message_header_t)) / sizeof (type))
38
-
39
- /**
40
- * Types for the package
41
- *
42
- * This helps the debugger to decide what type of the data come
43
- * from the JerryScript. If the buffer size is not enough for
44
- * the message the engine split it up into many pieces. The header
45
- * of the last piece has a type with an '_END' postfix.
46
- */
47
- typedef enum
48
- {
49
- JERRY_DEBUGGER_BREAKPOINT_LIST , /**< there is more piece of the breakpoint list */
50
- JERRY_DEBUGGER_BREAKPOINT_LIST_END , /**< the last piece of the breakpoint list
51
- * or when one buffer send is enough for the engine */
52
- JERRY_DEBUGGER_FUNCTION_NAME , /**< there is more piece of the function name */
53
- JERRY_DEBUGGER_FUNCTION_NAME_END , /**< the last piece of the function name
54
- * or when one buffer send is enough for the engine */
55
- JERRY_DEBUGGER_SOURCE_FILE_NAME , /**< there is more piece of the source file name */
56
- JERRY_DEBUGGER_SOURCE_FILE_NAME_END , /**< if we send the last piece of the source file name
57
- * or when one buffer send is enough for the engine */
58
- JERRY_DEBUGGER_UNIQUE_START_BYTE_CODE_CPTR , /**< byte code starter compressed pointer */
59
- } jerry_debugger_header_type_t ;
60
-
61
- /**
62
- * Package header
63
- */
64
- typedef struct
65
- {
66
- jerry_debugger_header_type_t type ; /**< type of the message */
67
- uint8_t size ; /**< size of the message */
68
- } jerry_debugger_message_header_t ;
69
-
70
- /**
71
- * Source file name
72
- */
73
- typedef struct
74
- {
75
- jerry_debugger_message_header_t header ; /**< header of the message */
76
- char file_name [JERRY_DEBUGGER_MAX_SIZE (char )]; /**< JavaScript source file name */
77
- } jerry_debugger_message_source_name_t ;
78
-
79
- /**
80
- * Function name
81
- */
82
- typedef struct
83
- {
84
- jerry_debugger_message_header_t header ; /**< header of the function name struct */
85
- char function_name [JERRY_DEBUGGER_MAX_SIZE (char )]; /**< the message which contains the function name */
86
- } jerry_debugger_message_function_name_t ;
87
-
88
- /**
89
- * Byte code compressed pointer
90
- */
91
- typedef struct
92
- {
93
- jerry_debugger_message_header_t header ; /**< header of the struct */
94
- jmem_cpointer_t byte_code_cp ; /**< the byte code compressed pointer */
95
- } jerry_debugger_byte_code_cptr_t ;
96
-
97
- /**
98
- * Breakpoint pairs
99
- */
100
- typedef struct
101
- {
102
- uint32_t offset ; /**< breakpoint line offset */
103
- uint32_t line ; /**< breakpoint line index */
104
- } jerry_debugger_bp_pairs_t ;
105
-
106
- /**
107
- * Breakpoint list
108
- */
109
- typedef struct
110
- {
111
- jerry_debugger_message_header_t header ; /**< header of the struct */
112
- /** array of the breakpoint pairs */
113
- jerry_debugger_bp_pairs_t breakpoint_pairs [JERRY_DEBUGGER_MAX_SIZE (jerry_debugger_bp_pairs_t )];
114
- } jerry_debugger_breakpoint_list_t ;
115
-
116
- #endif /* JERRY_DEBUGGER_H */
27
+ #endif /* JERRY_DEBUGGER_H */
0 commit comments