diff --git a/07.DEBUGGER.md b/07.DEBUGGER.md index 55083ab61..d28a9da58 100644 --- a/07.DEBUGGER.md +++ b/07.DEBUGGER.md @@ -79,3 +79,127 @@ 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. + +## 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](#jerrydebuggercontinue) + +### 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 ()](#jerrydebuggerstop) 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](#jerrydebuggerstop) + +### 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); +} +```