Introduce generic backtrace capturing (#4555)
Remove jerry_get_backtrace_from function JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
+422
-144
@@ -245,6 +245,15 @@ memory blocks but the performance may drop after the garbage collection.
|
||||
|
||||
*New in version 2.0*.
|
||||
|
||||
## jerry_backtrace_frame_types_t
|
||||
|
||||
List of backtrace frame types returned by
|
||||
[jerry_backtrace_get_frame_type](#jerry_backtrace_get_frame_type).
|
||||
|
||||
- JERRY_BACKTRACE_FRAME_JS - indicates that the frame is created for a JavaScript function/method
|
||||
|
||||
*New in version [[NEXT_RELEASE]]*.
|
||||
|
||||
## jerry_generate_snapshot_opts_t
|
||||
|
||||
Flags for [jerry_generate_snapshot](#jerry_generate_snapshot) and
|
||||
@@ -524,6 +533,50 @@ typedef struct
|
||||
|
||||
- [jerry_define_own_property](#jerry_define_own_property)
|
||||
|
||||
## jerry_backtrace_location_t
|
||||
|
||||
**Summary**
|
||||
|
||||
Source code location data retreived by
|
||||
[jerry_backtrace_get_location](#jerry_backtrace_get_location).
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
typedef struct
|
||||
{
|
||||
jerry_value_t resource_name; /**< resource name */
|
||||
jerry_size_t line; /**< line index */
|
||||
jerry_size_t column; /**< column index */
|
||||
} jerry_backtrace_location_t;
|
||||
```
|
||||
|
||||
*New in version [[NEXT_RELEASE]]*.
|
||||
|
||||
## jerry_backtrace_frame_t
|
||||
|
||||
**Summary**
|
||||
|
||||
Backtrace frame data passed to the [jerry_backtrace_callback_t](#jerry_backtrace_callback_t)
|
||||
handler. This is an internal data structure which fields can be accessed by helper functions
|
||||
such as [jerry_backtrace_get_location](#jerry_backtrace_get_location).
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
/**
|
||||
* Internal data structure for jerry_backtrace_frame_t definition.
|
||||
*/
|
||||
struct jerry_backtrace_frame_internal_t;
|
||||
|
||||
/**
|
||||
* Backtrace frame data passed to the jerry_backtrace_callback_t handler.
|
||||
*/
|
||||
typedef struct jerry_backtrace_frame_internal_t jerry_backtrace_frame_t;
|
||||
```
|
||||
|
||||
*New in version [[NEXT_RELEASE]]*.
|
||||
|
||||
## jerry_heap_stats_t
|
||||
|
||||
**Summary**
|
||||
@@ -627,6 +680,32 @@ typedef void (*jerry_error_object_created_callback_t) (const jerry_value_t error
|
||||
|
||||
- [jerry_set_error_object_created_callback](#jerry_set_error_object_created_callback)
|
||||
|
||||
## jerry_backtrace_callback_t
|
||||
|
||||
**Summary**
|
||||
|
||||
Callback function which is called by [jerry_backtrace_capture](#jerry_backtrace_capture)
|
||||
for each stack frame.
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
typedef bool (*jerry_backtrace_callback_t) (jerry_backtrace_frame_t *frame_p, void *user_p);
|
||||
```
|
||||
|
||||
- `frame_p` - pointer to [jerry_backtrace_frame_t](#jerry_backtrace_frame_t) data.
|
||||
- `user_p` - pointer passed to [jerry_backtrace_capture](#jerry_backtrace_capture).
|
||||
- return value
|
||||
- true, to continue capturing more frames
|
||||
- false, to end the stack capturing
|
||||
|
||||
*New in version [[NEXT_RELEASE]]*.
|
||||
|
||||
**See also**
|
||||
|
||||
- [jerry_backtrace_capture](#jerry_backtrace_capture)
|
||||
- [jerry_backtrace_frame_t](#jerry_backtrace_frame_t)
|
||||
|
||||
## jerry_object_native_info_t
|
||||
|
||||
**Summary**
|
||||
@@ -8931,90 +9010,7 @@ main (void)
|
||||
- [jerry_register_magic_strings](#jerry_register_magic_strings)
|
||||
|
||||
|
||||
# Miscellaneous functions
|
||||
|
||||
## jerry_set_vm_exec_stop_callback
|
||||
|
||||
**Summary**
|
||||
|
||||
When JERRY_FEATURE_VM_EXEC_STOP is enabled a callback function can be
|
||||
specified by this function. This callback is periodically called when
|
||||
JerryScript executes an ECMAScript program.
|
||||
|
||||
If the callback returns with undefined value the ECMAScript execution
|
||||
continues. Otherwise the result is thrown by the engine (if the error
|
||||
flag is not set for the returned value the engine automatically sets
|
||||
it). The callback function might be called again even if it threw
|
||||
an error. In this case the function must throw the same error again.
|
||||
|
||||
To reduce the CPU overhead of constantly checking the termination
|
||||
condition the callback is called when a backward jump is executed
|
||||
or an exception is caught. Setting the `frequency` to a greater
|
||||
than `1` value reduces this overhead further. If its value is N
|
||||
only every Nth event (backward jump, etc.) trigger the next check.
|
||||
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
void
|
||||
jerry_set_vm_exec_stop_callback (jerry_vm_exec_stop_callback_t stop_cb,
|
||||
void *user_p,
|
||||
uint32_t frequency);
|
||||
```
|
||||
|
||||
- `stop_cb` - periodically called callback (passing NULL disables this feature)
|
||||
- `user_p` - user pointer passed to the `stop_cb` function
|
||||
- `frequency` - frequency of calling the `stop_cb` function
|
||||
|
||||
*New in version 2.0*.
|
||||
|
||||
**Example**
|
||||
|
||||
[doctest]: # (test="link")
|
||||
|
||||
```c
|
||||
#include "jerryscript.h"
|
||||
|
||||
static int countdown = 10;
|
||||
|
||||
static jerry_value_t
|
||||
vm_exec_stop_callback (void *user_p)
|
||||
{
|
||||
while (countdown > 0)
|
||||
{
|
||||
countdown--;
|
||||
return jerry_create_undefined ();
|
||||
}
|
||||
|
||||
// The error flag is added automatically.
|
||||
return jerry_create_string ((const jerry_char_t *) "Abort script");
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
jerry_init (JERRY_INIT_EMPTY);
|
||||
|
||||
jerry_set_vm_exec_stop_callback (vm_exec_stop_callback, &countdown, 16);
|
||||
|
||||
// Inifinte loop.
|
||||
const jerry_char_t script[] = "while(true) {}";
|
||||
|
||||
jerry_value_t parsed_code = jerry_parse (NULL, 0, script, sizeof (script) - 1, JERRY_PARSE_NO_OPTS);
|
||||
jerry_release_value (jerry_run (parsed_code));
|
||||
jerry_release_value (parsed_code);
|
||||
jerry_cleanup ();
|
||||
}
|
||||
```
|
||||
|
||||
**See also**
|
||||
|
||||
- [jerry_init](#jerry_init)
|
||||
- [jerry_cleanup](#jerry_cleanup)
|
||||
- [jerry_parse](#jerry_parse)
|
||||
- [jerry_run](#jerry_run)
|
||||
- [jerry_vm_exec_stop_callback_t](#jerry_vm_exec_stop_callback_t)
|
||||
# Backtrace functions
|
||||
|
||||
## jerry_get_backtrace
|
||||
|
||||
@@ -9099,7 +9095,7 @@ main (void)
|
||||
|
||||
jerry_value_t global = jerry_get_global_object ();
|
||||
|
||||
/* Register the "dump_backtrace" method. */
|
||||
/* Register the "capture_backtrace" method. */
|
||||
{
|
||||
jerry_value_t func = jerry_create_external_function (backtrace_handler);
|
||||
jerry_value_t name = jerry_create_string ((const jerry_char_t *) "backtrace");
|
||||
@@ -9141,90 +9137,58 @@ main (void)
|
||||
- [jerry_create_external_function](#jerry_create_external_function)
|
||||
|
||||
|
||||
## jerry_get_backtrace_from
|
||||
## jerry_backtrace_capture
|
||||
|
||||
**Summary**
|
||||
|
||||
Get backtrace. The backtrace is an array of strings where
|
||||
each string contains the position of the corresponding frame.
|
||||
The array length is zero if the backtrace is not available.
|
||||
|
||||
Collecting the trace starts after the function specified in
|
||||
the `ignored_function` parameter. This parameter can be used to
|
||||
skip the helper function(s) which collects the backtrace from
|
||||
the backtrace data.
|
||||
|
||||
*Notes*:
|
||||
- Returned value must be freed with [jerry_release_value](#jerry_release_value) when it
|
||||
is no longer needed.
|
||||
- This feature depends on build option (`JERRY_LINE_INFO`) and can be checked
|
||||
in runtime with the `JERRY_FEATURE_LINE_INFO` feature enum value,
|
||||
see: [jerry_is_feature_enabled](#jerry_is_feature_enabled).
|
||||
Low-level function to capture each backtrace frame. The captured frame data
|
||||
is passed to a callback function. To improve performance, the majority of
|
||||
the frame data is not initialized when the callback function is called. The
|
||||
initialization of these fields can be done later by helper functions such
|
||||
as [jerry_backtrace_get_location](#jerry_backtrace_get_location).
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
jerry_value_t
|
||||
jerry_get_backtrace_from (uint32_t max_depth, jerry_value_t ignored_function);
|
||||
void
|
||||
jerry_backtrace_capture (jerry_backtrace_callback_t callback, void *user_p);
|
||||
```
|
||||
|
||||
- `max_depth` - backtrace collection stops after reaching this value, 0 = unlimited
|
||||
- `ignored_function` - if this function is present in the backtrace, the backtrace
|
||||
only contains the stack frames after the topmost instance of
|
||||
this function. Otherwise this parameter is ignored
|
||||
- return value
|
||||
- a newly constructed JS array
|
||||
- `callback` - a [jerry_backtrace_callback_t](#jerry_backtrace_callback_t) callback
|
||||
which is called for each captured frame
|
||||
- `user_p` - pointer passed to the `callback` function, can be NULL
|
||||
|
||||
*New in version 2.4*.
|
||||
*New in version [[NEXT_RELEASE]]*.
|
||||
|
||||
**Example**
|
||||
|
||||
[doctest]: # (name="02.API-REFERENCE-jsbacktracefrom.c")
|
||||
[doctest]: # (name="02.API-REFERENCE-jscapturebacktrace.c")
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "jerryscript.h"
|
||||
|
||||
static bool
|
||||
backtrace_callback (jerry_backtrace_frame_t *frame_p,
|
||||
void *user_p)
|
||||
{
|
||||
printf (" A stack frame is captured\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
static jerry_value_t
|
||||
backtrace_handler (const jerry_value_t function_obj,
|
||||
const jerry_value_t this_val,
|
||||
const jerry_value_t args_p[],
|
||||
const jerry_length_t args_count)
|
||||
{
|
||||
if (!jerry_is_feature_enabled (JERRY_FEATURE_LINE_INFO))
|
||||
{
|
||||
printf ("Line info disabled, no backtrace will be printed\n");
|
||||
return jerry_create_undefined ();
|
||||
}
|
||||
(void) function_obj;
|
||||
(void) this_val;
|
||||
(void) args_p;
|
||||
(void) args_count;
|
||||
|
||||
if (args_count < 1)
|
||||
{
|
||||
printf ("Ignored function is not specified\n");
|
||||
return jerry_create_undefined ();
|
||||
}
|
||||
|
||||
/* If the line info feature is disabled an empty array will be returned. */
|
||||
jerry_value_t backtrace_array = jerry_get_backtrace_from (0, args_p[0]);
|
||||
uint32_t array_length = jerry_get_array_length (backtrace_array);
|
||||
|
||||
for (uint32_t idx = 0; idx < array_length; idx++)
|
||||
{
|
||||
jerry_value_t property = jerry_get_property_by_index (backtrace_array, idx);
|
||||
|
||||
jerry_char_t string_buffer[64];
|
||||
jerry_size_t copied_bytes = jerry_substring_to_char_buffer (property,
|
||||
0,
|
||||
63,
|
||||
string_buffer,
|
||||
63);
|
||||
string_buffer[copied_bytes] = '\0';
|
||||
printf(" %d: %s\n", idx, string_buffer);
|
||||
|
||||
jerry_release_value (property);
|
||||
}
|
||||
|
||||
jerry_release_value (backtrace_array);
|
||||
jerry_backtrace_capture (&backtrace_callback, NULL);
|
||||
|
||||
return jerry_create_undefined ();
|
||||
} /* backtrace_handler */
|
||||
@@ -9252,7 +9216,7 @@ main (void)
|
||||
"function g() { h (); }\n"
|
||||
"function h() { backtrace (g); }\n"
|
||||
"f ();\n");
|
||||
const char *resource = "demo_memoryjs";
|
||||
const char *resource = "demo_backtrace.js";
|
||||
|
||||
jerry_value_t program = jerry_parse ((const jerry_char_t *) resource,
|
||||
strlen (resource),
|
||||
@@ -9275,8 +9239,322 @@ main (void)
|
||||
**See also**
|
||||
|
||||
- [jerry_get_backtrace](#jerry_get_backtrace)
|
||||
- [jerry_backtrace_get_frame_type](#jerry_backtrace_get_frame_type)
|
||||
- [jerry_backtrace_get_location](#jerry_backtrace_get_location)
|
||||
- [jerry_backtrace_get_function](#jerry_backtrace_get_function)
|
||||
- [jerry_backtrace_is_strict](#jerry_backtrace_is_strict)
|
||||
|
||||
|
||||
## jerry_backtrace_get_frame_type
|
||||
|
||||
**Summary**
|
||||
|
||||
Returns with the type of the backtrace frame. This function can only be called
|
||||
from the callback function of [jerry_backtrace_capture](#jerry_backtrace_capture),
|
||||
and the value becomes invalid after the callback returns.
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
jerry_backtrace_frame_types_t
|
||||
jerry_backtrace_get_frame_type (jerry_backtrace_frame_t *frame_p);
|
||||
```
|
||||
|
||||
- `frame_p` - a frame passed to the [jerry_backtrace_callback_t](#jerry_backtrace_callback_t) callback
|
||||
- return value
|
||||
- frame type listed in [jerry_backtrace_frame_types_t](#jerry_backtrace_frame_types_t)
|
||||
|
||||
*New in version [[NEXT_RELEASE]]*.
|
||||
|
||||
**Example**
|
||||
|
||||
See the example of [jerry_backtrace_capture](#jerry_backtrace_capture)
|
||||
with the following callback function:
|
||||
|
||||
```c
|
||||
static bool
|
||||
backtrace_callback (jerry_backtrace_frame_t *frame_p,
|
||||
void *user_p)
|
||||
{
|
||||
switch (jerry_backtrace_get_frame_type (frame_p))
|
||||
{
|
||||
case JERRY_BACKTRACE_FRAME_JS:
|
||||
{
|
||||
printf (" ECMAScript frame\n");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
printf (" Other frame\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
**See also**
|
||||
|
||||
- [jerry_backtrace_capture](#jerry_backtrace_capture)
|
||||
|
||||
|
||||
## jerry_backtrace_get_location
|
||||
|
||||
**Summary**
|
||||
|
||||
Initialize and return with the location private field of a backtrace
|
||||
frame. If the location is not available, the returned value is NULL.
|
||||
This function can only be called from the callback function of
|
||||
[jerry_backtrace_capture](#jerry_backtrace_capture), and the value
|
||||
becomes invalid after the callback returns.
|
||||
|
||||
*Notes*:
|
||||
- Location information can only be retrieved if JERRY_FEATURE_LINE_INFO feature is
|
||||
enabled. Otherwise the function always returns with NULL.
|
||||
- The returned data must not be modified, and does not need to be freed.
|
||||
Any cleanup is done automatically after the callback is returned.
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
const jerry_backtrace_location_t *
|
||||
jerry_backtrace_get_location (jerry_backtrace_frame_t *frame_p);
|
||||
```
|
||||
|
||||
- `frame_p` - a frame passed to the [jerry_backtrace_callback_t](#jerry_backtrace_callback_t) callback
|
||||
- return value
|
||||
- pointer to the location private field if the location is available,
|
||||
- NULL otherwise
|
||||
|
||||
*New in version [[NEXT_RELEASE]]*.
|
||||
|
||||
**Example**
|
||||
|
||||
See the example of [jerry_backtrace_capture](#jerry_backtrace_capture)
|
||||
with the following callback function:
|
||||
|
||||
```c
|
||||
static bool
|
||||
backtrace_callback (jerry_backtrace_frame_t *frame_p,
|
||||
void *user_p)
|
||||
{
|
||||
const jerry_backtrace_location_t *location_p;
|
||||
location_p = jerry_backtrace_get_location (frame_p);
|
||||
|
||||
if (location_p == NULL)
|
||||
{
|
||||
printf ("No location info is available\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
jerry_char_t string_buffer[64];
|
||||
jerry_size_t copied_bytes = jerry_substring_to_char_buffer (location_p->resource_name,
|
||||
0,
|
||||
63,
|
||||
string_buffer,
|
||||
63);
|
||||
string_buffer[copied_bytes] = '\0';
|
||||
printf(" %s:%d:%d\n", string_buffer, (int) location_p->line, (int) location_p->column);
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
**See also**
|
||||
|
||||
- [jerry_backtrace_capture](#jerry_backtrace_capture)
|
||||
|
||||
|
||||
## jerry_backtrace_get_function
|
||||
|
||||
**Summary**
|
||||
|
||||
Initialize and return with the called function private field of a backtrace frame.
|
||||
The backtrace frame is created for running the code bound to this function. This
|
||||
function can only be called from the callback function of
|
||||
[jerry_backtrace_capture](#jerry_backtrace_capture), and the value becomes invalid
|
||||
after the callback returns.
|
||||
|
||||
*Notes*:
|
||||
- The returned data must not be modified, and does not need to be freed.
|
||||
Any cleanup is done automatically after the callback is returned.
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
const jerry_value_t *
|
||||
jerry_backtrace_get_function (jerry_backtrace_frame_t *frame_p);
|
||||
```
|
||||
|
||||
- `frame_p` - a frame passed to the [jerry_backtrace_callback_t](#jerry_backtrace_callback_t) callback
|
||||
- return value
|
||||
- pointer to the called function if the function is available,
|
||||
- NULL otherwise
|
||||
|
||||
*New in version [[NEXT_RELEASE]]*.
|
||||
|
||||
**Example**
|
||||
|
||||
See the example of [jerry_backtrace_capture](#jerry_backtrace_capture)
|
||||
with the following callback function:
|
||||
|
||||
```c
|
||||
static bool
|
||||
backtrace_callback (jerry_backtrace_frame_t *frame_p,
|
||||
void *user_p)
|
||||
{
|
||||
jerry_value_t *function_p = jerry_backtrace_get_function (frame_p);
|
||||
|
||||
if (function_p != NULL)
|
||||
{
|
||||
printf ("Called function is available");
|
||||
return true;
|
||||
}
|
||||
|
||||
printf ("Called function is NOT available");
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
**See also**
|
||||
|
||||
- [jerry_backtrace_capture](#jerry_backtrace_capture)
|
||||
|
||||
|
||||
## jerry_backtrace_is_strict
|
||||
|
||||
**Summary**
|
||||
|
||||
Returns true, if the code bound to the backtrace frame is strict mode
|
||||
code. This function can only be called from the callback function of
|
||||
[jerry_backtrace_capture](#jerry_backtrace_capture), and the value
|
||||
becomes invalid after the callback returns.
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
bool
|
||||
jerry_backtrace_is_strict (jerry_backtrace_frame_t *frame_p);
|
||||
```
|
||||
|
||||
- `frame_p` - a frame passed to the [jerry_backtrace_callback_t](#jerry_backtrace_callback_t) callback
|
||||
- return value
|
||||
- true, if strict mode code is bound to the frame
|
||||
- false, otherwise
|
||||
|
||||
*New in version [[NEXT_RELEASE]]*.
|
||||
|
||||
**Example**
|
||||
|
||||
See the example of [jerry_backtrace_capture](#jerry_backtrace_capture)
|
||||
with the following callback function:
|
||||
|
||||
```c
|
||||
static bool
|
||||
backtrace_callback (jerry_backtrace_frame_t *frame_p,
|
||||
void *user_p)
|
||||
{
|
||||
if (jerry_backtrace_is_strict (frame_p))
|
||||
{
|
||||
printf ("Strict mode code is running");
|
||||
return truel
|
||||
}
|
||||
|
||||
printf ("Non-strict mode code is running");
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
**See also**
|
||||
|
||||
- [jerry_backtrace_capture](#jerry_backtrace_capture)
|
||||
|
||||
|
||||
# Miscellaneous functions
|
||||
|
||||
## jerry_set_vm_exec_stop_callback
|
||||
|
||||
**Summary**
|
||||
|
||||
When JERRY_FEATURE_VM_EXEC_STOP is enabled a callback function can be
|
||||
specified by this function. This callback is periodically called when
|
||||
JerryScript executes an ECMAScript program.
|
||||
|
||||
If the callback returns with undefined value the ECMAScript execution
|
||||
continues. Otherwise the result is thrown by the engine (if the error
|
||||
flag is not set for the returned value the engine automatically sets
|
||||
it). The callback function might be called again even if it threw
|
||||
an error. In this case the function must throw the same error again.
|
||||
|
||||
To reduce the CPU overhead of constantly checking the termination
|
||||
condition the callback is called when a backward jump is executed
|
||||
or an exception is caught. Setting the `frequency` to a greater
|
||||
than `1` value reduces this overhead further. If its value is N
|
||||
only every Nth event (backward jump, etc.) trigger the next check.
|
||||
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
void
|
||||
jerry_set_vm_exec_stop_callback (jerry_vm_exec_stop_callback_t stop_cb,
|
||||
void *user_p,
|
||||
uint32_t frequency);
|
||||
```
|
||||
|
||||
- `stop_cb` - periodically called callback (passing NULL disables this feature)
|
||||
- `user_p` - user pointer passed to the `stop_cb` function
|
||||
- `frequency` - frequency of calling the `stop_cb` function
|
||||
|
||||
*New in version 2.0*.
|
||||
|
||||
**Example**
|
||||
|
||||
[doctest]: # (test="link")
|
||||
|
||||
```c
|
||||
#include "jerryscript.h"
|
||||
|
||||
static int countdown = 10;
|
||||
|
||||
static jerry_value_t
|
||||
vm_exec_stop_callback (void *user_p)
|
||||
{
|
||||
while (countdown > 0)
|
||||
{
|
||||
countdown--;
|
||||
return jerry_create_undefined ();
|
||||
}
|
||||
|
||||
// The error flag is added automatically.
|
||||
return jerry_create_string ((const jerry_char_t *) "Abort script");
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
jerry_init (JERRY_INIT_EMPTY);
|
||||
|
||||
jerry_set_vm_exec_stop_callback (vm_exec_stop_callback, &countdown, 16);
|
||||
|
||||
// Infinite loop.
|
||||
const jerry_char_t script[] = "while(true) {}";
|
||||
|
||||
jerry_value_t parsed_code = jerry_parse (NULL, 0, script, sizeof (script) - 1, JERRY_PARSE_NO_OPTS);
|
||||
jerry_release_value (jerry_run (parsed_code));
|
||||
jerry_release_value (parsed_code);
|
||||
jerry_cleanup ();
|
||||
}
|
||||
```
|
||||
|
||||
**See also**
|
||||
|
||||
- [jerry_init](#jerry_init)
|
||||
- [jerry_cleanup](#jerry_cleanup)
|
||||
- [jerry_parse](#jerry_parse)
|
||||
- [jerry_run](#jerry_run)
|
||||
- [jerry_vm_exec_stop_callback_t](#jerry_vm_exec_stop_callback_t)
|
||||
|
||||
## jerry_get_resource_name
|
||||
|
||||
**Summary**
|
||||
|
||||
Reference in New Issue
Block a user