Add C-API for the debugger. (#1688)

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2017-03-29 12:46:07 +02:00
committed by GitHub
parent 2d9484a968
commit 343bac56b2
5 changed files with 259 additions and 3 deletions
+125 -1
View File
@@ -69,4 +69,128 @@ function. This resource name is used by the client to identify
the corresponding resource. In general it is always recommended to
use `jerry_parse_named_resource ()` when the resource name is
available because it silently ignores the resource name if the
debugger is disabled.
debugger is disabled.
## JerryScript debugger C-API interface
The following section describes the debugger functions
available for the host application.
### jerry_debugger_is_connected
**Summary**
Returns true if a remote debugger client is connected.
**Prototype**
```c
bool
jerry_debugger_is_connected (void);
```
**Example**
```c
{
jerry_init (JERRY_INIT_DEBUGGER);
if (jerry_debugger_is_connected ())
{
printf ("A remote debugger client is connected.");
}
}
```
### jerry_debugger_stop
**Summary**
Stops execution at the next available breakpoint if a remote
debugger client is connected and the engine is not waiting at
a breakpoint. The engine will stop regardless the breakpoint
is enabled or not.
**Prototype**
```c
void
jerry_debugger_stop (void)
```
**Example**
```c
{
jerry_init (JERRY_INIT_DEBUGGER);
jerry_debugger_stop ();
}
```
**See also**
- [jerry_debugger_continue](#jerry_debugger_continue)
### jerry_debugger_continue
**Summary**
If the engine would stop at the next available breakpoint it
cancels this effect. The engine will still stop at enabled
breakpoints. This function effectively negates the effect of
[jerry_debugger_stop ()](#jerry_debugger_stop) calls or stop
requests issued by the debugger client.
**Prototype**
```c
void
jerry_debugger_continue (void)
```
**Example**
```c
{
jerry_init (JERRY_INIT_DEBUGGER);
jerry_debugger_continue ();
}
```
**See also**
- [jerry_debugger_stop](#jerry_debugger_stop)
### jerry_debugger_disable_stop_at_breakpoint
**Summary**
Enables or disables stopping at breakpoints. When stopping is
disabled all breakpoints are ignored including user enabled
breakpoints. This allows hidden execution of ECMAScript code.
**Prototype**
```c
void
jerry_debugger_stop_at_breakpoint (bool enable_stop_at_breakpoint)
```
- `enable_stop_at_breakpoint` - enable (=`true`) or disable (=`false`) stopping at breakpoints
**Example**
```c
{
jerry_init (JERRY_INIT_DEBUGGER);
jerry_debugger_stop_at_breakpoint (true);
// Protected execution of JavaScript code.
jerry_eval (...);
jerry_debugger_stop_at_breakpoint (false);
}
```